Fix checklist item reordering [SCI-9486]

This commit is contained in:
Martin Artnik 2023-10-06 14:32:39 +02:00
parent 5265312125
commit d358dd2140
2 changed files with 8 additions and 3 deletions

View file

@ -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);
}
});

View file

@ -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() {