Skip to content
Snippets Groups Projects
Commit 32e0da4c authored by Sébastien DA ROCHA's avatar Sébastien DA ROCHA :bicyclist:
Browse files

Merge branch 'evol/redmine-ticket-11442-comments' into 'develop'

get events for currrent feature and adapt template

See merge request geocontrib/geocontrib-frontend!20
parents cf394eba 50253d40
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,20 @@ import store from '../store'
const baseUrl = store.state.configuration.VUE_APP_DJANGO_API_BASE;
const featureAPI = {
async getFeatureEvents(featureId) {
const response = await axios.get(
`${baseUrl}features/${featureId}/events/`
);
if (
response.status === 200 &&
response.data
) {
return response.data;
} else {
return null;
}
},
async getFeatureAttachments(featureId) {
const response = await axios.get(
`${baseUrl}features/${featureId}/attachments/`
......
......@@ -235,17 +235,15 @@
</div>
<div class="extra text">
{{ event.related_comment.comment }}
<div v-frag v-if="event.related_comment.attachments">
<div
v-frag
v-for="att in event.related_comment.attachments"
:key="att.title"
<div v-frag v-if="event.related_comment.attachment">
<br /><a
:href="
DJANGO_BASE_URL + event.related_comment.attachment.url
"
tarrget="_blank"
><i class="paperclip fitted icon"></i>
{{ event.related_comment.attachment.title }}</a
>
<br /><a :href="att.url" tarrget="_blank"
><i class="paperclip fitted icon"></i>
{{ att.title }}</a
>
</div>
</div>
</div>
</div>
......@@ -273,15 +271,6 @@
method="POST"
enctype="multipart/form-data"
>
<!-- <div
v-if="comment_form.non_field_errors"
class="alert alert-danger"
role="alert"
>
<span v-for="error in comment_form.non_field_errors" :key="error">
{{ error }}
</span>
</div> -->
<div class="required field">
<label :for="comment_form.comment.id_for_label"
>Ajouter un commentaire</label
......@@ -539,6 +528,12 @@ export default {
});
},
getFeatureEvents() {
featureAPI
.getFeatureEvents(this.$route.params.slug_signal)
.then((data) => (this.events = data));
},
getFeatureAttachments() {
featureAPI
.getFeatureAttachments(this.$route.params.slug_signal)
......@@ -562,7 +557,7 @@ export default {
"feature_type/SET_CURRENT_FEATURE_TYPE_SLUG",
this.$route.params.slug_type_signal
);
this.getFeatureEvents();
this.getFeatureAttachments();
this.getLinkedFeatures();
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment