weather-icons-rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/weather-icons/_bootstrap.css.scss +87 -0
- data/app/assets/stylesheets/weather-icons/_bordered-pulled.css.scss +16 -0
- data/app/assets/stylesheets/weather-icons/_core.css.scss +13 -0
- data/app/assets/stylesheets/weather-icons/_extras.css.scss +44 -0
- data/app/assets/stylesheets/weather-icons/_fixed-width.css.scss +6 -0
- data/app/assets/stylesheets/weather-icons/_icons.css.scss +95 -0
- data/app/assets/stylesheets/weather-icons/_larger.css.scss +43 -0
- data/app/assets/stylesheets/weather-icons/_list.css.scss +19 -0
- data/app/assets/stylesheets/weather-icons/_mixins.css.scss +20 -0
- data/app/assets/stylesheets/weather-icons/_path.css.scss +13 -0
- data/app/assets/stylesheets/weather-icons/_rotated-flipped.css.scss +9 -0
- data/app/assets/stylesheets/weather-icons/_spinning.css.scss +27 -0
- data/app/assets/stylesheets/weather-icons/_stacked.css.scss +20 -0
- data/app/assets/stylesheets/weather-icons/_variables.css.scss +102 -0
- data/app/assets/stylesheets/weather-icons.css.scss +45 -0
- data/lib/weather-icons/rails/rails/engine.rb +13 -0
- data/lib/weather-icons/rails/rails/helpers.rb +94 -0
- data/lib/weather-icons/rails/rails/railtie.rb +13 -0
- data/lib/weather-icons/rails/version.rb +5 -0
- data/lib/weather-icons/rails.rb +58 -0
- data/lib/weather-icons-rails.rb +3 -4
- data/test/dummy/app/assets/stylesheets/sass-import.css.sass +1 -1
- data/test/dummy/app/assets/stylesheets/scss-import.css.scss +1 -1
- data/test/dummy/app/assets/stylesheets/sprockets-require.css +2 -2
- data/test/dummy/app/controllers/pages_controller.rb +2 -2
- data/test/dummy/app/views/pages/icons.html.erb +2 -2
- data/test/dummy/config/application.rb +18 -18
- data/test/dummy/config/boot.rb +10 -10
- data/test/dummy/config/environment.rb +5 -5
- data/test/dummy/config/initializers/secret_token.rb +8 -8
- data/test/dummy/config/routes.rb +3 -3
- data/test/dummy/config.ru +4 -4
- data/test/font_awesome_rails_test.rb +65 -65
- data/test/icon_helper_test.rb +113 -113
- data/test/test_helper.rb +7 -7
- metadata +80 -9
- data/app/assets/stylesheets/weather-icons.css +0 -327
- data/app/helpers/font_awesome/rails/icon_helper.rb +0 -92
- data/app/helpers/weather_icons/rails/icon_helper.rb +0 -92
- data/lib/weather-icons-rails/engine.rb +0 -4
- data/lib/weather-icons-rails/version.rb +0 -3
@@ -1,327 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Weather Icons Beta 1
|
3
|
-
* Weather themed icons for Bootstrap
|
4
|
-
* ------------------------------------------------------------------------------
|
5
|
-
* Maintained at http://erikflowers.github.io/weather-icons
|
6
|
-
* http://twitter.com/Erik_UX
|
7
|
-
*
|
8
|
-
* License
|
9
|
-
* ------------------------------------------------------------------------------
|
10
|
-
* - Fpmt licensed under SIL OFL 1.1 -
|
11
|
-
* http://scripts.sil.org/OFL
|
12
|
-
* - CSS and LESS are licensed under MIT License -
|
13
|
-
* http://opensource.org/licenses/mit-license.html
|
14
|
-
* - Documentation licensed under CC BY 3.0 -
|
15
|
-
* http://creativecommons.org/licenses/by/3.0/
|
16
|
-
* - Inspired by and works great as a companion with Font Aweosme
|
17
|
-
* "Font Awesome by Dave Gandy - http://fontawesome.io"
|
18
|
-
*
|
19
|
-
* Weather Icons Bootstrap Package Author - Erik Flowers - erik@helloerik.com
|
20
|
-
* Weather Icons gives full credit for inspiration to Font Awesome and makes no
|
21
|
-
* claim to invention, intellectual property, or ownership of methodology.
|
22
|
-
*
|
23
|
-
* Support Open Source!
|
24
|
-
*
|
25
|
-
* ------------------------------------------------------------------------------
|
26
|
-
* Email: erik@helloerik.com
|
27
|
-
* Twitter: http://twitter.com/Erik_UX
|
28
|
-
*/
|
29
|
-
@font-face {
|
30
|
-
font-family: 'weather';
|
31
|
-
src: url('../font/weathericons-regular-webfont.eot');
|
32
|
-
src: url('../font/weathericons-regular-webfont.eot?#iefix') format('embedded-opentype'), url('../font/weathericons-regular-webfont.woff') format('woff'), url('../font/weathericons-regular-webfont.ttf') format('truetype'), url('../font/weathericons-regular-webfont.svg#weathericons-regular-webfontRg') format('svg');
|
33
|
-
font-weight: normal;
|
34
|
-
font-style: normal;
|
35
|
-
}
|
36
|
-
[class^="wi-"],
|
37
|
-
[class*=" wi-"] {
|
38
|
-
font-family: weather;
|
39
|
-
font-weight: normal;
|
40
|
-
font-style: normal;
|
41
|
-
text-decoration: inherit;
|
42
|
-
text-transform: none;
|
43
|
-
-webkit-font-smoothing: antialiased;
|
44
|
-
*margin-right: .3em;
|
45
|
-
}
|
46
|
-
[class^="wi-"]:before,
|
47
|
-
[class*=" wi-"]:before {
|
48
|
-
text-decoration: inherit;
|
49
|
-
display: inline-block;
|
50
|
-
speak: none;
|
51
|
-
}
|
52
|
-
.wi-day-cloudy-gusts:before {
|
53
|
-
content: "\f000";
|
54
|
-
}
|
55
|
-
.wi-day-cloudy-windy:before {
|
56
|
-
content: "\f001";
|
57
|
-
}
|
58
|
-
.wi-day-cloudy:before {
|
59
|
-
content: "\f002";
|
60
|
-
}
|
61
|
-
.wi-day-fog:before {
|
62
|
-
content: "\f003";
|
63
|
-
}
|
64
|
-
.wi-day-hail:before {
|
65
|
-
content: "\f004";
|
66
|
-
}
|
67
|
-
.wi-day-lightning:before {
|
68
|
-
content: "\f005";
|
69
|
-
}
|
70
|
-
.wi-day-rain-mix:before {
|
71
|
-
content: "\f006";
|
72
|
-
}
|
73
|
-
.wi-day-rain-wind:before {
|
74
|
-
content: "\f007";
|
75
|
-
}
|
76
|
-
.wi-day-rain:before {
|
77
|
-
content: "\f008";
|
78
|
-
}
|
79
|
-
.wi-day-showers:before {
|
80
|
-
content: "\f009";
|
81
|
-
}
|
82
|
-
.wi-day-snow:before {
|
83
|
-
content: "\f00a";
|
84
|
-
}
|
85
|
-
.wi-day-sprinkle:before {
|
86
|
-
content: "\f00b";
|
87
|
-
}
|
88
|
-
.wi-day-sunny-overcast:before {
|
89
|
-
content: "\f00c";
|
90
|
-
}
|
91
|
-
.wi-day-sunny:before {
|
92
|
-
content: "\f00d";
|
93
|
-
}
|
94
|
-
.wi-day-storm-showers:before {
|
95
|
-
content: "\f00e";
|
96
|
-
}
|
97
|
-
.wi-day-thunderstorm:before {
|
98
|
-
content: "\f010";
|
99
|
-
}
|
100
|
-
.wi-cloudy-gusts:before {
|
101
|
-
content: "\f011";
|
102
|
-
}
|
103
|
-
.wi-cloudy-windy:before {
|
104
|
-
content: "\f012";
|
105
|
-
}
|
106
|
-
.wi-cloudy:before {
|
107
|
-
content: "\f013";
|
108
|
-
}
|
109
|
-
.wi-fog:before {
|
110
|
-
content: "\f014";
|
111
|
-
}
|
112
|
-
.wi-hail:before {
|
113
|
-
content: "\f015";
|
114
|
-
}
|
115
|
-
.wi-lightning:before {
|
116
|
-
content: "\f016";
|
117
|
-
}
|
118
|
-
.wi-rain-mix:before {
|
119
|
-
content: "\f017";
|
120
|
-
}
|
121
|
-
.wi-rain-wind:before {
|
122
|
-
content: "\f018";
|
123
|
-
}
|
124
|
-
.wi-rain:before {
|
125
|
-
content: "\f019";
|
126
|
-
}
|
127
|
-
.wi-showers:before {
|
128
|
-
content: "\f01a";
|
129
|
-
}
|
130
|
-
.wi-snow:before {
|
131
|
-
content: "\f01b";
|
132
|
-
}
|
133
|
-
.wi-sprinkle:before {
|
134
|
-
content: "\f01c";
|
135
|
-
}
|
136
|
-
.wi-storm-showers:before {
|
137
|
-
content: "\f01d";
|
138
|
-
}
|
139
|
-
.wi-thunderstorm:before {
|
140
|
-
content: "\f01e";
|
141
|
-
}
|
142
|
-
.wi-windy:before {
|
143
|
-
content: "\f021";
|
144
|
-
}
|
145
|
-
.wi-night-alt-cloudy-gusts:before {
|
146
|
-
content: "\f022";
|
147
|
-
}
|
148
|
-
.wi-night-alt-cloudy-windy:before {
|
149
|
-
content: "\f023";
|
150
|
-
}
|
151
|
-
.wi-night-alt-hail:before {
|
152
|
-
content: "\f024";
|
153
|
-
}
|
154
|
-
.wi-night-alt-lightning:before {
|
155
|
-
content: "\f025";
|
156
|
-
}
|
157
|
-
.wi-night-alt-rain-mix:before {
|
158
|
-
content: "\f026";
|
159
|
-
}
|
160
|
-
.wi-night-alt-rain-wind:before {
|
161
|
-
content: "\f027";
|
162
|
-
}
|
163
|
-
.wi-night-alt-rain:before {
|
164
|
-
content: "\f028";
|
165
|
-
}
|
166
|
-
.wi-night-alt-showers:before {
|
167
|
-
content: "\f029";
|
168
|
-
}
|
169
|
-
.wi-night-alt-snow:before {
|
170
|
-
content: "\f02a";
|
171
|
-
}
|
172
|
-
.wi-night-alt-sprinkle:before {
|
173
|
-
content: "\f02b";
|
174
|
-
}
|
175
|
-
.wi-night-alt-storm-showers:before {
|
176
|
-
content: "\f02c";
|
177
|
-
}
|
178
|
-
.wi-night-alt-thunderstorm:before {
|
179
|
-
content: "\f02d";
|
180
|
-
}
|
181
|
-
.wi-night-clear:before {
|
182
|
-
content: "\f02e";
|
183
|
-
}
|
184
|
-
.wi-night-cloudy-gusts:before {
|
185
|
-
content: "\f02f";
|
186
|
-
}
|
187
|
-
.wi-night-cloudy-windy:before {
|
188
|
-
content: "\f030";
|
189
|
-
}
|
190
|
-
.wi-night-cloudy:before {
|
191
|
-
content: "\f031";
|
192
|
-
}
|
193
|
-
.wi-night-hail:before {
|
194
|
-
content: "\f032";
|
195
|
-
}
|
196
|
-
.wi-night-lightning:before {
|
197
|
-
content: "\f033";
|
198
|
-
}
|
199
|
-
.wi-night-rain-mix:before {
|
200
|
-
content: "\f034";
|
201
|
-
}
|
202
|
-
.wi-night-rain-wind:before {
|
203
|
-
content: "\f035";
|
204
|
-
}
|
205
|
-
.wi-night-rain:before {
|
206
|
-
content: "\f036";
|
207
|
-
}
|
208
|
-
.wi-night-showers:before {
|
209
|
-
content: "\f037";
|
210
|
-
}
|
211
|
-
.wi-night-snow:before {
|
212
|
-
content: "\f038";
|
213
|
-
}
|
214
|
-
.wi-night-sprinkle:before {
|
215
|
-
content: "\f039";
|
216
|
-
}
|
217
|
-
.wi-night-storm-showers:before {
|
218
|
-
content: "\f03a";
|
219
|
-
}
|
220
|
-
.wi-night-thunderstorm:before {
|
221
|
-
content: "\f03b";
|
222
|
-
}
|
223
|
-
.wi-celcius:before {
|
224
|
-
content: "\f03c";
|
225
|
-
}
|
226
|
-
.wi-cloud-down:before {
|
227
|
-
content: "\f03d";
|
228
|
-
}
|
229
|
-
.wi-cloud-refresh:before {
|
230
|
-
content: "\f03e";
|
231
|
-
}
|
232
|
-
.wi-cloud-up:before {
|
233
|
-
content: "\f040";
|
234
|
-
}
|
235
|
-
.wi-cloud:before {
|
236
|
-
content: "\f041";
|
237
|
-
}
|
238
|
-
.wi-degrees:before {
|
239
|
-
content: "\f042";
|
240
|
-
}
|
241
|
-
.wi-down-left:before {
|
242
|
-
content: "\f043";
|
243
|
-
}
|
244
|
-
.wi-down:before {
|
245
|
-
content: "\f044";
|
246
|
-
}
|
247
|
-
.wi-fahrenheit:before {
|
248
|
-
content: "\f045";
|
249
|
-
}
|
250
|
-
.wi-horizon-alt:before {
|
251
|
-
content: "\f046";
|
252
|
-
}
|
253
|
-
.wi-horizon:before {
|
254
|
-
content: "\f047";
|
255
|
-
}
|
256
|
-
.wi-left:before {
|
257
|
-
content: "\f048";
|
258
|
-
}
|
259
|
-
.wi-lightning:before {
|
260
|
-
content: "\f016";
|
261
|
-
}
|
262
|
-
.wi-night-fog:before {
|
263
|
-
content: "\f04a";
|
264
|
-
}
|
265
|
-
.wi-refresh-alt:before {
|
266
|
-
content: "\f04b";
|
267
|
-
}
|
268
|
-
.wi-refresh:before {
|
269
|
-
content: "\f04c";
|
270
|
-
}
|
271
|
-
.wi-right:before {
|
272
|
-
content: "\f04d";
|
273
|
-
}
|
274
|
-
.wi-sprinkles:before {
|
275
|
-
content: "\f04e";
|
276
|
-
}
|
277
|
-
.wi-strong-wind:before {
|
278
|
-
content: "\f050";
|
279
|
-
}
|
280
|
-
.wi-sunrise:before {
|
281
|
-
content: "\f051";
|
282
|
-
}
|
283
|
-
.wi-sunset:before {
|
284
|
-
content: "\f052";
|
285
|
-
}
|
286
|
-
.wi-thermometer-exterior:before {
|
287
|
-
content: "\f053";
|
288
|
-
}
|
289
|
-
.wi-thermometer-internal:before {
|
290
|
-
content: "\f054";
|
291
|
-
}
|
292
|
-
.wi-thermometer:before {
|
293
|
-
content: "\f055";
|
294
|
-
}
|
295
|
-
.wi-tornado:before {
|
296
|
-
content: "\f056";
|
297
|
-
}
|
298
|
-
.wi-up-right:before {
|
299
|
-
content: "\f057";
|
300
|
-
}
|
301
|
-
.wi-up:before {
|
302
|
-
content: "\f058";
|
303
|
-
}
|
304
|
-
.wi-wind-east:before {
|
305
|
-
content: "\f059";
|
306
|
-
}
|
307
|
-
.wi-wind-north-east:before {
|
308
|
-
content: "\f05a";
|
309
|
-
}
|
310
|
-
.wi-wind-north-west:before {
|
311
|
-
content: "\f05b";
|
312
|
-
}
|
313
|
-
.wi-wind-north:before {
|
314
|
-
content: "\f05c";
|
315
|
-
}
|
316
|
-
.wi-wind-south-east:before {
|
317
|
-
content: "\f05d";
|
318
|
-
}
|
319
|
-
.wi-wind-south-west:before {
|
320
|
-
content: "\f05e";
|
321
|
-
}
|
322
|
-
.wi-wind-south:before {
|
323
|
-
content: "\f060";
|
324
|
-
}
|
325
|
-
.wi-wind-west:before {
|
326
|
-
content: "\f061";
|
327
|
-
}
|
@@ -1,92 +0,0 @@
|
|
1
|
-
module FontAwesome
|
2
|
-
module Rails
|
3
|
-
module IconHelper
|
4
|
-
# Creates an icon tag given an icon name and possible icon
|
5
|
-
# modifiers.
|
6
|
-
#
|
7
|
-
# Examples
|
8
|
-
#
|
9
|
-
# fa_icon "camera-retro"
|
10
|
-
# # => <i class="fa fa-camera-retro"></i>
|
11
|
-
#
|
12
|
-
# fa_icon "camera-retro", text: "Take a photo"
|
13
|
-
# # => <i class="fa fa-camera-retro"></i> Take a photo
|
14
|
-
#
|
15
|
-
# fa_icon "camera-retro 2x"
|
16
|
-
# # => <i class="fa fa-camera-retro fa-2x"></i>
|
17
|
-
# fa_icon ["camera-retro", "4x"]
|
18
|
-
# # => <i class="fa fa-camera-retro fa-4x"></i>
|
19
|
-
# fa_icon "spinner spin lg"
|
20
|
-
# # => <i class="fa fa-spinner fa-spin fa-lg">
|
21
|
-
#
|
22
|
-
# fa_icon "quote-left 4x", class: "pull-left"
|
23
|
-
# # => <i class="fa fa-quote-left fa-4x pull-left"></i>
|
24
|
-
#
|
25
|
-
# fa_icon "user", data: { id: 123 }
|
26
|
-
# # => <i class="fa fa-user" data-id="123"></i>
|
27
|
-
#
|
28
|
-
# content_tag(:li, fa_icon("check li", text: "Bulleted list item"))
|
29
|
-
# # => <li><i class="fa fa-check fa-li"></i> Bulleted list item</li>
|
30
|
-
# def fa_icon(names = "flag", options = {})
|
31
|
-
# classes = ["fa"]
|
32
|
-
# classes.concat Private.icon_names(names)
|
33
|
-
# classes.concat Array(options.delete(:class))
|
34
|
-
# text = options.delete(:text)
|
35
|
-
# icon = content_tag(:i, nil, options.merge(:class => classes))
|
36
|
-
# Private.icon_join(icon, text)
|
37
|
-
# end
|
38
|
-
|
39
|
-
# Creates an stack set of icon tags given a base icon name, a main icon
|
40
|
-
# name, and possible icon modifiers.
|
41
|
-
#
|
42
|
-
# Examples
|
43
|
-
#
|
44
|
-
# fa_stacked_icon "twitter", base: "square-o"
|
45
|
-
# # => <span class="fa-stack">
|
46
|
-
# # => <i class="fa fa-square-o fa-stack-2x"></i>
|
47
|
-
# # => <i class="fa fa-twitter fa-stack-1x"></i>
|
48
|
-
# # => </span>
|
49
|
-
#
|
50
|
-
# fa_stacked_icon "terminal inverse", base: "square", class: "pull-right", text: "Hi!"
|
51
|
-
# # => <span class="fa-stack pull-right">
|
52
|
-
# # => <i class="fa fa-square fa-stack-2x"></i>
|
53
|
-
# # => <i class="fa fa-terminal fa-inverse fa-stack-1x"></i>
|
54
|
-
# # => </span> Hi!
|
55
|
-
#
|
56
|
-
# fa_stacked_icon "camera", base: "ban-circle", reverse: true
|
57
|
-
# # => <span class="fa-stack">
|
58
|
-
# # => <i class="fa fa-camera fa-stack-1x"></i>
|
59
|
-
# # => <i class="fa fa-ban-circle fa-stack-2x"></i>
|
60
|
-
# # => </span>
|
61
|
-
# def fa_stacked_icon(names = "flag", options = {})
|
62
|
-
# classes = Private.icon_names("stack").concat(Array(options.delete(:class)))
|
63
|
-
# base_names = Private.array_value(options.delete(:base) || "square-o").push("stack-2x")
|
64
|
-
# names = Private.array_value(names).push("stack-1x")
|
65
|
-
# base = fa_icon(base_names, options.delete(:base_options) || {})
|
66
|
-
# icon = fa_icon(names, options.delete(:icon_options) || {})
|
67
|
-
# icons = [base, icon]
|
68
|
-
# icons.reverse! if options.delete(:reverse)
|
69
|
-
# text = options.delete(:text)
|
70
|
-
# stacked_icon = content_tag(:span, safe_join(icons), options.merge(:class => classes))
|
71
|
-
# Private.icon_join(stacked_icon, text)
|
72
|
-
# end
|
73
|
-
|
74
|
-
module Private
|
75
|
-
extend ActionView::Helpers::OutputSafetyHelper
|
76
|
-
|
77
|
-
def self.icon_join(icon, text)
|
78
|
-
return icon if text.blank?
|
79
|
-
safe_join([icon, ERB::Util.html_escape(text)], " ")
|
80
|
-
end
|
81
|
-
|
82
|
-
def self.icon_names(names = [])
|
83
|
-
array_value(names).map { |n| "fa-#{n}" }
|
84
|
-
end
|
85
|
-
|
86
|
-
def self.array_value(value = [])
|
87
|
-
value.is_a?(Array) ? value : value.to_s.split(/\s+/)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
module FontAwesome
|
2
|
-
module Rails
|
3
|
-
module IconHelper
|
4
|
-
# Creates an icon tag given an icon name and possible icon
|
5
|
-
# modifiers.
|
6
|
-
#
|
7
|
-
# Examples
|
8
|
-
#
|
9
|
-
# fa_icon "camera-retro"
|
10
|
-
# # => <i class="fa fa-camera-retro"></i>
|
11
|
-
#
|
12
|
-
# fa_icon "camera-retro", text: "Take a photo"
|
13
|
-
# # => <i class="fa fa-camera-retro"></i> Take a photo
|
14
|
-
#
|
15
|
-
# fa_icon "camera-retro 2x"
|
16
|
-
# # => <i class="fa fa-camera-retro fa-2x"></i>
|
17
|
-
# fa_icon ["camera-retro", "4x"]
|
18
|
-
# # => <i class="fa fa-camera-retro fa-4x"></i>
|
19
|
-
# fa_icon "spinner spin lg"
|
20
|
-
# # => <i class="fa fa-spinner fa-spin fa-lg">
|
21
|
-
#
|
22
|
-
# fa_icon "quote-left 4x", class: "pull-left"
|
23
|
-
# # => <i class="fa fa-quote-left fa-4x pull-left"></i>
|
24
|
-
#
|
25
|
-
# fa_icon "user", data: { id: 123 }
|
26
|
-
# # => <i class="fa fa-user" data-id="123"></i>
|
27
|
-
#
|
28
|
-
# content_tag(:li, fa_icon("check li", text: "Bulleted list item"))
|
29
|
-
# # => <li><i class="fa fa-check fa-li"></i> Bulleted list item</li>
|
30
|
-
def fa_icon(names = "flag", options = {})
|
31
|
-
classes = ["fa"]
|
32
|
-
classes.concat Private.icon_names(names)
|
33
|
-
classes.concat Array(options.delete(:class))
|
34
|
-
text = options.delete(:text)
|
35
|
-
icon = content_tag(:i, nil, options.merge(:class => classes))
|
36
|
-
Private.icon_join(icon, text)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Creates an stack set of icon tags given a base icon name, a main icon
|
40
|
-
# name, and possible icon modifiers.
|
41
|
-
#
|
42
|
-
# Examples
|
43
|
-
#
|
44
|
-
# fa_stacked_icon "twitter", base: "square-o"
|
45
|
-
# # => <span class="fa-stack">
|
46
|
-
# # => <i class="fa fa-square-o fa-stack-2x"></i>
|
47
|
-
# # => <i class="fa fa-twitter fa-stack-1x"></i>
|
48
|
-
# # => </span>
|
49
|
-
#
|
50
|
-
# fa_stacked_icon "terminal inverse", base: "square", class: "pull-right", text: "Hi!"
|
51
|
-
# # => <span class="fa-stack pull-right">
|
52
|
-
# # => <i class="fa fa-square fa-stack-2x"></i>
|
53
|
-
# # => <i class="fa fa-terminal fa-inverse fa-stack-1x"></i>
|
54
|
-
# # => </span> Hi!
|
55
|
-
#
|
56
|
-
# fa_stacked_icon "camera", base: "ban-circle", reverse: true
|
57
|
-
# # => <span class="fa-stack">
|
58
|
-
# # => <i class="fa fa-camera fa-stack-1x"></i>
|
59
|
-
# # => <i class="fa fa-ban-circle fa-stack-2x"></i>
|
60
|
-
# # => </span>
|
61
|
-
def fa_stacked_icon(names = "flag", options = {})
|
62
|
-
classes = Private.icon_names("stack").concat(Array(options.delete(:class)))
|
63
|
-
base_names = Private.array_value(options.delete(:base) || "square-o").push("stack-2x")
|
64
|
-
names = Private.array_value(names).push("stack-1x")
|
65
|
-
base = fa_icon(base_names, options.delete(:base_options) || {})
|
66
|
-
icon = fa_icon(names, options.delete(:icon_options) || {})
|
67
|
-
icons = [base, icon]
|
68
|
-
icons.reverse! if options.delete(:reverse)
|
69
|
-
text = options.delete(:text)
|
70
|
-
stacked_icon = content_tag(:span, safe_join(icons), options.merge(:class => classes))
|
71
|
-
Private.icon_join(stacked_icon, text)
|
72
|
-
end
|
73
|
-
|
74
|
-
module Private
|
75
|
-
extend ActionView::Helpers::OutputSafetyHelper
|
76
|
-
|
77
|
-
def self.icon_join(icon, text)
|
78
|
-
return icon if text.blank?
|
79
|
-
safe_join([icon, ERB::Util.html_escape(text)], " ")
|
80
|
-
end
|
81
|
-
|
82
|
-
def self.icon_names(names = [])
|
83
|
-
array_value(names).map { |n| "fa-#{n}" }
|
84
|
-
end
|
85
|
-
|
86
|
-
def self.array_value(value = [])
|
87
|
-
value.is_a?(Array) ? value : value.to_s.split(/\s+/)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|