mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 14:45:56 +08:00
Fix checklist item reordering [SCI-9486]
This commit is contained in:
parent
5265312125
commit
d358dd2140
|
@ -46,6 +46,7 @@
|
|||
:key="checklistItem.id"
|
||||
:checklistItem="checklistItem"
|
||||
:locked="locked"
|
||||
:reordering="reordering"
|
||||
:reorderChecklistItemUrl="element.attributes.orderable.urls.reorder_url"
|
||||
:inRepository="inRepository"
|
||||
:draggable="checklistItems.length > 1"
|
||||
|
@ -122,7 +123,6 @@
|
|||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
if (this.isNew) {
|
||||
this.addItem(1);
|
||||
} else {
|
||||
|
@ -143,7 +143,7 @@
|
|||
});
|
||||
},
|
||||
locked() {
|
||||
return this.reordering || this.editingName || !this.element.attributes.orderable.urls.update_url
|
||||
return this.editingName || !this.element.attributes.orderable.urls.update_url
|
||||
},
|
||||
addingNewItem() {
|
||||
return this.checklistItems.find((item) => item.attributes.isNew);
|
||||
|
@ -184,7 +184,7 @@
|
|||
loadChecklistItems(insertAfter) {
|
||||
$.get(this.element.attributes.orderable.urls.checklist_items_url, (result) => {
|
||||
this.checklistItems = result.data;
|
||||
if (insertAfter != null) {
|
||||
if (insertAfter) {
|
||||
this.addItem(insertAfter);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
'flex-grow': editingText,
|
||||
}">
|
||||
<InlineEdit
|
||||
:class="{ 'pointer-events-none': reordering }"
|
||||
:value="checklistItem.attributes.text"
|
||||
:sa_value="checklistItem.attributes.sa_text"
|
||||
:characterLimit="10000"
|
||||
|
@ -79,6 +80,10 @@
|
|||
},
|
||||
reorderChecklistItemUrl: {
|
||||
type: String
|
||||
},
|
||||
reordering: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
|
Loading…
Reference in a new issue