Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hierarchy_manager
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
hierarchy_manager
Commits
c4f0d7f2
Commit
c4f0d7f2
authored
5 years ago
by
Mingsong Hu
Browse files
Options
Downloads
Patches
Plain Diff
New feature: In place editor
parent
1c7f906f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
js/Plugin/jstree/hm.jstree.js
+34
-4
34 additions, 4 deletions
js/Plugin/jstree/hm.jstree.js
src/Plugin/HmDisplayPlugin/HmDisplayJstree.php
+4
-1
4 additions, 1 deletion
src/Plugin/HmDisplayPlugin/HmDisplayJstree.php
with
38 additions
and
5 deletions
js/Plugin/jstree/hm.jstree.js
+
34
−
4
View file @
c4f0d7f2
...
@@ -16,15 +16,17 @@
...
@@ -16,15 +16,17 @@
const
searchTextID
=
(
parentID
)
?
'
#hm-jstree-search-
'
+
parentID
:
'
#hm-jstree-search
'
;
const
searchTextID
=
(
parentID
)
?
'
#hm-jstree-search-
'
+
parentID
:
'
#hm-jstree-search
'
;
const
optionsJson
=
treeContainer
.
attr
(
"
options
"
);
const
optionsJson
=
treeContainer
.
attr
(
"
options
"
);
const
dataURL
=
treeContainer
.
attr
(
'
data-source
'
)
+
'
&parent=0
'
;
const
dataURL
=
treeContainer
.
attr
(
'
data-source
'
)
+
'
&parent=0
'
;
const
updateURL
=
treeContainer
.
attr
(
'
url-update
'
)
const
updateURL
=
treeContainer
.
attr
(
'
url-update
'
);
const
newWindow
=
false
;
let
$popDialog
=
[];
let
reload
=
true
;
let
reload
=
true
;
let
rollback
=
false
;
let
rollback
=
false
;
let
after
=
1
;
let
themes
=
{
let
themes
=
{
dots
:
false
,
dots
:
false
,
name
:
'
default
'
name
:
'
default
'
};
};
let
options
;
let
options
;
var
offset
=
0
;
if
(
optionsJson
)
{
if
(
optionsJson
)
{
options
=
JSON
.
parse
(
optionsJson
);
options
=
JSON
.
parse
(
optionsJson
);
...
@@ -104,8 +106,36 @@
...
@@ -104,8 +106,36 @@
// Node selected event.
// Node selected event.
treeContainer
.
on
(
"
select_node.jstree
"
,
function
(
event
,
data
)
{
treeContainer
.
on
(
"
select_node.jstree
"
,
function
(
event
,
data
)
{
var
href
=
data
.
node
.
a_attr
.
href
;
var
href
=
data
.
node
.
a_attr
.
href
;
// Todo: make the target of the new window configurable.
if
(
newWindow
)
{
window
.
open
(
href
,
"
_self
"
);
window
.
open
(
href
,
"
_self
"
);
}
else
{
Drupal
.
ajax
({
url
:
href
,
success
:
function
(
response
)
{
response
.
forEach
(
function
(
element
)
{
if
(
element
.
command
&&
element
.
data
)
{
if
(
element
.
command
===
'
insert
'
&&
element
.
selector
===
null
)
{
$popDialog
[
offset
]
=
$
(
'
<div>
'
+
element
.
data
+
'
</div>
'
).
appendTo
(
'
body
'
);
}
}
});
if
(
$popDialog
[
offset
])
{
let
margin
=
parseInt
(
offset
*
10
%
40
);
let
options
=
{
title
:
'
Edit
'
+
data
.
node
.
text
,
minWidth
:
600
,
draggable
:
true
,
resizable
:
true
,
autoResize
:
false
,
position
:
{
'
my
'
:
'
right bottom
'
,
'
at
'
:
'
right-
'
+
margin
+
'
bottom-
'
+
margin
},
};
Drupal
.
dialog
(
$popDialog
[
offset
++
],
options
).
show
();
}
}
}).
execute
();
}
});
});
// Search filter box.
// Search filter box.
...
...
This diff is collapsed.
Click to expand it.
src/Plugin/HmDisplayPlugin/HmDisplayJstree.php
+
4
−
1
View file @
c4f0d7f2
...
@@ -75,6 +75,7 @@ class HmDisplayJstree extends HmDisplayPluginBase implements HmDisplayPluginInte
...
@@ -75,6 +75,7 @@ class HmDisplayJstree extends HmDisplayPluginBase implements HmDisplayPluginInte
$form
[
'#attached'
][
'library'
][]
=
'hierarchy_manager/libraries.jquery.jstree.'
.
$theme
;
$form
[
'#attached'
][
'library'
][]
=
'hierarchy_manager/libraries.jquery.jstree.'
.
$theme
;
$form
[
'#attached'
][
'library'
][]
=
'hierarchy_manager/feature.hm.jstree'
;
$form
[
'#attached'
][
'library'
][]
=
'hierarchy_manager/feature.hm.jstree'
;
$form
[
'#attached'
][
'library'
][]
=
'core/drupal.dialog.ajax'
;
}
}
return
$form
;
return
$form
;
...
@@ -96,7 +97,9 @@ class HmDisplayJstree extends HmDisplayPluginBase implements HmDisplayPluginInte
...
@@ -96,7 +97,9 @@ class HmDisplayJstree extends HmDisplayPluginBase implements HmDisplayPluginInte
$jstree_node
[
'parent'
]
=
'#'
;
$jstree_node
[
'parent'
]
=
'#'
;
}
}
// Custom data
// Custom data
$jstree_node
[
'a_attr'
]
=
[
'href'
=>
$jstree_node
[
'edit_url'
]];
$jstree_node
[
'a_attr'
]
=
[
'href'
=>
$jstree_node
[
'edit_url'
],
];
unset
(
$jstree_node
[
'edit_url'
]);
unset
(
$jstree_node
[
'edit_url'
]);
// Add this node into the data array.
// Add this node into the data array.
$jstree_data
[]
=
$jstree_node
;
$jstree_data
[]
=
$jstree_node
;
...
...
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