mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-11 07:34:41 +08:00
Fix confusion with attachment indices, component key [SCI-7023] (#4288)
This commit is contained in:
parent
2800274d7c
commit
f08e57c428
3 changed files with 8 additions and 8 deletions
|
@ -76,11 +76,11 @@
|
|||
<template v-for="(attachment, index) in attachmentsOrdered">
|
||||
<component
|
||||
:is="attachment_view_mode(attachmentsOrdered[index])"
|
||||
:key="index"
|
||||
:attachment.sync="attachmentsOrdered[index]"
|
||||
:key="attachment.id"
|
||||
:attachment="attachment"
|
||||
:stepId="parseInt(step.id)"
|
||||
@attachment:viewMode="updateAttachmentViewMode"
|
||||
@attachment:delete="deleteAttachment"
|
||||
@attachment:delete="deleteAttachment(attachment.id)"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
|
@ -159,9 +159,8 @@
|
|||
}
|
||||
return `${attachment.attributes.view_mode}Attachment`
|
||||
},
|
||||
deleteAttachment(index) {
|
||||
this.attachments.splice(index, 1)
|
||||
this.$emit('attachment:deleted')
|
||||
deleteAttachment(id) {
|
||||
this.$emit('attachment:deleted', id)
|
||||
},
|
||||
initMarvinJS() {
|
||||
// legacy logic from app/assets/javascripts/sitewide/marvinjs_editor.js
|
||||
|
|
|
@ -400,7 +400,8 @@
|
|||
$('.comments-sidebar .close-btn').click();
|
||||
this.showCommentsSidebar = true
|
||||
},
|
||||
attachmentDeleted() {
|
||||
attachmentDeleted(id) {
|
||||
this.attachments = this.attachments.filter((a) => a.id !== id );
|
||||
this.$emit('stepUpdated');
|
||||
},
|
||||
closeCommentsSidebar() {
|
||||
|
|
|
@ -15,7 +15,7 @@ export default {
|
|||
HelperModule.flashAlertMsg(result.flash, 'success');
|
||||
},
|
||||
error: () => {
|
||||
HelperModule.flashAlertMsg(i18n.t('general.no_permissions'), 'danger');
|
||||
HelperModule.flashAlertMsg(this.i18n.t('general.no_permissions'), 'danger');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue