nfg_ui 0.15.1 → 5.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc2e41b096acf0984f462d1c7b2058dbf4f7c14d183ced10061b70cad2c263fb
|
4
|
+
data.tar.gz: 044aba97d396b80d60ab7dde7b6ed598f5f70c1c4c46366ac2db3a1ed9e27b81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 172b725c9ee35587851e1883b2f06c349c8cf6c438db6afe2c5b450dbd434f1bf3de610e6f64fd18e737c286beb0abe775f7a4522cc5259f4d15486c0035a93d
|
7
|
+
data.tar.gz: a687c3edd6dd070bf6e4d511050019d4c302ab334e40da37d20c58cd9c6bdc3333cabd7991145491247ab81a28a90b036d88d19537f88def6e2bd2c920137d53
|
@@ -10,7 +10,16 @@ module NfgUi
|
|
10
10
|
include Bootstrap::Utilities::Activatable
|
11
11
|
include Bootstrap::Utilities::Disableable
|
12
12
|
include Bootstrap::Utilities::Tooltipable
|
13
|
-
|
13
|
+
|
14
|
+
# We do not want to overwrite button_to's interpretation
|
15
|
+
# of `remote`. Conditionally include Remotable
|
16
|
+
# when not using as: :button_to
|
17
|
+
def initialize(*)
|
18
|
+
super
|
19
|
+
if as != :button_to
|
20
|
+
extend Bootstrap::Utilities::Remotable
|
21
|
+
end
|
22
|
+
end
|
14
23
|
|
15
24
|
def component_family
|
16
25
|
:dropdown
|
@@ -12,7 +12,6 @@ module NfgUi
|
|
12
12
|
include NfgUi::Components::Utilities::Describable
|
13
13
|
include NfgUi::Components::Utilities::DisableWithable
|
14
14
|
include NfgUi::Components::Utilities::Iconable
|
15
|
-
include NfgUi::Components::Utilities::Methodable
|
16
15
|
include NfgUi::Components::Utilities::Renderable
|
17
16
|
include NfgUi::Components::Utilities::Traitable
|
18
17
|
|
@@ -22,24 +21,34 @@ module NfgUi
|
|
22
21
|
include NfgUi::Components::Traits::Disable
|
23
22
|
include NfgUi::Components::Traits::Theme
|
24
23
|
|
24
|
+
# We do not want to overwrite button_to's interpretation
|
25
|
+
# of `method`. Conditionally include Methodable
|
26
|
+
# when not using as: :button_to
|
27
|
+
def initialize(*)
|
28
|
+
super
|
29
|
+
if as != :button_to
|
30
|
+
extend NfgUi::Components::Utilities::Methodable
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
25
34
|
def render
|
26
35
|
if tooltip && disabled
|
27
36
|
content_tag(:span, disabled_component_tooltip_wrapper_html_options) do
|
28
37
|
content_tag(as, html_options.except(:href)) do
|
29
|
-
|
30
|
-
NfgUi::Components::Foundations::Icon.new({ traits: ["#{icon} fw"], text: (block_given? ? yield : body), class: 'text-center' }, view_context).render
|
31
|
-
else
|
32
|
-
(block_given? ? yield : body)
|
33
|
-
end
|
38
|
+
yield_icon_or_body
|
34
39
|
end
|
35
40
|
end
|
41
|
+
elsif as == :button_to
|
42
|
+
# Manually pass in url_for args for routing
|
43
|
+
# example: = ui.nfg :dropdown_item, as: :button_to, button_url: some_action_path(@object)
|
44
|
+
url_for_option = options.delete(:button_url)
|
45
|
+
|
46
|
+
view_context.button_to(url_for_option, html_options) do
|
47
|
+
yield_icon_or_body
|
48
|
+
end
|
36
49
|
else
|
37
50
|
super do
|
38
|
-
|
39
|
-
NfgUi::Components::Foundations::Icon.new({ traits: ["#{icon} fw"], text: (block_given? ? yield : body), class: 'text-center' }, view_context).render
|
40
|
-
else
|
41
|
-
(block_given? ? yield : body)
|
42
|
-
end
|
51
|
+
yield_icon_or_body
|
43
52
|
end
|
44
53
|
end
|
45
54
|
end
|
@@ -52,6 +61,14 @@ module NfgUi
|
|
52
61
|
|
53
62
|
private
|
54
63
|
|
64
|
+
def yield_icon_or_body
|
65
|
+
if icon
|
66
|
+
NfgUi::Components::Foundations::Icon.new({ traits: ["#{icon} fw"], text: (block_given? ? yield : body), class: 'text-center' }, view_context).render
|
67
|
+
else
|
68
|
+
(block_given? ? yield : body)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
55
72
|
def base_element
|
56
73
|
as
|
57
74
|
end
|
data/lib/nfg_ui/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nfg_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Roehm
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-11-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bootstrap
|