2022-05-17 16:39:17 +08:00
|
|
|
/* global HelperModule i18n */
|
|
|
|
|
|
|
|
export default {
|
|
|
|
methods: {
|
|
|
|
updateViewMode(viewMode) {
|
|
|
|
this.$emit('attachment:viewMode', this.attachment.id, viewMode);
|
|
|
|
},
|
|
|
|
deleteAttachment() {
|
|
|
|
$.ajax({
|
|
|
|
url: this.attachment.attributes.urls.delete,
|
|
|
|
type: 'DELETE',
|
|
|
|
dataType: 'json',
|
|
|
|
success: (result) => {
|
|
|
|
this.$emit('attachment:delete');
|
|
|
|
HelperModule.flashAlertMsg(result.flash, 'success');
|
|
|
|
},
|
|
|
|
error: () => {
|
2022-07-26 19:42:25 +08:00
|
|
|
HelperModule.flashAlertMsg(this.i18n.t('general.no_permissions'), 'danger');
|
2022-05-17 16:39:17 +08:00
|
|
|
}
|
|
|
|
});
|
2023-10-05 21:44:41 +08:00
|
|
|
},
|
|
|
|
reloadAttachments() {
|
|
|
|
this.$emit('attachment:uploaded');
|
2022-05-17 16:39:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|