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

display success message

parent b2fe5296
No related branches found
No related tags found
1 merge request!57Anom/redmine ticket 11852 empty comment
...@@ -138,18 +138,16 @@ ...@@ -138,18 +138,16 @@
<div <div
v-for="(message, index) in messages" v-for="(message, index) in messages"
:key="'message-' + index" :key="'message-' + index"
class="ui positive message" class="ui info message"
> >
<div class="ui info message"> <div class="header">
<div class="header"> <i class="info circle icon"></i> Informations
<i class="info circle icon"></i> Informations
</div>
<ul class="list">
{{
message.comment
}}
</ul>
</div> </div>
<ul class="list">
{{
message.comment
}}
</ul>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -47,6 +47,7 @@ export default new Vuex.Store({ ...@@ -47,6 +47,7 @@ export default new Vuex.Store({
SSO_SETTED: false, SSO_SETTED: false,
USER_LEVEL_PROJECTS: null, USER_LEVEL_PROJECTS: null,
user_permissions: null, user_permissions: null,
messages: []
}, },
mutations: { mutations: {
...@@ -89,6 +90,13 @@ export default new Vuex.Store({ ...@@ -89,6 +90,13 @@ export default new Vuex.Store({
SET_USER_PERMISSIONS(state, userPermissions) { SET_USER_PERMISSIONS(state, userPermissions) {
state.user_permissions = userPermissions; state.user_permissions = userPermissions;
}, },
DISPLAY_MESSAGE(state, comment) {
state.messages = [{ comment }, ...state.messages];
document.getElementById("messages").scrollIntoView({ block: "start", inline: "nearest" });
},
CLEAR_MESSAGES(state) {
state.messages = [];
}
}, },
getters: { getters: {
......
...@@ -15,7 +15,7 @@ const map = { ...@@ -15,7 +15,7 @@ const map = {
basemapsToDelete: [], basemapsToDelete: [],
features: [], features: [],
geojsonFeatures: null, geojsonFeatures: null,
layers: null layers: null,
}, },
mutations: { mutations: {
SET_LAYERS(state, layers) { SET_LAYERS(state, layers) {
......
...@@ -150,6 +150,7 @@ ...@@ -150,6 +150,7 @@
<td> <td>
{{ link.relation_type_display }} {{ link.relation_type_display }}
<router-link <router-link
v-if="link.feature_to.feature_type_slug"
:to="{ :to="{
name: 'details-signalement', name: 'details-signalement',
params: { params: {
...@@ -438,20 +439,25 @@ export default { ...@@ -438,20 +439,25 @@ export default {
comment: response.data.id, comment: response.data.id,
}) })
.then(() => { .then(() => {
this.getFeatureEvents(); //* display new comment on the page this.confirmComment();
this.getFeatureAttachments(); //* display new attachment from comment on the page //this.getFeatureAttachments(); //* display new attachment from comment on the page
this.comment_form.attachment_file.file = null;
this.comment_form.attachment_file.value = null;
this.comment_form.title.file = null;
this.comment_form.title.value = null;
this.comment_form.comment.value = null;
}); });
} else { } else {
this.getFeatureEvents(); this.confirmComment();
} }
}); });
}, },
confirmComment() {
this.$store.commit("DISPLAY_MESSAGE", "Ajout du commentaire confirmé");
this.getFeatureEvents(); //* display new comment on the page
this.comment_form.attachment_file.file = null;
this.comment_form.attachment_file.value = null;
this.comment_form.title.file = null;
this.comment_form.title.value = null;
this.comment_form.comment.value = null;
},
getAttachmentFileData(evt) { getAttachmentFileData(evt) {
const files = evt.target.files || evt.dataTransfer.files; const files = evt.target.files || evt.dataTransfer.files;
const period = files[0].name.lastIndexOf("."); const period = files[0].name.lastIndexOf(".");
......
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