font_awesome5_rails 0.3.1 → 0.3.2
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/README.md +3 -0
- data/app/assets/fonts/fa-brands-400.eot +0 -0
- data/app/assets/fonts/fa-brands-400.svg +9 -3
- data/app/assets/fonts/fa-brands-400.ttf +0 -0
- data/app/assets/fonts/fa-brands-400.woff +0 -0
- data/app/assets/fonts/fa-brands-400.woff2 +0 -0
- data/app/assets/fonts/fa-regular-400.eot +0 -0
- data/app/assets/fonts/fa-regular-400.svg +1 -1
- data/app/assets/fonts/fa-regular-400.ttf +0 -0
- data/app/assets/fonts/fa-regular-400.woff +0 -0
- data/app/assets/fonts/fa-regular-400.woff2 +0 -0
- data/app/assets/fonts/fa-solid-900.eot +0 -0
- data/app/assets/fonts/fa-solid-900.svg +2 -2
- data/app/assets/fonts/fa-solid-900.ttf +0 -0
- data/app/assets/fonts/fa-solid-900.woff +0 -0
- data/app/assets/fonts/fa-solid-900.woff2 +0 -0
- data/app/assets/images/fa5/brands/java.svg +1 -0
- data/app/assets/images/fa5/brands/pied-piper-hat.svg +1 -0
- data/app/assets/images/fa5/brands/pied-piper.svg +1 -1
- data/app/assets/images/fa5/brands/readme.svg +1 -1
- data/app/assets/images/fa5/solid/dna.svg +1 -1
- data/app/assets/javascripts/fontawesome-all.min.js +2 -2
- data/app/assets/stylesheets/fa-svg-with-js.css +1 -1
- data/app/assets/stylesheets/fontawesome-all-old.css.scss +2855 -0
- data/app/assets/stylesheets/fontawesome-all.css.scss +23 -17
- data/app/helpers/font_awesome5/rails/icon_helper.rb +6 -6
- data/lib/font_awesome5_rails/parsers/fa_icon_parser.rb +2 -1
- data/lib/font_awesome5_rails/parsers/fa_layered_icon_parser.rb +2 -1
- data/lib/font_awesome5_rails/parsers/fa_stacked_icon_parser.rb +2 -1
- data/lib/font_awesome5_rails/parsers/parse_methods.rb +14 -0
- data/lib/font_awesome5_rails/version.rb +2 -2
- data/spec/font_awesome5_rails_spec.rb +29 -0
- metadata +5 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Font Awesome Free 5.0.
|
2
|
+
* Font Awesome Free 5.0.10 by @fontawesome - https://fontawesome.com
|
3
3
|
* License - https://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
4
4
|
*/
|
5
5
|
.fa,
|
@@ -64,8 +64,8 @@
|
|
64
64
|
list-style-type: none;
|
65
65
|
margin-left: 2.5em;
|
66
66
|
padding-left: 0; }
|
67
|
-
.fa-ul > li {
|
68
|
-
|
67
|
+
.fa-ul > li {
|
68
|
+
position: relative; }
|
69
69
|
|
70
70
|
.fa-li {
|
71
71
|
left: -2em;
|
@@ -101,57 +101,57 @@
|
|
101
101
|
|
102
102
|
.fa-spin {
|
103
103
|
-webkit-animation: fa-spin 2s infinite linear;
|
104
|
-
|
104
|
+
animation: fa-spin 2s infinite linear; }
|
105
105
|
|
106
106
|
.fa-pulse {
|
107
107
|
-webkit-animation: fa-spin 1s infinite steps(8);
|
108
|
-
|
108
|
+
animation: fa-spin 1s infinite steps(8); }
|
109
109
|
|
110
110
|
@-webkit-keyframes fa-spin {
|
111
111
|
0% {
|
112
112
|
-webkit-transform: rotate(0deg);
|
113
|
-
|
113
|
+
transform: rotate(0deg); }
|
114
114
|
100% {
|
115
115
|
-webkit-transform: rotate(360deg);
|
116
|
-
|
116
|
+
transform: rotate(360deg); } }
|
117
117
|
|
118
118
|
@keyframes fa-spin {
|
119
119
|
0% {
|
120
120
|
-webkit-transform: rotate(0deg);
|
121
|
-
|
121
|
+
transform: rotate(0deg); }
|
122
122
|
100% {
|
123
123
|
-webkit-transform: rotate(360deg);
|
124
|
-
|
124
|
+
transform: rotate(360deg); } }
|
125
125
|
|
126
126
|
.fa-rotate-90 {
|
127
127
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";
|
128
128
|
-webkit-transform: rotate(90deg);
|
129
|
-
|
129
|
+
transform: rotate(90deg); }
|
130
130
|
|
131
131
|
.fa-rotate-180 {
|
132
132
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";
|
133
133
|
-webkit-transform: rotate(180deg);
|
134
|
-
|
134
|
+
transform: rotate(180deg); }
|
135
135
|
|
136
136
|
.fa-rotate-270 {
|
137
137
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";
|
138
138
|
-webkit-transform: rotate(270deg);
|
139
|
-
|
139
|
+
transform: rotate(270deg); }
|
140
140
|
|
141
141
|
.fa-flip-horizontal {
|
142
142
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";
|
143
143
|
-webkit-transform: scale(-1, 1);
|
144
|
-
|
144
|
+
transform: scale(-1, 1); }
|
145
145
|
|
146
146
|
.fa-flip-vertical {
|
147
147
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
|
148
148
|
-webkit-transform: scale(1, -1);
|
149
|
-
|
149
|
+
transform: scale(1, -1); }
|
150
150
|
|
151
151
|
.fa-flip-horizontal.fa-flip-vertical {
|
152
152
|
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";
|
153
153
|
-webkit-transform: scale(-1, -1);
|
154
|
-
|
154
|
+
transform: scale(-1, -1); }
|
155
155
|
|
156
156
|
:root .fa-rotate-90,
|
157
157
|
:root .fa-rotate-180,
|
@@ -159,7 +159,7 @@
|
|
159
159
|
:root .fa-flip-horizontal,
|
160
160
|
:root .fa-flip-vertical {
|
161
161
|
-webkit-filter: none;
|
162
|
-
|
162
|
+
filter: none; }
|
163
163
|
|
164
164
|
.fa-stack {
|
165
165
|
display: inline-block;
|
@@ -1492,6 +1492,9 @@ readers do not read off random characters that represent icons */
|
|
1492
1492
|
.fa-itunes-note:before {
|
1493
1493
|
content: "\f3b5"; }
|
1494
1494
|
|
1495
|
+
.fa-java:before {
|
1496
|
+
content: "\f4e4"; }
|
1497
|
+
|
1495
1498
|
.fa-jenkins:before {
|
1496
1499
|
content: "\f3b6"; }
|
1497
1500
|
|
@@ -1900,6 +1903,9 @@ readers do not read off random characters that represent icons */
|
|
1900
1903
|
.fa-pied-piper-alt:before {
|
1901
1904
|
content: "\f1a8"; }
|
1902
1905
|
|
1906
|
+
.fa-pied-piper-hat:before {
|
1907
|
+
content: "\f4e5"; }
|
1908
|
+
|
1903
1909
|
.fa-pied-piper-pp:before {
|
1904
1910
|
content: "\f1a7"; }
|
1905
1911
|
|
@@ -2852,4 +2858,4 @@ readers do not read off random characters that represent icons */
|
|
2852
2858
|
.fa,
|
2853
2859
|
.fas {
|
2854
2860
|
font-family: 'Font Awesome 5 Free';
|
2855
|
-
font-weight: 900; }
|
2861
|
+
font-weight: 900; }
|
@@ -9,10 +9,10 @@ module FontAwesome5
|
|
9
9
|
def fa_icon(icon, options = {})
|
10
10
|
parser = FaIconParser.new(icon, options)
|
11
11
|
if parser.text.nil?
|
12
|
-
content_tag(:i, nil, class: parser.classes, style: parser.style, data: parser.data)
|
12
|
+
content_tag(:i, nil, class: parser.classes, style: parser.style, title: parser.title, data: parser.data)
|
13
13
|
else
|
14
|
-
content_tag(:i, nil, class: parser.classes, style: parser.style, data: parser.data) +
|
15
|
-
content_tag(:span, parser.text, class: "fa5-text #{parser.sizes}", style: parser.style)
|
14
|
+
content_tag(:i, nil, class: parser.classes, style: parser.style, title: parser.title, data: parser.data) +
|
15
|
+
content_tag(:span, parser.text, class: "fa5-text#{' ' unless parser.sizes.blank?}#{parser.sizes}", style: parser.style)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -20,7 +20,7 @@ module FontAwesome5
|
|
20
20
|
def fa_stacked_icon(icon, options = {})
|
21
21
|
parser = FaStackedIconParser.new(icon, options)
|
22
22
|
|
23
|
-
tags = content_tag :span, class: parser.span_classes do
|
23
|
+
tags = content_tag :span, class: parser.span_classes, title: parser.title do
|
24
24
|
content_tag(:i, nil, class: (parser.reverse ? parser.second_icon_classes : parser.first_icon_classes) ) +
|
25
25
|
content_tag(:i, nil, class: (parser.reverse ? parser.first_icon_classes : parser.second_icon_classes) )
|
26
26
|
end
|
@@ -31,10 +31,10 @@ module FontAwesome5
|
|
31
31
|
def fa_layered_icon(options = {}, &block)
|
32
32
|
parser = FaLayeredIconParser.new(options)
|
33
33
|
if parser.size.nil?
|
34
|
-
content_tag(:span, class: parser.classes, style: parser.style, &block)
|
34
|
+
content_tag(:span, class: parser.classes, title: parser.title, style: parser.style, &block)
|
35
35
|
else
|
36
36
|
content_tag :div, class: "fa-#{parser.size}" do
|
37
|
-
content_tag(:span, class: parser.classes, style: parser.style, &block)
|
37
|
+
content_tag(:span, class: parser.classes, title: parser.title, style: parser.style, &block)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -3,7 +3,7 @@ require_relative 'parse_methods'
|
|
3
3
|
class FaIconParser
|
4
4
|
include ParseMethods
|
5
5
|
|
6
|
-
attr_reader :icon, :options, :data, :style, :text
|
6
|
+
attr_reader :icon, :options, :data, :style, :text, :title
|
7
7
|
|
8
8
|
def initialize(icon, options)
|
9
9
|
@icon = icon
|
@@ -11,6 +11,7 @@ class FaIconParser
|
|
11
11
|
@data = options[:data]
|
12
12
|
@style = options[:style]
|
13
13
|
@text = options[:text]
|
14
|
+
@title = options[:title]
|
14
15
|
end
|
15
16
|
|
16
17
|
def classes
|
@@ -3,13 +3,14 @@ require_relative "parse_methods"
|
|
3
3
|
class FaLayeredIconParser
|
4
4
|
include ParseMethods
|
5
5
|
|
6
|
-
attr_reader :aligned, :style, :size
|
6
|
+
attr_reader :aligned, :style, :size, :title
|
7
7
|
|
8
8
|
|
9
9
|
def initialize(options)
|
10
10
|
@aligned = options[:aligned].nil? ? true : options[:aligned]
|
11
11
|
@style = options[:style]
|
12
12
|
@size = options[:size]
|
13
|
+
@title = options[:title]
|
13
14
|
@options = options
|
14
15
|
end
|
15
16
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative "parse_methods"
|
2
2
|
|
3
3
|
class FaStackedIconParser
|
4
|
-
attr_reader :reverse, :options, :span_classes, :first_icon_classes, :second_icon_classes, :text
|
4
|
+
attr_reader :reverse, :options, :span_classes, :first_icon_classes, :second_icon_classes, :text, :title
|
5
5
|
|
6
6
|
include ParseMethods
|
7
7
|
|
@@ -9,6 +9,7 @@ class FaStackedIconParser
|
|
9
9
|
@icon = icon
|
10
10
|
@text = options[:text]
|
11
11
|
@reverse = options[:reverse].nil? ? false : options[:reverse]
|
12
|
+
@title = options[:title]
|
12
13
|
@options = options
|
13
14
|
end
|
14
15
|
|
@@ -19,6 +19,20 @@ module ParseMethods
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def arr_with_fa(array)
|
22
|
+
array = handle_input(array)
|
22
23
|
array.split(" ").map{ |s| prepend_fa(s) }
|
23
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def handle_input(input)
|
29
|
+
case input
|
30
|
+
when Symbol
|
31
|
+
input.to_s.gsub('_', '-')
|
32
|
+
when Array
|
33
|
+
input.collect{ |i| i.to_s.gsub('_', '-') }.join(' ')
|
34
|
+
else
|
35
|
+
input.to_s
|
36
|
+
end
|
37
|
+
end
|
24
38
|
end
|
@@ -79,6 +79,18 @@ describe FontAwesome5Rails do
|
|
79
79
|
expect(fa_icon 'camera-retro', text: 'Camera', style: 'color: Tomato;').to have_tag('span', text: 'Camera', with: {style: 'color: Tomato;'})
|
80
80
|
expect(fa_icon 'camera-retro', text: 'Camera', size: '3x').to have_tag('span', text: 'Camera', with: {class: 'fa5-text fa-3x'})
|
81
81
|
end
|
82
|
+
|
83
|
+
it 'should return correct tags with symbols' do
|
84
|
+
expect(fa_icon :facebook, type: :brand).to eq '<i class="fab fa-facebook"></i>'
|
85
|
+
expect(fa_icon :camera_retro).to eq '<i class="fas fa-camera-retro"></i>'
|
86
|
+
expect(fa_icon [:camera_retro, :circle]).to eq '<i class="fas fa-camera-retro fa-circle"></i>'
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'should return correct title tags' do
|
90
|
+
expect(fa_icon 'camera-retro', title: 'camera-title').to eq '<i class="fas fa-camera-retro" title="camera-title"></i>'
|
91
|
+
expect(fa_icon 'camera-retro', text: 'Camera', title: 'camera-title').to eq '<i class="fas fa-camera-retro" title="camera-title"></i><span class="fa5-text">Camera</span>'
|
92
|
+
|
93
|
+
end
|
82
94
|
end
|
83
95
|
|
84
96
|
describe 'fa_stacked_icon tags' do
|
@@ -107,6 +119,18 @@ describe FontAwesome5Rails do
|
|
107
119
|
expect(fa_stacked_icon 'camera', base: 'circle', type: :far, base_type: :fas, reverse: true)
|
108
120
|
.to eq '<span class="fa-stack"><i class="far fa-camera fa-stack-1x"></i><i class="fas fa-circle fa-stack-2x"></i></span>'
|
109
121
|
end
|
122
|
+
|
123
|
+
it 'should return correct tags with symbols' do
|
124
|
+
expect(fa_stacked_icon [:camera, :inverse], base: :circle)
|
125
|
+
.to eq '<span class="fa-stack"><i class="fas fa-circle fa-stack-2x"></i><i class="fas fa-camera fa-inverse fa-stack-1x"></i></span>'
|
126
|
+
expect(fa_stacked_icon :camera, base: :circle, type: :far, reverse: false)
|
127
|
+
.to eq '<span class="fa-stack"><i class="far fa-circle fa-stack-2x"></i><i class="far fa-camera fa-stack-1x"></i></span>'
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'should return correct tags with title' do
|
131
|
+
expect(fa_stacked_icon [:camera, :inverse], base: :circle, title: 'Camera')
|
132
|
+
.to eq '<span class="fa-stack" title="Camera"><i class="fas fa-circle fa-stack-2x"></i><i class="fas fa-camera fa-inverse fa-stack-1x"></i></span>'
|
133
|
+
end
|
110
134
|
end
|
111
135
|
|
112
136
|
describe 'fa_layered_icon tags' do
|
@@ -129,6 +153,11 @@ describe FontAwesome5Rails do
|
|
129
153
|
end
|
130
154
|
).to eq '<span class="fa-layers fa-fw"><i class="fas fa-circle"></i><i class="fas fa-times"></i></span>'
|
131
155
|
end
|
156
|
+
|
157
|
+
it 'should return correct tags with title' do
|
158
|
+
expect(fa_layered_icon(style: 'background: MistyRose', title: 'LayeredIcon'){ fa_icon 'circle' })
|
159
|
+
.to eq '<span class="fa-layers fa-fw" title="LayeredIcon" style="background: MistyRose"><i class="fas fa-circle"></i></span>'
|
160
|
+
end
|
132
161
|
end
|
133
162
|
|
134
163
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: font_awesome5_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tomkra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -240,6 +240,7 @@ files:
|
|
240
240
|
- app/assets/images/fa5/brands/ioxhost.svg
|
241
241
|
- app/assets/images/fa5/brands/itunes-note.svg
|
242
242
|
- app/assets/images/fa5/brands/itunes.svg
|
243
|
+
- app/assets/images/fa5/brands/java.svg
|
243
244
|
- app/assets/images/fa5/brands/jenkins.svg
|
244
245
|
- app/assets/images/fa5/brands/joget.svg
|
245
246
|
- app/assets/images/fa5/brands/joomla.svg
|
@@ -298,6 +299,7 @@ files:
|
|
298
299
|
- app/assets/images/fa5/brands/phoenix-framework.svg
|
299
300
|
- app/assets/images/fa5/brands/php.svg
|
300
301
|
- app/assets/images/fa5/brands/pied-piper-alt.svg
|
302
|
+
- app/assets/images/fa5/brands/pied-piper-hat.svg
|
301
303
|
- app/assets/images/fa5/brands/pied-piper-pp.svg
|
302
304
|
- app/assets/images/fa5/brands/pied-piper.svg
|
303
305
|
- app/assets/images/fa5/brands/pinterest-p.svg
|
@@ -1077,6 +1079,7 @@ files:
|
|
1077
1079
|
- app/assets/stylesheets/fa-svg-with-js.css
|
1078
1080
|
- app/assets/stylesheets/font_awesome5.css
|
1079
1081
|
- app/assets/stylesheets/font_awesome5_webfont.css
|
1082
|
+
- app/assets/stylesheets/fontawesome-all-old.css.scss
|
1080
1083
|
- app/assets/stylesheets/fontawesome-all.css.scss
|
1081
1084
|
- app/helpers/font_awesome5/rails/icon_helper.rb
|
1082
1085
|
- bin/test
|