fa_rails 0.1.30 → 0.1.32
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/Gemfile.lock +1 -1
- data/fa_rails.gemspec +2 -2
- data/lib/fa/base.rb +6 -5
- data/spec/lib/fa_spec.rb +25 -25
- 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: 82cc0408ffb769b073374d9993346efc041cee42538448ec69ad6875a769e952
|
4
|
+
data.tar.gz: 321bf680aab68c84c24b3f3ea9403ec701f4369f09f24c5da629177c57d677f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e222ee63e3d6fabf9c5c708cfb3ae42bcfe832544e56b85101566b536eb4464b5abcaa4431cf38f0dbebda7ed8dd54afdae19b2354caa9441314b774828a538
|
7
|
+
data.tar.gz: ba9a40a7674fb468d65b0e6b86e87aa80d0c2e21085b5679421032cc319a3b814a55d2d990f441717d351e2b594ca1fd5a7ba2e02317f32bf5652968fc29185f
|
data/Gemfile.lock
CHANGED
data/fa_rails.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'fa_rails'
|
3
|
-
s.version = '0.1.
|
4
|
-
s.date = '2023-
|
3
|
+
s.version = '0.1.32'
|
4
|
+
s.date = '2023-07-21'
|
5
5
|
s.summary = 'FontAwesome helper for Rails'
|
6
6
|
s.description = 'A helper module for using FontAwesome icons in Rails.'
|
7
7
|
s.homepage = 'http://rubygems.org/gems/fa_rails'
|
data/lib/fa/base.rb
CHANGED
@@ -54,8 +54,8 @@ module FA
|
|
54
54
|
css = @classes.flatten.join(' ').sub(/\A\s+/, '')
|
55
55
|
transforms = @transforms.join(' ')
|
56
56
|
|
57
|
-
"<i class='#{css}'
|
58
|
-
"title='#{options[:title]}'></i>"
|
57
|
+
"<i class='#{css}' id='#{options[:id]}' style='#{@styles}' " \
|
58
|
+
"data-fa-transform='#{transforms}' title='#{options[:title]}'></i>"
|
59
59
|
end
|
60
60
|
|
61
61
|
def parse_span(type, text, options = {})
|
@@ -70,7 +70,8 @@ module FA
|
|
70
70
|
css = @classes.flatten.reject { |c| c.to_s.match?(/^fa.$/) }.join(' ')
|
71
71
|
transforms = @transforms.join(' ')
|
72
72
|
|
73
|
-
"<span class='#{css}'
|
73
|
+
"<span class='#{css}' id='#{options[:id]}' style='#{@styles}' " \
|
74
|
+
"data-fa-transform='#{transforms}'>#{text}</span>"
|
74
75
|
end
|
75
76
|
|
76
77
|
def fa_options(options)
|
@@ -146,13 +147,13 @@ module FA
|
|
146
147
|
end
|
147
148
|
|
148
149
|
def parse_style(options)
|
149
|
-
if options[:css].to_s =~ /\bfa[#{
|
150
|
+
if options[:css].to_s =~ /\bfa[#{MODES.values.uniq.join}]?[#{STYLES.values.uniq.join}]\b/
|
150
151
|
return # Don't overwrite a manual style [& mode] class
|
151
152
|
end
|
152
153
|
|
153
154
|
style = 'fa'
|
154
|
-
style += STYLES[options[:style]]
|
155
155
|
style += MODES[options[:mode]]
|
156
|
+
style += STYLES[options[:style]]
|
156
157
|
end
|
157
158
|
end
|
158
159
|
end
|
data/spec/lib/fa_spec.rb
CHANGED
@@ -30,50 +30,50 @@ RSpec.describe FA do
|
|
30
30
|
describe 'icon' do
|
31
31
|
it 'generates the correct icon from a string name' do
|
32
32
|
expect(FA::Icon.p('help')).to eql(
|
33
|
-
"<i class='fas fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
|
33
|
+
"<i class='fas fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
34
34
|
)
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'generates the correct icon from a symbol name' do
|
38
38
|
expect(FA::Icon.p(:help)).to eql(
|
39
|
-
"<i class='fas fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
|
39
|
+
"<i class='fas fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
40
40
|
)
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'generates the correct icon from a configuration hash' do
|
44
44
|
fa = { name: 'help', options: { style: :light, size: 2 } }
|
45
45
|
expect(FA::Icon.p(fa)).to eql(
|
46
|
-
"<i class='fal fa-help fa-2x' style='' data-fa-transform='' title=''></i>"
|
46
|
+
"<i class='fal fa-help fa-2x' id='' style='' data-fa-transform='' title=''></i>"
|
47
47
|
)
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'handles a string fa option' do
|
51
51
|
expect(FA::Icon.p(:help, fa: 'fw 2x')).to eql(
|
52
|
-
"<i class='fas fa-fw fa-2x fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
|
52
|
+
"<i class='fas fa-fw fa-2x fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
53
53
|
)
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'handles an array fa option' do
|
57
57
|
expect(FA::Icon.p(:help, fa: %i[fw 2x])).to eql(
|
58
|
-
"<i class='fas fa-fw fa-2x fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
|
58
|
+
"<i class='fas fa-fw fa-2x fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
59
59
|
)
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'handles a string css option' do
|
63
63
|
expect(FA::Icon.p(:help, css: 'green big')).to eql(
|
64
|
-
"<i class='fas green big fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
|
64
|
+
"<i class='fas green big fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
65
65
|
)
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'handles an array css option' do
|
69
69
|
expect(FA::Icon.p(:help, css: %i[green big])).to eql(
|
70
|
-
"<i class='fas green big fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
|
70
|
+
"<i class='fas green big fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
71
71
|
)
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'handles a nil css option' do
|
75
75
|
expect(FA::Icon.p(:help, css: nil)).to eql(
|
76
|
-
"<i class='fas fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
|
76
|
+
"<i class='fas fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
77
77
|
)
|
78
78
|
end
|
79
79
|
|
@@ -87,31 +87,31 @@ RSpec.describe FA do
|
|
87
87
|
|
88
88
|
it 'generates the correct icon with a manual style class' do
|
89
89
|
expect(FA::Icon.p(:help, style: :solid, css: 'fad')).to eql(
|
90
|
-
"<i class='fad fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
|
90
|
+
"<i class='fad fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
91
91
|
)
|
92
92
|
end
|
93
93
|
|
94
94
|
it 'generates the correct brand icon' do
|
95
95
|
expect(FA::Icon.p(:github, style: :brands)).to eql(
|
96
|
-
"<i class='fab fa-github fa-1x' style='' data-fa-transform='' title=''></i>"
|
96
|
+
"<i class='fab fa-github fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
97
97
|
)
|
98
98
|
end
|
99
99
|
|
100
100
|
it 'generates the correct sharp icon' do
|
101
101
|
expect(FA::Icon.p(:house, mode: :sharp)).to eql(
|
102
|
-
"<i class='fass fa-house fa-1x' style='' data-fa-transform='' title=''></i>"
|
102
|
+
"<i class='fass fa-house fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
103
103
|
)
|
104
104
|
end
|
105
105
|
|
106
106
|
it 'generates the correct sharp regular icon' do
|
107
107
|
expect(FA::Icon.p(:house, style: :regular, mode: :sharp)).to eql(
|
108
|
-
"<i class='
|
108
|
+
"<i class='fasr fa-house fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
109
109
|
)
|
110
110
|
end
|
111
111
|
|
112
112
|
it 'generates the correct sharp light icon' do
|
113
113
|
expect(FA::Icon.p(:house, style: :light, mode: :sharp)).to eql(
|
114
|
-
"<i class='
|
114
|
+
"<i class='fasl fa-house fa-1x' id='' style='' data-fa-transform='' title=''></i>"
|
115
115
|
)
|
116
116
|
end
|
117
117
|
|
@@ -123,7 +123,7 @@ RSpec.describe FA do
|
|
123
123
|
}
|
124
124
|
)
|
125
125
|
).to eql(
|
126
|
-
"<i class='fad fa-fire-alt fa-1x' style='--fa-primary-opacity: 0.6; --fa-secondary-opacity: 0.4; " \
|
126
|
+
"<i class='fad fa-fire-alt fa-1x' id='' style='--fa-primary-opacity: 0.6; --fa-secondary-opacity: 0.4; " \
|
127
127
|
"--fa-primary-color: green; --fa-secondary-color: #DD2200;' data-fa-transform='' title=''></i>"
|
128
128
|
)
|
129
129
|
end
|
@@ -139,9 +139,9 @@ RSpec.describe FA do
|
|
139
139
|
|
140
140
|
expect(FA::Layer.p(icons, grow: 2)).to eql(
|
141
141
|
"<span class='icon fa-layers fa-stack fa-fw ' title=''>" \
|
142
|
-
"<i class='fas fa-stack-1x fa-square fa-1x' style='' data-fa-transform='grow-2' title=''></i>" \
|
143
|
-
"<i class='fas fa-stack-1x fa-circle fa-1x' style='' data-fa-transform='grow-3' title=''></i>" \
|
144
|
-
"<i class='far fa-stack-1x fa-exclamation fa-1x' style='' data-fa-transform='grow-2' title=''></i>" \
|
142
|
+
"<i class='fas fa-stack-1x fa-square fa-1x' id='' style='' data-fa-transform='grow-2' title=''></i>" \
|
143
|
+
"<i class='fas fa-stack-1x fa-circle fa-1x' id='' style='' data-fa-transform='grow-3' title=''></i>" \
|
144
|
+
"<i class='far fa-stack-1x fa-exclamation fa-1x' id='' style='' data-fa-transform='grow-2' title=''></i>" \
|
145
145
|
'</span>'
|
146
146
|
)
|
147
147
|
end
|
@@ -154,8 +154,8 @@ RSpec.describe FA do
|
|
154
154
|
|
155
155
|
expect(FA::Layer.p(icons)).to eql(
|
156
156
|
"<span class='icon fa-layers fa-stack fa-fw ' title=''>" \
|
157
|
-
"<i class='fas fa-stack-1x fa-square fa-1x' style='' data-fa-transform='grow-0' title=''></i>" \
|
158
|
-
"<span class='fa-stack-1x fa-layers-counter fa-layers-top-left' style='' data-fa-transform='grow-0'>17</span>" \
|
157
|
+
"<i class='fas fa-stack-1x fa-square fa-1x' id='' style='' data-fa-transform='grow-0' title=''></i>" \
|
158
|
+
"<span class='fa-stack-1x fa-layers-counter fa-layers-top-left' id='' style='' data-fa-transform='grow-0'>17</span>" \
|
159
159
|
'</span>'
|
160
160
|
)
|
161
161
|
end
|
@@ -168,8 +168,8 @@ RSpec.describe FA do
|
|
168
168
|
|
169
169
|
expect(FA::Layer.p(icons, title: 'right')).to eql(
|
170
170
|
"<span class='icon fa-layers fa-stack fa-fw ' title='right'>" \
|
171
|
-
"<i class='fas fa-stack-1x fa-square fa-1x' style='' data-fa-transform='grow-0' title='right'></i>" \
|
172
|
-
"<i class='fas fa-stack-1x fa-exclamation fa-1x' style='' data-fa-transform='grow-0' title='right'></i>" \
|
171
|
+
"<i class='fas fa-stack-1x fa-square fa-1x' id='' style='' data-fa-transform='grow-0' title='right'></i>" \
|
172
|
+
"<i class='fas fa-stack-1x fa-exclamation fa-1x' id='' style='' data-fa-transform='grow-0' title='right'></i>" \
|
173
173
|
'</span>'
|
174
174
|
)
|
175
175
|
end
|
@@ -184,8 +184,8 @@ RSpec.describe FA do
|
|
184
184
|
|
185
185
|
expect(layer).to eql(
|
186
186
|
"<span class='icon fa-layers fa-stack fa-fw ' title=''>" \
|
187
|
-
"<i class='fas fa-stack-1x fa-circle fa-1x' style='' data-fa-transform='grow-0' title=''></i>" \
|
188
|
-
"<span class='fa-stack-1x fa-layers-counter ' style='' data-fa-transform='grow-0'>7</span>" \
|
187
|
+
"<i class='fas fa-stack-1x fa-circle fa-1x' id='' style='' data-fa-transform='grow-0' title=''></i>" \
|
188
|
+
"<span class='fa-stack-1x fa-layers-counter ' id='' style='' data-fa-transform='grow-0'>7</span>" \
|
189
189
|
'</span>'
|
190
190
|
)
|
191
191
|
end
|
@@ -194,7 +194,7 @@ RSpec.describe FA do
|
|
194
194
|
describe 'span' do
|
195
195
|
it 'generates the correct span from a string or symbol type' do
|
196
196
|
expect(FA::Span.p(:text, 'Hello')).to eql(
|
197
|
-
"<span class='fa-layers-text ' style='' data-fa-transform=''>Hello</span>"
|
197
|
+
"<span class='fa-layers-text ' id='' style='' data-fa-transform=''>Hello</span>"
|
198
198
|
)
|
199
199
|
end
|
200
200
|
|
@@ -202,7 +202,7 @@ RSpec.describe FA do
|
|
202
202
|
span = { type: :text, text: 'World', options: { position: :bl } }
|
203
203
|
expect(FA::Span.p(span)).to eql(
|
204
204
|
"<span class='fa-layers-text fa-layers-bottom-left' " \
|
205
|
-
"style='' data-fa-transform=''>World</span>"
|
205
|
+
"id='' style='' data-fa-transform=''>World</span>"
|
206
206
|
)
|
207
207
|
end
|
208
208
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fa_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Fiander
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|