MDL-83328 qbank_managecategories: Fix move dialogue for single child

This commit is contained in:
Mark Johnson
2024-10-01 14:45:33 +01:00
parent 30692df849
commit 89a87b7d4e
3 changed files with 15 additions and 13 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -372,17 +372,19 @@ export default class extends BaseComponent {
categories.push(child);
precedingSibling = category;
});
const precedingId = parseInt(precedingSibling.dataset.categoryid);
if (precedingId !== movingCategoryId) {
// If this is the last child of its parent, also create a target to move the category after this one.
categories.push({
movingcategoryid: movingCategoryId,
precedingsiblingid: precedingId,
parent: precedingSibling.dataset.parent,
categoryname: precedingSibling.dataset.categoryname,
categories: null,
lastchild: true,
});
if (precedingSibling) {
const precedingId = parseInt(precedingSibling.dataset.categoryid);
if (precedingId !== movingCategoryId) {
// If this is the last child of its parent, also create a target to move the category after this one.
categories.push({
movingcategoryid: movingCategoryId,
precedingsiblingid: precedingId,
parent: precedingSibling.dataset.parent,
categoryname: precedingSibling.dataset.categoryname,
categories: null,
lastchild: true,
});
}
}
}
return categories;