nfg_ui 0.12.4 → 0.12.8

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: 40569cc7dc02fb3dc270f37b4b90e4b2eb094630a00538be57354e09bedb9258
4
- data.tar.gz: 5be6e2cb820eac1a40da4df26e1ec9518aab7580073664e9ee6daaf07145aa41
3
+ metadata.gz: 2d8f2c14ba5696d088d27de7ad8caea2b9d1307713b2f7d9cbf26e969b50d51b
4
+ data.tar.gz: ea3347bb493d9cfce24e218e517d883ee307efbcbdd0f0935534f2717f2e9daa
5
5
  SHA512:
6
- metadata.gz: 2645cc8d2743636e1fc02511a21a5df83d067d0e42131562c4779c15580fe1b05acb66569901a75106f84be6ba0e61d52009f85a92ddfeef6dc7c725088353b9
7
- data.tar.gz: c084418fa8b0fede0aaa8015b2f211bae1952837b14e3e3872e41a967099568d72b8f3f0b9c683873aeba689097a29fc14c7fedda2ce31a66b2ebbdfc83df180
6
+ metadata.gz: a10d17d6bca35afc7a14020b3b077f23d917dbd7665a2f80195e6bed495db3b15d808f2a7d9cc46f10fc4fb928515212df0bf2fc494fd99bfd50f1371edd7840
7
+ data.tar.gz: 5c2b9c627aad987b32169d0ab1d92b8c5011e1b087fd1120c8bd5ba45a5c4291b478f695730f31298d3ebe550667604187240e6273a9c95e89f8679a973eb7ab
data/README.md CHANGED
@@ -18,6 +18,9 @@ This gem is an organic, evolving and ongoing work that is the loving result of 4
18
18
  With this gem, you can stand up a brand new rails app and it will seamlessly, from day 1, look, feel and be a Network for Good product. *Huzzah*
19
19
 
20
20
  ## Accessing Component Code Examples & Documentation:
21
+
22
+ Visit [NFG UI Display App](https://nfg-ui-display-app.herokuapp.com/) for examples.
23
+
21
24
  To review the documentation for the components, get code samples and browse the library, follow the instructions at the bottom for getting the gem setup locally. It has its own `test_app` so the documentation is hosted there and the gem doesn't need to be added to a seperate parent app (unless you want to). We intend to get this online in its own dedicated space... until then, that's your best bet for browsing docs.
22
25
 
23
26
  ## Configuration
@@ -11,6 +11,7 @@ module NfgUi
11
11
  include NfgUi::Components::Utilities::Traitable
12
12
  include NfgUi::Components::Utilities::Describable
13
13
  include NfgUi::Components::Utilities::Iconable
14
+ include NfgUi::Components::Utilities::Methodable
14
15
  include NfgUi::Components::Utilities::Renderable
15
16
 
16
17
  include NfgUi::Components::Traits::Active
@@ -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.4'
4
+ VERSION = '0.12.8'
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.4
4
+ version: 0.12.8
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-08 00:00:00.000000000 Z
12
+ date: 2021-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bootstrap
@@ -149,14 +149,14 @@ dependencies:
149
149
  requirements:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: 1.10.4
152
+ version: 1.11.4
153
153
  type: :runtime
154
154
  prerelease: false
155
155
  version_requirements: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: 1.10.4
159
+ version: 1.11.4
160
160
  - !ruby/object:Gem::Dependency
161
161
  name: browser
162
162
  requirement: !ruby/object:Gem::Requirement