katalyst-navigation 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/katalyst/navigation/frontend/builder.rb +2 -2
- data/app/models/katalyst/navigation/button.rb +11 -0
- data/app/models/katalyst/navigation/item.rb +21 -1
- data/db/migrate/20220826034507_create_katalyst_navigation_items.rb +1 -0
- 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: 0430e1c7846b906e84d20fd7c0302b9a602a0a4427a925b12590983ec07a15c2
|
4
|
+
data.tar.gz: 85387acf67b2842d791daf9f7272b067cca28991913e36541eb7c6ef6b9aedf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '034680c7620436686cf44504c3b22fd93a23301678c86a61fd2741719bdc8b16a561bb09d44b61256c33c41ee09a9418df071b1274615a38ab5a337f54049310'
|
7
|
+
data.tar.gz: db8060ce2d4bc572340af555630db50a3dc117f64c5f74b8faa85d9b674a2ec16c6f9ecede44eb16722059358ccdd6ef9d5a2d5fde1a5dede83ce5c21ade9d8d
|
@@ -46,11 +46,11 @@ module Katalyst
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def render_link(link)
|
49
|
-
link_to(link.title, link.url)
|
49
|
+
link_to(link.title, link.url, link.item_options)
|
50
50
|
end
|
51
51
|
|
52
52
|
def render_button(link)
|
53
|
-
link_to(link.title, link.url,
|
53
|
+
link_to(link.title, link.url, link.item_options)
|
54
54
|
end
|
55
55
|
|
56
56
|
private
|
@@ -14,6 +14,17 @@ module Katalyst
|
|
14
14
|
def self.permitted_params
|
15
15
|
super + %i[http_method]
|
16
16
|
end
|
17
|
+
|
18
|
+
def options_for_target
|
19
|
+
options = super
|
20
|
+
|
21
|
+
if target == "_blank" || target == "_top" || target == "self"
|
22
|
+
options.deep_merge!({ data: { method: http_method } })
|
23
|
+
else
|
24
|
+
options.deep_merge!({ data: { turbo_method: http_method } })
|
25
|
+
end
|
26
|
+
options
|
27
|
+
end
|
17
28
|
end
|
18
29
|
end
|
19
30
|
end
|
@@ -10,12 +10,16 @@ module Katalyst
|
|
10
10
|
|
11
11
|
attr_accessor :parent, :children, :index, :depth
|
12
12
|
|
13
|
+
TARGETS = %i[self _top _blank kpop].index_by(&:itself).freeze
|
14
|
+
|
15
|
+
enum method: TARGETS, _prefix: :target
|
16
|
+
|
13
17
|
def self.permitted_params
|
14
18
|
%i[
|
15
19
|
title
|
16
20
|
url
|
17
21
|
visible
|
18
|
-
|
22
|
+
target
|
19
23
|
type
|
20
24
|
]
|
21
25
|
end
|
@@ -24,6 +28,22 @@ module Katalyst
|
|
24
28
|
is_a? Layout
|
25
29
|
end
|
26
30
|
|
31
|
+
# Entrypoint for combining additional options based on attribute rules
|
32
|
+
def item_options
|
33
|
+
options_for_target
|
34
|
+
end
|
35
|
+
|
36
|
+
def options_for_target
|
37
|
+
return {} if target == "self"
|
38
|
+
|
39
|
+
options = { target: target }
|
40
|
+
|
41
|
+
unless target == "_blank" || target == "_top"
|
42
|
+
options = { data: { turbo: true, turbo_frame: target } }
|
43
|
+
end
|
44
|
+
options
|
45
|
+
end
|
46
|
+
|
27
47
|
private
|
28
48
|
|
29
49
|
def initialize_tree
|
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.3.
|
4
|
+
version: 1.3.3
|
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-11-
|
11
|
+
date: 2022-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|