nfg_ui 0.9.25.1 → 0.9.26
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: 82b64730f847483e3b6c20b79bbf114b0c355b3e86f7e9b04b373d54e022473e
|
4
|
+
data.tar.gz: 9241eb15472f1e0b230919776f5c1a683256f67fbacf6cc46ffe5b3141001466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f81a58ce5fd944f2ffe55b0d9c99567af5c2d41d7853fb50b700944a064fad56e03fc05b26c2607c38dcb71ad07a109cdfddad0cbb9c6e07b66f3a4d06fb6214
|
7
|
+
data.tar.gz: 37a9c02b3fbfb25869e5d6014c0ed524f65e7498250f5c249b640448feb81c4a945310324b90c0cacf1d355d36123b982fb5db2db760bcb6aaa4e6727dcc4977
|
@@ -5,9 +5,11 @@ module NfgUi
|
|
5
5
|
module Patterns
|
6
6
|
# PageHeader doc coming soon
|
7
7
|
class PageHeader < NfgUi::Components::Base
|
8
|
-
include NfgUi::Components::Utilities::Titleable
|
9
8
|
include NfgUi::Components::Utilities::BrowserDetectable
|
9
|
+
include NfgUi::Components::Utilities::Iconable
|
10
10
|
include NfgUi::Components::Utilities::Renderable
|
11
|
+
include NfgUi::Components::Utilities::ResourceThemeable
|
12
|
+
include NfgUi::Components::Utilities::Titleable
|
11
13
|
|
12
14
|
include NfgUi::Components::Traits::PageHeader
|
13
15
|
|
@@ -24,14 +26,13 @@ module NfgUi
|
|
24
26
|
options.fetch(:subtitle, nil)
|
25
27
|
end
|
26
28
|
|
27
|
-
# TODO: These resource_theme methods are just temporary placeholders.
|
28
|
-
# They need to come from ResourceThemeable somehow.
|
29
29
|
def resource_theme_icon
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
# Prefer :icon in options over resource_theme_icon autolookup
|
31
|
+
# #icon is made available by Iconable,
|
32
|
+
# effectively allowing `icon: 'example'` to overwrite
|
33
|
+
# the auto resource_theme_icon version.
|
34
|
+
return icon if icon.present?
|
35
|
+
super
|
35
36
|
end
|
36
37
|
|
37
38
|
def render
|
@@ -52,9 +53,12 @@ module NfgUi
|
|
52
53
|
})
|
53
54
|
concat(NfgUi::Components::Elements::MediaBody.new({}, view_context).render {
|
54
55
|
content_tag(:h2) do
|
55
|
-
concat(title)
|
56
56
|
if subtitle
|
57
|
+
concat(content_tag(:span, title, class: 'mr-2'))
|
57
58
|
concat(content_tag(:small, subtitle, class: 'text-muted'))
|
59
|
+
|
60
|
+
else
|
61
|
+
concat(title)
|
58
62
|
end
|
59
63
|
end
|
60
64
|
})
|
@@ -5,11 +5,14 @@ module NfgUi
|
|
5
5
|
module Utilities
|
6
6
|
# The library of dedicated theme resources in Evo & DMS
|
7
7
|
module ResourceThemeable
|
8
|
-
#
|
9
|
-
|
8
|
+
# This method represents an existential question
|
9
|
+
# for the UX team at NFG
|
10
|
+
#
|
11
|
+
# For now, we are defaulting everything to primary
|
12
|
+
# However, the structure is in place to facilitate
|
13
|
+
# resource specific theming ala Donor Management.
|
10
14
|
def resource_theme_color(object = nil)
|
11
|
-
|
12
|
-
case resource_theme_name
|
15
|
+
case resource_theme_name(object)
|
13
16
|
when 'Project'
|
14
17
|
'primary'
|
15
18
|
when 'Campaign'
|
@@ -19,29 +22,67 @@ module NfgUi
|
|
19
22
|
end
|
20
23
|
end
|
21
24
|
|
25
|
+
def resource_theme_icon(object = nil)
|
26
|
+
case resource_theme_name(object)
|
27
|
+
when 'Newsletter'
|
28
|
+
'at'
|
29
|
+
when 'Report'
|
30
|
+
'bar-chart'
|
31
|
+
when 'Campaign', 'Project', 'Cause', 'Event'
|
32
|
+
'bullhorn'
|
33
|
+
when 'Entity'
|
34
|
+
'cog'
|
35
|
+
when 'PaymentGatewayProfile'
|
36
|
+
'credit-card'
|
37
|
+
when 'Donation', 'Order'
|
38
|
+
'dollar'
|
39
|
+
when 'CustomContent', 'SiteContent'
|
40
|
+
'file-text-o'
|
41
|
+
when 'Donor', 'Admin'
|
42
|
+
'user'
|
43
|
+
when 'Integration'
|
44
|
+
'exchange'
|
45
|
+
when 'RecurringDonation'
|
46
|
+
'refresh'
|
47
|
+
else
|
48
|
+
'heart-o'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
22
52
|
def resource_theme_name(object = nil)
|
53
|
+
# If an object is included:
|
23
54
|
if object.present?
|
24
55
|
if object.is_a?(String)
|
25
56
|
object
|
26
57
|
elsif object.is_a?(Class)
|
27
58
|
object.name
|
59
|
+
elsif object.is_a?(Symbol)
|
60
|
+
object.to_s.classify
|
28
61
|
else
|
29
62
|
object.class.name
|
30
63
|
end
|
64
|
+
|
65
|
+
# If this method was called from a view as a normal helper method,
|
66
|
+
# check for controller_name
|
67
|
+
elsif defined?(controller_name)
|
68
|
+
formatted_controller_name(controller_name)
|
69
|
+
|
70
|
+
# If this method was called from within a design system component
|
71
|
+
# then seek the defined view_context
|
72
|
+
elsif defined?(view_context)
|
73
|
+
formatted_controller_name(view_context.controller_name)
|
74
|
+
|
75
|
+
# If nothing responds, return an empty string
|
31
76
|
else
|
32
|
-
|
77
|
+
''
|
33
78
|
end
|
34
79
|
end
|
35
80
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
'bullhorn'
|
42
|
-
else
|
43
|
-
'heart-o'
|
44
|
-
end
|
81
|
+
private
|
82
|
+
|
83
|
+
# Centralizes how we format the controller name for interpretation in our cases
|
84
|
+
def formatted_controller_name(controller_name_string)
|
85
|
+
controller_name_string.split('/').last.classify
|
45
86
|
end
|
46
87
|
end
|
47
88
|
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.9.
|
4
|
+
version: 0.9.26
|
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: 2019-12-
|
12
|
+
date: 2019-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bootstrap
|