katalyst-navigation 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/controllers/navigation/editor/menu_controller.js +2 -6
- data/app/assets/javascripts/utils/navigation/editor/item.js +37 -2
- data/app/assets/javascripts/utils/navigation/editor/rules-engine.js +1 -1
- data/app/assets/stylesheets/katalyst/navigation/editor/_index.scss +1 -1
- data/app/helpers/katalyst/navigation/editor/item.rb +0 -7
- data/app/views/katalyst/navigation/menus/_item.html.erb +1 -1
- data/lib/katalyst/navigation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e67d176cb768b324a1be109e98dc001bd9ce8419abba00d4856cd0d3c84dc6c9
|
4
|
+
data.tar.gz: 35555b9bac352c1e21786dcdddc638ccc3929e314003c7859dc3be56ad13c03e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ba4e987c87e8dfe56def8ef4d2f9214c7376cd285385008079b82b84f2ed44e354248d1d8aceaa50f2ac0cad81311935b038c5cedaff9001ab38199bea61b8a
|
7
|
+
data.tar.gz: 0ac8744ff0e111c921974d82951f4c7b09f57df32d1c93d8c5cff0474de53b5254d53bbc2129d90ca81597ae08c8166e843f0609e58bd5c6311606da0fa1f4f7
|
@@ -41,9 +41,7 @@ export default class MenuController extends Controller {
|
|
41
41
|
nest(event) {
|
42
42
|
const item = getEventItem(event);
|
43
43
|
|
44
|
-
item.
|
45
|
-
child.depth += 1;
|
46
|
-
});
|
44
|
+
item.nest();
|
47
45
|
|
48
46
|
this.#update();
|
49
47
|
event.preventDefault();
|
@@ -52,9 +50,7 @@ export default class MenuController extends Controller {
|
|
52
50
|
deNest(event) {
|
53
51
|
const item = getEventItem(event);
|
54
52
|
|
55
|
-
item.
|
56
|
-
child.depth -= 1;
|
57
|
-
});
|
53
|
+
item.deNest();
|
58
54
|
|
59
55
|
this.#update();
|
60
56
|
event.preventDefault();
|
@@ -128,6 +128,39 @@ export default class Item {
|
|
128
128
|
expanded.forEach((item) => item.traverse(callback));
|
129
129
|
}
|
130
130
|
|
131
|
+
/**
|
132
|
+
* Increase the depth of this item and its descendants.
|
133
|
+
* If this causes it to become a child of a collapsed item, then collapse this item.
|
134
|
+
*/
|
135
|
+
nest() {
|
136
|
+
this.traverse((child) => {
|
137
|
+
child.depth += 1;
|
138
|
+
});
|
139
|
+
|
140
|
+
if (this.previousItem.hasCollapsedDescendants()) {
|
141
|
+
this.previousItem.collapseChild(this);
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
/**
|
146
|
+
* Move the given item into this element's hidden children list.
|
147
|
+
* Assumes the list already exists.
|
148
|
+
*
|
149
|
+
* @param item {Item}
|
150
|
+
*/
|
151
|
+
collapseChild(item) {
|
152
|
+
this.#childrenListElement.appendChild(item.node);
|
153
|
+
}
|
154
|
+
|
155
|
+
/**
|
156
|
+
* Decrease the depth of this item (and its descendants).
|
157
|
+
*/
|
158
|
+
deNest() {
|
159
|
+
this.traverse((child) => {
|
160
|
+
child.depth -= 1;
|
161
|
+
});
|
162
|
+
}
|
163
|
+
|
131
164
|
/**
|
132
165
|
* Collapses visible (logical) children into this element's hidden children
|
133
166
|
* list, creating it if it doesn't already exist.
|
@@ -162,10 +195,12 @@ export default class Item {
|
|
162
195
|
* @param deny {boolean}
|
163
196
|
*/
|
164
197
|
toggleRule(rule, deny = false) {
|
165
|
-
if (this.node.dataset.hasOwnProperty(rule) && !deny)
|
198
|
+
if (this.node.dataset.hasOwnProperty(rule) && !deny) {
|
166
199
|
delete this.node.dataset[rule];
|
167
|
-
|
200
|
+
}
|
201
|
+
if (!this.node.dataset.hasOwnProperty(rule) && deny) {
|
168
202
|
this.node.dataset[rule] = "";
|
203
|
+
}
|
169
204
|
|
170
205
|
if (rule === "denyDrag") {
|
171
206
|
if (!this.node.hasAttribute("draggable") && !deny) {
|
@@ -143,7 +143,7 @@ export default class RulesEngine {
|
|
143
143
|
* @param {Item} item
|
144
144
|
*/
|
145
145
|
nestingCannotExceedMaxDepth(item) {
|
146
|
-
if (this.maxDepth > 0 && this.maxDepth
|
146
|
+
if (this.maxDepth > 0 && this.maxDepth <= item.depth + 1) {
|
147
147
|
this.#deny("denyNest");
|
148
148
|
}
|
149
149
|
}
|
@@ -118,7 +118,7 @@ $status-dirty-color: #aaa !default;
|
|
118
118
|
}
|
119
119
|
|
120
120
|
// Ensures vertical alignment of header with rows
|
121
|
-
[data-controller="navigation--editor
|
121
|
+
[data-controller="navigation--editor--menu"] {
|
122
122
|
[role="rowheader"] {
|
123
123
|
min-height: var(--row-height);
|
124
124
|
background: var(--table-header-color);
|
@@ -14,13 +14,6 @@ module Katalyst
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def build_all(*items)
|
18
|
-
render partial: "katalyst/navigation/menus/link_item",
|
19
|
-
layout: "katalyst/navigation/menus/navigation_menu_link",
|
20
|
-
collection: items,
|
21
|
-
as: :item
|
22
|
-
end
|
23
|
-
|
24
17
|
def accordion_actions
|
25
18
|
tag.div role: "toolbar", data: { tree_accordion_controls: "" } do
|
26
19
|
concat tag.span(role: "button", value: "collapse",
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class="tree" data-invisible="<%= !item.visible? %>">
|
3
3
|
<%= builder.accordion_actions %>
|
4
4
|
|
5
|
-
<span role="img" value="<%= item.url.present? ? "link" : "title" %>" title="
|
5
|
+
<span role="img" value="<%= item.url.present? ? "link" : "title" %>" title="Type"></span>
|
6
6
|
<h4 class="title" title="<%= item.title %>"><%= item.title %></h4>
|
7
7
|
<span role="img" value="invisible" title="Hidden"></span>
|
8
8
|
</div>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: katalyst-navigation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katalyst Interactive
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|