nfg_ui 0.11.8 → 0.11.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nfg_ui/components/elements/slat_item.rb +32 -8
- data/lib/nfg_ui/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: feeec19c011b520fc542365a94ae4c0def08850b8f3bb394376ea44cff7ef174
|
4
|
+
data.tar.gz: a7b77844b75d25c800c05707a4d21db8814a4cdcc82244f5eebce03a815f3908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07e73749f7feab579f0a8e9cc617850ce53f4311be7d7c08e7f30a6e9d32be4a5cf44d3797c71b69d78c018d41a400d77d9e36d32bb557810c2e6b69c1ae4c80
|
7
|
+
data.tar.gz: 8d8783f40d9454d708dd3923d66fad396f35d2fa7f5f3460bcc42e7c69c3cb55eadc90e6cc66ab0b10019225544bd32181bc45508f7cfc2e03ca54fac018085f
|
@@ -11,6 +11,10 @@ module NfgUi
|
|
11
11
|
include NfgUi::Components::Traits::Size
|
12
12
|
include NfgUi::Components::Traits::SlatItem
|
13
13
|
|
14
|
+
def caption
|
15
|
+
options.fetch(:caption, nil)
|
16
|
+
end
|
17
|
+
|
14
18
|
def component_family
|
15
19
|
:slats
|
16
20
|
end
|
@@ -19,36 +23,56 @@ module NfgUi
|
|
19
23
|
options.fetch(:slat_header, nil)
|
20
24
|
end
|
21
25
|
|
22
|
-
|
23
|
-
|
26
|
+
# Leverage custom tooltip implementation
|
27
|
+
# so that tooltips are connected to slat item text
|
28
|
+
# and not the slat item containing div (resulting in better UI)
|
29
|
+
def tooltip
|
30
|
+
options.fetch(:tooltip, nil)
|
24
31
|
end
|
25
32
|
|
26
33
|
def render
|
27
34
|
content_tag(base_element, slat_item_html_options) do
|
28
35
|
if slat_header
|
29
|
-
concat(content_tag(:h6, slat_header, class: 'display-4 slat-column-header'))
|
36
|
+
concat(content_tag(:h6, slat_header, class: 'display-4 slat-column-header', **tooltip_html_options))
|
30
37
|
end
|
31
38
|
if heading
|
32
39
|
if href
|
33
40
|
concat(content_tag(:a, href: view_context.url_for(href)) {
|
34
|
-
NfgUi::Components::Foundations::Typeface.new({ subheading: heading }, view_context).render
|
41
|
+
NfgUi::Components::Foundations::Typeface.new({ subheading: heading, tooltip: tooltip }, view_context).render
|
35
42
|
})
|
36
43
|
else
|
37
|
-
concat(NfgUi::Components::Foundations::Typeface.new({ subheading: heading }, view_context).render)
|
44
|
+
concat(NfgUi::Components::Foundations::Typeface.new({ subheading: heading, tooltip: tooltip }, view_context).render)
|
38
45
|
end
|
39
46
|
end
|
40
47
|
concat(block_given? ? yield : body)
|
41
48
|
if caption
|
42
|
-
concat(NfgUi::Components::Foundations::Typeface.new({ caption: caption, class: 'mb-0' }, view_context).render)
|
49
|
+
concat(NfgUi::Components::Foundations::Typeface.new({ caption: caption, class: 'mb-0', tooltip: (tooltip unless heading) }, view_context).render)
|
43
50
|
end
|
44
51
|
end
|
45
52
|
end
|
46
53
|
|
47
54
|
private
|
48
55
|
|
56
|
+
def tooltip_html_options
|
57
|
+
return {} unless tooltip
|
58
|
+
{ title: tooltip, data: options[:data].merge(tooltip_data_attributes) }
|
59
|
+
end
|
60
|
+
|
61
|
+
def tooltip_data_attributes
|
62
|
+
{ toggle: 'tooltip',
|
63
|
+
placement: :top,
|
64
|
+
html: 'true' }
|
65
|
+
end
|
66
|
+
|
49
67
|
# Strip the href from html_options and pass it to the header
|
50
68
|
def slat_item_html_options
|
51
|
-
html_options.except(:href)
|
69
|
+
options = html_options.except(:href)
|
70
|
+
|
71
|
+
# merge in tooltip only if leveraging block body content
|
72
|
+
# tooltip_html_options will return {} if no tooltip so this is a safe merge
|
73
|
+
options.merge!(tooltip_html_options) unless (heading || caption || slat_header)
|
74
|
+
|
75
|
+
options
|
52
76
|
end
|
53
77
|
|
54
78
|
# :sm is the default size, and is not given
|
@@ -59,7 +83,7 @@ module NfgUi
|
|
59
83
|
end
|
60
84
|
|
61
85
|
def non_html_attribute_options
|
62
|
-
super.push(:slat_header, :caption)
|
86
|
+
super.push(:slat_header, :caption, :tooltip)
|
63
87
|
end
|
64
88
|
end
|
65
89
|
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: 0.11.
|
4
|
+
version: 0.11.9
|
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: 2020-12-
|
12
|
+
date: 2020-12-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bootstrap
|