Skip to content
Snippets Groups Projects
Commit 50253d40 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

get events for currrent feature and adapt template

parent 7fd990f0
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,20 @@ import store from '../store' ...@@ -4,6 +4,20 @@ import store from '../store'
const baseUrl = store.state.configuration.VUE_APP_DJANGO_API_BASE; const baseUrl = store.state.configuration.VUE_APP_DJANGO_API_BASE;
const featureAPI = { 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) { async getFeatureAttachments(featureId) {
const response = await axios.get( const response = await axios.get(
`${baseUrl}features/${featureId}/attachments/` `${baseUrl}features/${featureId}/attachments/`
......
...@@ -235,17 +235,15 @@ ...@@ -235,17 +235,15 @@
</div> </div>
<div class="extra text"> <div class="extra text">
{{ event.related_comment.comment }} {{ event.related_comment.comment }}
<div v-frag v-if="event.related_comment.attachments"> <div v-frag v-if="event.related_comment.attachment">
<div <br /><a
v-frag :href="
v-for="att in event.related_comment.attachments" DJANGO_BASE_URL + event.related_comment.attachment.url
:key="att.title" "
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> </div>
</div> </div>
...@@ -273,15 +271,6 @@ ...@@ -273,15 +271,6 @@
method="POST" method="POST"
enctype="multipart/form-data" 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"> <div class="required field">
<label :for="comment_form.comment.id_for_label" <label :for="comment_form.comment.id_for_label"
>Ajouter un commentaire</label >Ajouter un commentaire</label
...@@ -539,6 +528,12 @@ export default { ...@@ -539,6 +528,12 @@ export default {
}); });
}, },
getFeatureEvents() {
featureAPI
.getFeatureEvents(this.$route.params.slug_signal)
.then((data) => (this.events = data));
},
getFeatureAttachments() { getFeatureAttachments() {
featureAPI featureAPI
.getFeatureAttachments(this.$route.params.slug_signal) .getFeatureAttachments(this.$route.params.slug_signal)
...@@ -562,7 +557,7 @@ export default { ...@@ -562,7 +557,7 @@ export default {
"feature_type/SET_CURRENT_FEATURE_TYPE_SLUG", "feature_type/SET_CURRENT_FEATURE_TYPE_SLUG",
this.$route.params.slug_type_signal this.$route.params.slug_type_signal
); );
this.getFeatureEvents();
this.getFeatureAttachments(); this.getFeatureAttachments();
this.getLinkedFeatures(); 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