Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Knowledge Space WP Plugin
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
Service Desk
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
alg
Knowledge Space WP Plugin
Commits
f2520967
Commit
f2520967
authored
3 years ago
by
Maximilian Giller
Browse files
Options
Downloads
Patches
Plain Diff
Fixed interactions with buttons
parent
9976fe6a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
editor/editor.php
+1
-2
1 addition, 2 deletions
editor/editor.php
editor/js/display.js
+25
-8
25 additions, 8 deletions
editor/js/display.js
editor/js/editor.js
+3
-0
3 additions, 0 deletions
editor/js/editor.js
editor/js/interactions.js
+11
-0
11 additions, 0 deletions
editor/js/interactions.js
with
40 additions
and
10 deletions
editor/editor.php
+
1
−
2
View file @
f2520967
...
...
@@ -5,7 +5,6 @@
<section>
<h3
id=
"selected-item"
>
Nothing selected
</h3>
<ul
id=
"selected-params"
></ul>
<button
onclick=
"graph.getCleanData()"
>
Save NOT YET IMPLEMENTED
</button>
<section>
<h4>
Sources
</h4>
<ul
id=
"selected-sources"
></ul>
...
...
@@ -18,6 +17,6 @@
<section>
<h3>
Collected items
</h3>
<ul
id=
"selected-items"
></ul>
<button
onclick=
"state.clearSelectedItems()
"
>
Clear
</button>
<button
id=
"clear-collection
"
>
Clear
</button>
</section>
</div>
This diff is collapsed.
Click to expand it.
editor/js/display.js
+
25
−
8
View file @
f2520967
import
jQuery
from
"
jquery
"
;
import
{
PLUGIN_PATH
}
from
"
../../config
"
;
import
*
as
Graph
from
"
./graph
"
;
import
{
graph
}
from
"
./editor
"
;
import
{
graph
,
state
}
from
"
./editor
"
;
const
ID_TOOLBAR
=
"
#toolbar
"
;
const
ID_SELECTEDITEM
=
"
#selected-item
"
;
...
...
@@ -25,11 +25,11 @@ export default class Display {
}
setSelectedTool
(
tool
)
{
var
selectedTool
=
jQuery
(
Display
.
getToolId
(
tool
));
var
selectedTool
=
jQuery
(
Display
.
getToolId
Tag
(
tool
));
selectedTool
.
addClass
(
TOOL_SELECTED_CLASS
);
if
(
this
.
previousTool
!==
undefined
)
{
var
previousTool
=
jQuery
(
Display
.
getToolId
(
this
.
previousTool
));
var
previousTool
=
jQuery
(
Display
.
getToolId
Tag
(
this
.
previousTool
));
previousTool
.
removeClass
(
TOOL_SELECTED_CLASS
);
}
...
...
@@ -38,19 +38,25 @@ export default class Display {
renderToolbar
(
tools
)
{
this
.
fillDomList
(
ID_TOOLBAR
,
tools
,
this
.
toolRenderer
);
tools
.
forEach
((
tool
)
=>
{
this
.
toolClickEvent
(
tool
);
});
}
static
getToolId
(
tool
)
{
static
getToolId
Tag
(
tool
)
{
return
ID_TOOLBAR
+
"
-
"
+
tool
.
getKey
();
}
static
getToolId
(
tool
)
{
return
Display
.
getToolIdTag
(
tool
).
substr
(
1
);
}
toolRenderer
(
tool
)
{
return
(
'
<button id="
'
+
Display
.
getToolId
(
tool
).
substr
(
1
)
+
// Remove # from id
'
"onclick="state.setTool(TOOLS.
'
+
tool
.
getKey
()
+
'
)" title="
'
+
Display
.
getToolId
(
tool
)
+
'
" title="
'
+
tool
.
getName
()
+
'
"><img src="
'
+
TOOL_ICON_SRC
+
...
...
@@ -60,6 +66,17 @@ export default class Display {
);
}
toolClickEvent
(
tool
)
{
jQuery
(
"
button
"
+
Display
.
getToolIdTag
(
tool
)).
on
(
"
click
"
,
""
,
tool
,
(
e
)
=>
{
state
.
setTool
(
e
.
data
);
}
);
}
setSelectedItem
(
item
)
{
jQuery
(
ID_SELECTEDITEM
).
html
(
Display
.
toStr
(
item
));
...
...
This diff is collapsed.
Click to expand it.
editor/js/editor.js
+
3
−
0
View file @
f2520967
import
{
State
}
from
"
./state
"
;
import
*
as
Graph
from
"
./graph
"
;
import
ForceGraph
from
"
force-graph
"
;
import
*
as
Interactions
from
"
./interactions
"
;
export
var
state
;
...
...
@@ -16,6 +17,8 @@ window.onload = function () {
document
.
onkeydown
=
(
e
)
=>
state
.
onKeyDown
(
e
);
document
.
onkeyup
=
(
e
)
=>
state
.
onKeyUp
(
e
);
Interactions
.
initInteractions
();
fetch
(
Graph
.
JSON_CONFIG
)
.
then
((
r
)
=>
{
return
r
.
json
();
...
...
This diff is collapsed.
Click to expand it.
editor/js/interactions.js
0 → 100644
+
11
−
0
View file @
f2520967
import
jQuery
from
"
jquery
"
;
import
{
state
}
from
"
./editor
"
;
/**
* Initiates all the handlers for button presses and input changes.
*/
export
function
initInteractions
()
{
jQuery
(
"
button#clear-collection
"
).
on
(
"
click
"
,
()
=>
{
state
.
clearSelectedItems
();
});
}
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