less-rails-fontawesome 0.7.0 → 0.8.0
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 +33 -6
- data/lib/less/rails/fontawesome/link_helper.rb +8 -8
- data/lib/less/rails/fontawesome/version.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: 6e86e2144ab8adeb729202969549f25cea38d2b5
|
4
|
+
data.tar.gz: 1f16f022e0865436ad6aef22e3f0ece351287ca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88eecb3426ca5ad4956938d1ce4a5096fa963964d322e0ee2e0e18656348387abd6af3524b4042ba309a01c0300ea46c10cac095ff5b0a87b1ade755c2b201cf
|
7
|
+
data.tar.gz: ae651660d0d11c6dc2598f47c294313a20a748e503bbfe3dae708f5a6d825afab614b99c5dbf71ffbfb0c392cfbe9b74f9d0004399da3daa9763727efbad1735
|
data/README.md
CHANGED
@@ -8,8 +8,8 @@ to your Rails application. It works with Rails 4.
|
|
8
8
|
|
9
9
|
November 21, 2013: Version 0.7.0 is using Font Awesome 4.0
|
10
10
|
|
11
|
-
November 21, 2013:
|
12
|
-
these files
|
11
|
+
November 21, 2013: Move files from *vendor/* to *app/* folder.<br>
|
12
|
+
Now these files are automatically precompiled.
|
13
13
|
|
14
14
|
May 16, 2013: Now using Font Awesome 3.1.1 and works with Rails 4!
|
15
15
|
|
@@ -55,7 +55,34 @@ Just import *fontawesome* right after *twitter/bootstrap*:
|
|
55
55
|
|
56
56
|
## Helper methods
|
57
57
|
|
58
|
-
### version 0.
|
58
|
+
### for version 0.8.0 (renamed `ilink_to` to `fa_link_to`)
|
59
|
+
|
60
|
+
To place Font Awesome icon add *i* element and set its *class*
|
61
|
+
attribute to a icon name, [for example](http://fontawesome.io/examples/):
|
62
|
+
|
63
|
+
```html
|
64
|
+
<i class="fa fa-camera-retro"></i>
|
65
|
+
```
|
66
|
+
|
67
|
+
To ease placing icons in Rails *link_to* helper use
|
68
|
+
the *fa_link_to* helper method.
|
69
|
+
|
70
|
+
For example, to place the *fa-upload* icon next to *Edit* write something like:
|
71
|
+
|
72
|
+
```rhtml
|
73
|
+
<%= fa_link_to "upload", "Edit", edit_post_path(post), class: 'btn btn-mini' %>
|
74
|
+
```
|
75
|
+
|
76
|
+
or to place *trash-o* next to text *Destroy* button write:
|
77
|
+
|
78
|
+
```rhtml
|
79
|
+
<%= fa_link_to "trash-o", "Destroy", post, data: { confirm: "Are you sure?" },
|
80
|
+
method: :delete, class: 'btn btn-mini btn-danger'%>
|
81
|
+
```
|
82
|
+
(precede the link text with the icon name stripped off *fa-* prefix)
|
83
|
+
|
84
|
+
|
85
|
+
### for version 0.7.0
|
59
86
|
|
60
87
|
To place Font Awesome icon add *i* element and set its *class*
|
61
88
|
attribute to a icon name, [for example](http://fontawesome.io/examples/):
|
@@ -76,13 +103,13 @@ For example, to place the *fa-upload* icon next to *Edit* write something like:
|
|
76
103
|
or to place *trash-o* next to text *Destroy* button write:
|
77
104
|
|
78
105
|
```rhtml
|
79
|
-
<%= ilink_to "trash-o", "Destroy", post, data:
|
106
|
+
<%= ilink_to "trash-o", "Destroy", post, data: { confirm: "Are you sure?" },
|
80
107
|
method: :delete, class: 'btn btn-mini btn-danger'%>
|
81
108
|
```
|
82
109
|
(precede the link text with the icon name stripped off *fa-* prefix)
|
83
110
|
|
84
111
|
|
85
|
-
### versions prior to 0.7.0
|
112
|
+
### for versions prior to 0.7.0
|
86
113
|
|
87
114
|
To place Font Awesome icon add *i* element and set its *class*
|
88
115
|
attribute to a icon name, for example:
|
@@ -103,7 +130,7 @@ For example, to place the *icon-upload-alt* icon next to *Edit* write something
|
|
103
130
|
or to place *icon-trash* next to text *Destroy* button write:
|
104
131
|
|
105
132
|
```rhtml
|
106
|
-
<%= ilink_to "trash", "Destroy", post, data:
|
133
|
+
<%= ilink_to "trash", "Destroy", post, data: { confirm: "Are you sure?" },
|
107
134
|
method: :delete, class: 'btn btn-mini btn-danger'%>
|
108
135
|
```
|
109
136
|
(precede the link text with the icon name stripped off *icon-* prefix)
|
@@ -2,12 +2,12 @@ module Less
|
|
2
2
|
module Rails
|
3
3
|
module Fontawesome
|
4
4
|
module LinkHelper
|
5
|
-
def
|
5
|
+
def fa_link_to(*args, &block)
|
6
6
|
if block_given?
|
7
7
|
icon = args[0]
|
8
8
|
options = args[1] || {}
|
9
9
|
html_options = args[2]
|
10
|
-
|
10
|
+
fa_link_to(icon, capture(&block), options, html_options)
|
11
11
|
else
|
12
12
|
icon = args[0]
|
13
13
|
name = args[1]
|
@@ -27,7 +27,7 @@ module Less
|
|
27
27
|
|
28
28
|
# TODO:
|
29
29
|
|
30
|
-
# def
|
30
|
+
# def fa_link_to_unless
|
31
31
|
# if condition
|
32
32
|
# if block_given?
|
33
33
|
# block.arity <= 1 ? capture(name, &block) : capture(name, options, html_options, &block)
|
@@ -35,16 +35,16 @@ module Less
|
|
35
35
|
# name
|
36
36
|
# end
|
37
37
|
# else
|
38
|
-
#
|
38
|
+
# fa_link_to(name, options, html_options)
|
39
39
|
# end
|
40
40
|
# end
|
41
41
|
|
42
|
-
# def
|
43
|
-
#
|
42
|
+
# def fa_link_to_if(condition, name, options = {}, html_options = {}, &block)
|
43
|
+
# fa_link_to_unless !condition, name, options, html_options, &block
|
44
44
|
# end
|
45
45
|
|
46
|
-
# def
|
47
|
-
#
|
46
|
+
# def fa_link_to_unless_current(name, options = {}, html_options = {}, &block)
|
47
|
+
# fa_link_to_unless current_page?(options), name, options, html_options, &block
|
48
48
|
# end
|
49
49
|
end
|
50
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: less-rails-fontawesome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wlodek Bzyl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: less-rails
|