fa_rails 0.1.31 → 0.1.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/fa_rails.gemspec +2 -2
- data/lib/fa/base.rb +4 -3
- data/lib/fa/link.rb +1 -1
- data/spec/lib/fa_spec.rb +26 -26
- 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: ca2a329b85fbd1dd2b3081cb3b4e76476569dd548628a36ad7c427d50f1fa871
|
4
|
+
data.tar.gz: dd9b54e4d2a055acd7dc07bb225f6289cff98c5b4f4ef17974dde8195dc85797
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4875fd4c4530391ad87130c509ff92e6e03e331a7f8e2c60d84a1e2117eef8b463fe0e3e5041ed952bea556bce6be1e97a910c6130d0d38b3dc8a93890446d6b
|
7
|
+
data.tar.gz: 0c800e60013097d6c0a89c68bd0f6122dbd938ea50e62803039e3f505d2006fb2eefe4b5c7774f809f99e45134cd6ab5820f0728c96d740dd7117b0960e26ac0
|
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.33'
|
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)
|
data/lib/fa/link.rb
CHANGED
data/spec/lib/fa_spec.rb
CHANGED
@@ -16,7 +16,7 @@ RSpec.describe FA do
|
|
16
16
|
it 'generates the correct kit link tag' do
|
17
17
|
tag = FA::Link.kit('abcdefg')
|
18
18
|
expect(tag).to eql(
|
19
|
-
"<script src=\"https://kit.fontawesome.com/abcdefg.js\"></script>"
|
19
|
+
"<script src=\"https://kit.fontawesome.com/abcdefg.js\" async></script>"
|
20
20
|
)
|
21
21
|
end
|
22
22
|
|
@@ -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='fasr fa-house fa-1x' style='' data-fa-transform='' title=''></i>"
|
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='fasl fa-house fa-1x' style='' data-fa-transform='' title=''></i>"
|
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.33
|
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
|