From aee825e003d770af8a40afac3f05cb12b60dc12c Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Thu, 13 Dec 2018 13:05:30 -0200 Subject: [PATCH] Adds confirmation dialog to attachment deletion on item edition page. Makes all modal borders square instead of rounded. Adds key attributes part of the v-fors on activity details. --- .../components/edition/item-edition-form.vue | 53 ++++++++++++------- .../other/activity/activity-details-modal.vue | 15 ++++-- .../components/other/checkbox-radio-modal.vue | 1 - src/admin/scss/_modals.scss | 3 +- src/admin/tainacan-admin-i18n.php | 1 + 5 files changed, 46 insertions(+), 27 deletions(-) diff --git a/src/admin/components/edition/item-edition-form.vue b/src/admin/components/edition/item-edition-form.vue index cabdd2bf0..aaf4ba043 100644 --- a/src/admin/components/edition/item-edition-form.vue +++ b/src/admin/components/edition/item-edition-form.vue @@ -905,24 +905,24 @@ export default { this.form.document_type = 'url'; this.form.document = this.urlLink; this.updateItemDocument({ item_id: this.itemId, document: this.form.document, document_type: this.form.document_type }) - .then(item => { - this.item.document_as_html = item.document_as_html; - this.isLoading = false; + .then(item => { + this.item.document_as_html = item.document_as_html; + this.isLoading = false; - let oldThumbnail = this.item.thumbnail; - if (item.document_type == 'url' && oldThumbnail != item.thumbnail ) - this.item.thumbnail = item.thumbnail; - }) - .catch((errors) => { - for (let error of errors.errors) { - for (let metadatum of Object.keys(error)){ - eventBus.errors.push({ metadatum_id: metadatum, errors: error[metadatum]}); + let oldThumbnail = this.item.thumbnail; + if (item.document_type == 'url' && oldThumbnail != item.thumbnail ) + this.item.thumbnail = item.thumbnail; + }) + .catch((errors) => { + for (let error of errors.errors) { + for (let metadatum of Object.keys(error)){ + eventBus.errors.push({ metadatum_id: metadatum, errors: error[metadatum]}); + } } - } - this.formErrorMessage = errors.error_message; + this.formErrorMessage = errors.error_message; - this.isLoading = false; - }); + this.isLoading = false; + }); }, cancelURLSelection() { this.isURLModalActive = false; @@ -945,11 +945,24 @@ export default { }); }, deleteAttachment(attachment) { - this.removeAttachmentFromItem(attachment.id) - .then(() => { }) - .catch((error) => { - this.$console.error(error); - }); + + this.$modal.open({ + parent: this, + component: CustomDialog, + props: { + icon: 'alert', + title: this.$i18n.get('label_warning'), + message: this.$i18n.get('info_warning_attachment_delete'), + onConfirm: () => { + this.removeAttachmentFromItem(attachment.id) + .then(() => { }) + .catch((error) => { + this.$console.error(error); + }); + } + } + }); + }, initializeMediaFrames() { diff --git a/src/admin/components/other/activity/activity-details-modal.vue b/src/admin/components/other/activity/activity-details-modal.vue index b23850225..968478518 100644 --- a/src/admin/components/other/activity/activity-details-modal.vue +++ b/src/admin/components/other/activity/activity-details-modal.vue @@ -11,8 +11,10 @@

{{ $i18n.get('label_activity_author') }}: {{ activity.user_name }}

-