Mercurial > gemma
changeset 2448:8044e379d8ee
client:pdf-gen template: give feedback after uploading template
* show a message after successfully uploading template
* fix code to give feedback when uploading a template with a name in jsonfile already exist
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Fri, 01 Mar 2019 13:21:18 +0100 |
parents | 522024fa06eb |
children | 0c9121abf120 |
files | client/src/components/systemconfiguration/PDFTemplates.vue |
diffstat | 1 files changed, 22 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/systemconfiguration/PDFTemplates.vue Fri Mar 01 13:00:42 2019 +0100 +++ b/client/src/components/systemconfiguration/PDFTemplates.vue Fri Mar 01 13:21:18 2019 +0100 @@ -30,7 +30,10 @@ <td class="text-right"> <button class="btn btn-sm btn-dark" - @click="deleteTemplate(template)" + @click=" + deleteTemplate(template); + showSuccessUploadMsg = false; + " > <font-awesome-icon icon="trash" /> </button> @@ -39,7 +42,13 @@ </transition-group> </table> </transition> - <button class="btn btn-info mt-2" @click="$refs.uploadTemplate.click()"> + <button + class="btn btn-info mt-2" + @click=" + $refs.uploadTemplate.click(); + showSuccessUploadMsg = false; + " + > <font-awesome-icon icon="spinner" class="fa-spin fa-fw" @@ -48,6 +57,11 @@ <font-awesome-icon icon="upload" class="fa-fw" v-else /> <translate>Upload new template</translate> </button> + <div v-if="showSuccessUploadMsg" class="text-center"> + <p class="text-muted" v-translate> + {{ templateToUpload.name }} uploaded successfully + </p> + </div> </div> </div> </template> @@ -84,7 +98,9 @@ data() { return { templates: [], - uploading: false + uploading: false, + templateToUpload: "", + showSuccessUploadMsg: false }; }, methods: { @@ -119,6 +135,8 @@ ) .then(() => { this.loadTemplates(); + this.templateToUpload = template; + this.showSuccessUploadMsg = true; }) .catch(e => { const { status, data } = e.response; @@ -129,6 +147,7 @@ }) .finally(() => { this.uploading = false; + this.$refs.uploadTemplate.value = null; }); } else { displayError({