nfg_ui 0.12.6 → 0.12.7
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 +4 -4
- data/lib/nfg_ui/components/patterns/tile.rb +14 -2
- data/lib/nfg_ui/components/patterns/tile_header.rb +51 -13
- 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: a35bf8e810bef7ab9c4ac1dca95a6ca9e236b5f4606ef6c63614fa941fd510c8
|
4
|
+
data.tar.gz: 1d007a905113a5bbb89a4dd3fc486639d72b0be1a4c466f07b7f3a70cbb1e37e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7a91b7232e34eb6f7a2b68eb1d7c279858d1e62b4a95ac811f3c45922690790eefa993fb5a0c82f9d2be4dc496aea796b0cac99946b1bc5def7764502bb52d0
|
7
|
+
data.tar.gz: d4e2fc74dcd4244490bc2455a4f30b1a9fd04e73d91373865b87e3ae431563614e2841f83491979a999e5be0d0f668c3e1b47b02454bb210b4d560d1c357c864
|
@@ -16,6 +16,14 @@ module NfgUi
|
|
16
16
|
options.fetch(:heading, nil)
|
17
17
|
end
|
18
18
|
|
19
|
+
def button
|
20
|
+
options.fetch(:button, nil)
|
21
|
+
end
|
22
|
+
|
23
|
+
def href
|
24
|
+
options.fetch(:href, nil)
|
25
|
+
end
|
26
|
+
|
19
27
|
def component_family
|
20
28
|
:tile
|
21
29
|
end
|
@@ -28,7 +36,7 @@ module NfgUi
|
|
28
36
|
super do
|
29
37
|
if render_in_body
|
30
38
|
if title.present?
|
31
|
-
concat(NfgUi::Components::Patterns::TileHeader.new({ title: title, icon: icon, collapsible: collapsible, collapse: ("#collapse_#{id}" if collapsible) }, view_context).render)
|
39
|
+
concat(NfgUi::Components::Patterns::TileHeader.new({ title: title, subtitle: subtitle, button: button, href: href, icon: icon, collapsible: collapsible, collapsed: collapsed, collapse: ("#collapse_#{id}" if collapsible) }, view_context).render)
|
32
40
|
end
|
33
41
|
if collapsible
|
34
42
|
concat(NfgUi::Components::Patterns::Collapse.new({ id: "collapse_#{id}", collapsed: collapsed }, view_context).render {
|
@@ -47,10 +55,14 @@ module NfgUi
|
|
47
55
|
end
|
48
56
|
end
|
49
57
|
|
58
|
+
def subtitle
|
59
|
+
options.fetch(:subtitle, nil)
|
60
|
+
end
|
61
|
+
|
50
62
|
private
|
51
63
|
|
52
64
|
def non_html_attribute_options
|
53
|
-
super.push(:heading, :render_in_body)
|
65
|
+
super.push(:heading, :render_in_body, :subtitle, :button, :href)
|
54
66
|
end
|
55
67
|
end
|
56
68
|
end
|
@@ -14,23 +14,57 @@ module NfgUi
|
|
14
14
|
:tile
|
15
15
|
end
|
16
16
|
|
17
|
+
def button
|
18
|
+
options.fetch(:button, nil)
|
19
|
+
end
|
20
|
+
|
21
|
+
def href
|
22
|
+
options.fetch(:href, nil)
|
23
|
+
end
|
24
|
+
|
25
|
+
def subtitle
|
26
|
+
options.fetch(:subtitle, nil)
|
27
|
+
end
|
28
|
+
|
17
29
|
def render
|
18
30
|
super do
|
19
|
-
if
|
20
|
-
concat(
|
21
|
-
content_tag(:div, class:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
31
|
+
if title
|
32
|
+
concat(content_tag(:div, class: 'row') do
|
33
|
+
concat(content_tag(:div, class: "col") do
|
34
|
+
content_tag(:div, class: 'row') do
|
35
|
+
concat(content_tag(:div, class: 'col-12 col-md') do
|
36
|
+
concat(NfgUi::Components::Foundations::Typeface.new({ heading: title, icon: icon, class: 'h4' }, view_context).render)
|
37
|
+
if subtitle
|
38
|
+
concat(NfgUi::Components::Foundations::Typeface.new({ body: subtitle, traits: [:muted], class: 'mt-1 mb-0' }, view_context).render)
|
39
|
+
end
|
40
|
+
end)
|
41
|
+
|
42
|
+
if button
|
43
|
+
concat(content_tag(:div, class: 'col-12 col-md-auto mt-md-0 mt-2') do
|
44
|
+
NfgUi::Components::Elements::Button.new({theme: :secondary, href: href, body: button}, view_context).render
|
45
|
+
|
46
|
+
end)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end)
|
50
|
+
|
51
|
+
if collapsible
|
52
|
+
concat(content_tag(:div, class: 'col-auto pl-0') do
|
53
|
+
NfgUi::Components::Elements::Button.new({ traits: [:link], collapse: collapse, data: { collapse_icon: collapse_icon, collapsed_icon: collapsed_icon } }, view_context).render do
|
54
|
+
|
55
|
+
# The button cannot host a data-toggle for tooltip
|
56
|
+
# and a data-toggle for collapse
|
57
|
+
|
58
|
+
# In order to accomodate the tooltip, we have to
|
59
|
+
# render the icon manually without using the button's
|
60
|
+
# options so that we're applying the tooltip on the
|
61
|
+
# icon and not the button.
|
62
|
+
NfgUi::Components::Foundations::Icon.new({ traits: ["#{contextual_collapsible_icon} fw"], tooltip: 'Show / hide additional information' }, view_context).render
|
63
|
+
end
|
64
|
+
end)
|
28
65
|
end
|
29
|
-
|
30
|
-
elsif title
|
31
|
-
concat(NfgUi::Components::Foundations::Typeface.new({ heading: title, icon: icon, class: 'h4' }, view_context).render)
|
66
|
+
end)
|
32
67
|
end
|
33
|
-
|
34
68
|
concat((block_given? ? yield : body))
|
35
69
|
end
|
36
70
|
end
|
@@ -49,6 +83,10 @@ module NfgUi
|
|
49
83
|
def collapsed_icon
|
50
84
|
'caret-down'
|
51
85
|
end
|
86
|
+
|
87
|
+
def non_html_attribute_options
|
88
|
+
super.push(:subtitle, :button, :href)
|
89
|
+
end
|
52
90
|
end
|
53
91
|
end
|
54
92
|
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.12.
|
4
|
+
version: 0.12.7
|
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: 2021-07-
|
12
|
+
date: 2021-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bootstrap
|