nfg_ui 0.12.6 → 0.12.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bbafc30ea4243b1b4053b0ea9556031985f5d9f13a0800542a45d8a92c6a854
4
- data.tar.gz: ea57532fe3f800a39722870962424ae6c11868d333c39292703c4df18266f8b0
3
+ metadata.gz: a35bf8e810bef7ab9c4ac1dca95a6ca9e236b5f4606ef6c63614fa941fd510c8
4
+ data.tar.gz: 1d007a905113a5bbb89a4dd3fc486639d72b0be1a4c466f07b7f3a70cbb1e37e
5
5
  SHA512:
6
- metadata.gz: b9642aa6a7d9b14a2523bd3ced6b4a8cfa2cb905fd614f3484ba748447fec2e1f96c3dbdffe42f0baf4e9f042b45ce49cdd455b6bba56c32cbda13383465aefd
7
- data.tar.gz: 65e30453eb0709ca978786c273751ad6116e823f1f5eae35439b0b832ce26f117afd010081baaf9ba8800dd0ca5d1c37e5be7736b508bad1556a854a5f17a80d
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 collapsible && title
20
- concat(NfgUi::Components::Elements::Button.new({ traits: [:link, :block], collapse: collapse, class: 'no-link-color p-0 m-0', data: { collapse_icon: collapse_icon, collapsed_icon: collapsed_icon } }, view_context).render {
21
- content_tag(:div, class: 'row align-items-center') do
22
- concat(content_tag(:div, class: 'col-10 text-left') {
23
- NfgUi::Components::Foundations::Typeface.new({ heading: title, icon: icon, class: 'h4' }, view_context).render
24
- })
25
- concat(content_tag(:div, class: 'col-2 text-right') {
26
- NfgUi::Components::Foundations::Icon.new({ traits: ["#{contextual_collapsible_icon} fw"], tooltip: 'Show / hide additional information' }, view_context).render
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NfgUi
4
- VERSION = '0.12.6'
4
+ VERSION = '0.12.7'
5
5
  end
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.6
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-13 00:00:00.000000000 Z
12
+ date: 2021-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bootstrap