Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
a93b6398
Commit
a93b6398
authored
3 years ago
by
pabois
Browse files
Options
Downloads
Patches
Plain Diff
sortable
parent
a578b023
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/assets/javascripts/admin/treeview.js
+2
-1
2 additions, 1 deletion
app/assets/javascripts/admin/treeview.js
app/views/admin/communication/website/pages/children.js.erb
+1
-24
1 addition, 24 deletions
app/views/admin/communication/website/pages/children.js.erb
with
3 additions
and
25 deletions
app/assets/javascripts/admin/treeview.js
+
2
−
1
View file @
a93b6398
...
...
@@ -52,7 +52,8 @@ window.osuny.treeView = {
invoke:
function
()
{
'
use strict
'
;
return
{
init
:
this.init.bind(this)
init
:
this.init.bind(this),
initSortable:
this.initSortable.bind(this)
};
}
}.invoke();
...
...
This diff is collapsed.
Click to expand it.
app/views/admin/communication/website/pages/children.js.erb
+
1
−
24
View file @
a93b6398
...
...
@@ -3,27 +3,4 @@ $('.js-treeview-children', $branch).html("<%= escape_javascript(render 'treebran
$branch.addClass('treeview__branch--loaded');
var nestedSortables,
i;
nestedSortables = [].slice.call(document.querySelectorAll('.js-treeview-sortable'));
for (i = 0; i
<
nestedSortables.length
;
i
+=
1)
{
new
Sortable
(
nestedSortables
[
i
],
{
group:
'
nested
',
animation:
150,
fallbackOnBody:
true
,
swapThreshold:
0.65,
onEnd:
function
(/
**Event*
/
evt
)
{
console.log
(
evt
);
var
itemEl =
evt.item;
//
dragged
HTMLElement
evt.to
;
//
target
list
evt.from
;
//
previous
list
evt.oldIndex
;
//
element
'
s
old
index
within
old
parent
evt.newIndex
;
//
element
'
s
new
index
within
new
parent
evt.oldDraggableIndex
;
//
element
'
s
old
index
within
old
parent
,
only
counting
draggable
elements
evt.newDraggableIndex
;
//
element
'
s
new
index
within
new
parent
,
only
counting
draggable
elements
evt.clone
//
the
clone
element
evt.pullMode
;
//
when
item
is
in
another
sortable:
`"
clone
"`
if
cloning
,
`
true
`
if
moving
},
});
}
window.osuny.treeView.initSortable();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment