fa_rails 0.1.15 → 0.1.16
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 +22 -10
- data/fa_rails.gemspec +2 -2
- data/lib/fa/base.rb +5 -6
- data/lib/fa/build.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7b6338945f6103c543294c5092f971aefadbaf5
|
4
|
+
data.tar.gz: 47431b632c78c64e3a43bde2a0e9eef9da9306ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01426ce80e975e5974b4031705d4c8fedae1c589c4ecfba3d8bc5e87b496e51d19ac1f649da5afda774d439c10325f17f3cc4b2ec8fa2c822d65efa20e5229fe
|
7
|
+
data.tar.gz: 85e33837b2a86ffaa71c54322807e080c327d3b1e8985d10ec12f69eacaf2b79c5b8c5414563dde574683147436d1389be0250bd94bf838bb528489c6f53e098
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ A quick helper for using FontAwesome icons in Rails.
|
|
7
7
|
**This gem is just the code for using FontAwesome in your Rails applications.**
|
8
8
|
|
9
9
|
You must still have your own FontAwesome Pro license, or install the
|
10
|
-
[Free](https://use.fontawesome.com/releases/v5.
|
10
|
+
[Free](https://use.fontawesome.com/releases/v5.3.1/fontawesome-free-5.3.1-web.zip)
|
11
11
|
package.
|
12
12
|
|
13
13
|
Add the following to `config/application.rb`:
|
@@ -31,22 +31,22 @@ page and copy the appropriate CDN link tag.
|
|
31
31
|
You can also `include FA`, then use the built-in helper method in your layout:
|
32
32
|
|
33
33
|
```ruby
|
34
|
-
FA::Link.new(version: 'v5.
|
34
|
+
FA::Link.new(version: 'v5.3.1', integrity: 'sha384-some-key-here').safe
|
35
35
|
```
|
36
36
|
|
37
37
|
#### Free
|
38
38
|
|
39
39
|
```html
|
40
|
-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.
|
40
|
+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-some-key-here" crossorigin="anonymous">
|
41
41
|
```
|
42
42
|
|
43
43
|
#### Pro
|
44
44
|
|
45
45
|
```html
|
46
|
-
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.
|
46
|
+
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-some-key-here" crossorigin="anonymous">
|
47
47
|
```
|
48
48
|
|
49
|
-
**Be sure to also
|
49
|
+
**Be sure to also register each domain that will use this CDN link.**
|
50
50
|
|
51
51
|
## Usage
|
52
52
|
|
@@ -60,7 +60,7 @@ configuration for the object.
|
|
60
60
|
|
61
61
|
`Layer` is used to combine multiple units into a single end object. It takes
|
62
62
|
advantage of the Hash input style on `Icon` and `Span` to allow it to accept a
|
63
|
-
single configuration
|
63
|
+
single configuration Array for the entire stack.
|
64
64
|
|
65
65
|
All three classes respond to two output methods: `raw` and `safe`.
|
66
66
|
|
@@ -70,6 +70,8 @@ All three classes respond to two output methods: `raw` and `safe`.
|
|
70
70
|
For convenience, each class also has a `p` method, which will create a new
|
71
71
|
instance, and return its `safe` output.
|
72
72
|
|
73
|
+
There is also a `Build` class that exposes a DSL to construct a `Layer`.
|
74
|
+
|
73
75
|
### Icon
|
74
76
|
|
75
77
|
A single FontAwesome icon.
|
@@ -128,7 +130,7 @@ A stack of layered FontAwesome icons and spans.
|
|
128
130
|
icons #=> Array of Hashes of individual icon/span configurations
|
129
131
|
title #=> String – tooltip text
|
130
132
|
grow #=> Integer – additional global scaling factor added to all objects in the stack
|
131
|
-
css
|
133
|
+
css #=> String – arbitrary CSS classes, space-delimited, applied to the layer stack
|
132
134
|
```
|
133
135
|
|
134
136
|
### Examples
|
@@ -156,9 +158,19 @@ FA::Layer.p([{ name: 'envelope', options: { css: :blue } }, { name: 'counter', t
|
|
156
158
|
# "<span class='fa-stack-1x red fa-layers-counter fa-layers-top-left' data-fa-transform='grow-0'>7</span>" \
|
157
159
|
# "</span>"
|
158
160
|
|
159
|
-
# The same stack, but using FA::Build
|
161
|
+
# The same stack, but using the FA::Build DSL (with various syntaxes).
|
162
|
+
FA::Build.p do
|
163
|
+
icon('envelope', css: 'blue')
|
164
|
+
span('counter', 7, css: 'red', position: :tl)
|
165
|
+
end
|
166
|
+
|
160
167
|
FA::Build.p do |b|
|
161
|
-
b.icon('
|
162
|
-
b.span('counter', 7)
|
168
|
+
b.icon('envelope', css: 'blue')
|
169
|
+
b.span('counter', 7, css: 'red', position: :tl)
|
163
170
|
end
|
171
|
+
|
172
|
+
FA::Build.new do |b|
|
173
|
+
b.icon('envelope', css: 'blue')
|
174
|
+
b.span('counter', 7, css: 'red', position: :tl)
|
175
|
+
end.safe
|
164
176
|
```
|
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 = '2018-
|
3
|
+
s.version = '0.1.16'
|
4
|
+
s.date = '2018-10-11'
|
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
@@ -23,14 +23,13 @@ module FA
|
|
23
23
|
|
24
24
|
def parse_all(icons)
|
25
25
|
icons.map do |icon|
|
26
|
-
name = icon[:name]
|
27
26
|
options = fa_options(icon[:options])
|
28
27
|
options[:fa] += " stack-#{options[:size]}x"
|
29
28
|
|
30
|
-
if %i[counter text].include?(name.to_sym)
|
31
|
-
parse_span(name, icon[:text], options)
|
29
|
+
if %i[counter text].include?(icon[:name].to_sym)
|
30
|
+
parse_span(icon[:name], icon[:text], options)
|
32
31
|
else
|
33
|
-
parse_icon(name, options)
|
32
|
+
parse_icon(icon[:name], options)
|
34
33
|
end
|
35
34
|
end
|
36
35
|
end
|
@@ -38,14 +37,14 @@ module FA
|
|
38
37
|
def parse_icon(name, options = {})
|
39
38
|
options = fa_options(options)
|
40
39
|
parse_options(options)
|
41
|
-
title = options[:title]
|
42
40
|
|
43
41
|
@classes << "fa-#{name}"
|
44
42
|
@classes << "fa-#{options[:size]}x"
|
45
43
|
css = @classes.flatten.join(' ')
|
46
44
|
transforms = @transforms.join(' ')
|
47
45
|
|
48
|
-
"<i class='#{css}' data-fa-transform='#{transforms}'
|
46
|
+
"<i class='#{css}' data-fa-transform='#{transforms}' " \
|
47
|
+
"title='#{options[:title]}'></i>"
|
49
48
|
end
|
50
49
|
|
51
50
|
def parse_span(type, text, options = {})
|
data/lib/fa/build.rb
CHANGED
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.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Fiander
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|