Skip to content

Commit

Permalink
cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedik committed Jun 21, 2021
1 parent 9d8db69 commit ba784c0
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions build/media_source/system/js/draggable.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ if (container) {
return result;
};

const rearrangeChildren = ($parent) => {
if (!$parent.dataset.itemId) {
return;
}
const parentId = $parent.dataset.itemId;
// Get children list. Each child row should have
// an attribute data-parents=" 1 2 3" where the number is id of parent
const $children = container.querySelectorAll(`tr[data-parents~="${parentId}"]`);

if ($children.length) {
$parent.after(...$children);
}
};

const saveTheOrder = (el) => {
let orderSelector;
let inputSelector;
Expand Down Expand Up @@ -150,19 +164,6 @@ if (container) {
}
};

const rearrangeChildren = ($parent) => {
if (!$parent.dataset.itemId) {
return;
}
const parentId = $parent.dataset.itemId;
// Get children list. Each child row should have an attribute data-parents=" 1 2 3" where the number is id of parent
const $children = container.querySelectorAll(`tr[data-parents~="${parentId}"]`);

if ($children.length) {
$parent.after(...$children);
}
};

// eslint-disable-next-line no-undef
dragula([container], {
// Y axis is considered when determining where an element would be dropped
Expand Down

0 comments on commit ba784c0

Please sign in to comment.