less-rails-fontawesome 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -42,7 +42,7 @@ attribute to a icon name, for example:
|
|
42
42
|
```
|
43
43
|
|
44
44
|
To ease placing icons in Rails *link_to* helper use
|
45
|
-
the
|
45
|
+
the *ilink_to* helper method.
|
46
46
|
|
47
47
|
For example, to place the *icon-upload-alt* icon next to *Edit* write something like:
|
48
48
|
|
@@ -3,6 +3,11 @@ module Font
|
|
3
3
|
module Less
|
4
4
|
module Rails
|
5
5
|
class Engine < ::Rails::Engine
|
6
|
+
initializer 'font.awesome.less.rails.action_controller' do |app|
|
7
|
+
ActiveSupport.on_load :action_controller do
|
8
|
+
helper Font::Awesome::Less::Rails::LinkHelper
|
9
|
+
end
|
10
|
+
end
|
6
11
|
end
|
7
12
|
end
|
8
13
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Font
|
2
|
+
module Awesome
|
3
|
+
module Less
|
4
|
+
module Rails
|
5
|
+
module LinkHelper
|
6
|
+
def ilink_to(*args, &block)
|
7
|
+
if block_given?
|
8
|
+
icon = args[0]
|
9
|
+
options = args[1] || {}
|
10
|
+
html_options = args[2]
|
11
|
+
ilink_to(icon, capture(&block), options, html_options)
|
12
|
+
else
|
13
|
+
icon = args[0]
|
14
|
+
name = args[1]
|
15
|
+
options = args[2] || {}
|
16
|
+
html_options = args[3]
|
17
|
+
|
18
|
+
html_options = convert_options_to_data_attributes(options, html_options)
|
19
|
+
url = url_for(options)
|
20
|
+
|
21
|
+
href = html_options['href']
|
22
|
+
tag_options = tag_options(html_options)
|
23
|
+
|
24
|
+
href_attr = "href=\"#{ERB::Util.html_escape(url)}\"" unless href
|
25
|
+
"<a #{href_attr}#{tag_options}><i class=\"icon-#{icon}\"></i> #{ERB::Util.html_escape(name || url)}</a>".html_safe
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# TODO:
|
30
|
+
|
31
|
+
# def ilink_to_unless
|
32
|
+
# if condition
|
33
|
+
# if block_given?
|
34
|
+
# block.arity <= 1 ? capture(name, &block) : capture(name, options, html_options, &block)
|
35
|
+
# else
|
36
|
+
# name
|
37
|
+
# end
|
38
|
+
# else
|
39
|
+
# ilink_to(name, options, html_options)
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
|
43
|
+
# def ilink_to_if(condition, name, options = {}, html_options = {}, &block)
|
44
|
+
# ilink_to_unless !condition, name, options, html_options, &block
|
45
|
+
# end
|
46
|
+
|
47
|
+
# def ilink_to_unless_current(name, options = {}, html_options = {}, &block)
|
48
|
+
# ilink_to_unless current_page?(options), name, options, html_options, &block
|
49
|
+
# end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 3.1.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.1.1
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: less-rails
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: 2.1.7
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.1.7
|
36
46
|
description: Font Awesome, LESS version, with assets pipeline, for Rails 3.1+ Asset
|
37
47
|
Pipeline
|
38
48
|
email:
|
@@ -45,10 +55,10 @@ files:
|
|
45
55
|
- Gemfile
|
46
56
|
- README.md
|
47
57
|
- Rakefile
|
48
|
-
- application_helper.rb
|
49
58
|
- less-rails-fontawesome.gemspec
|
50
59
|
- lib/less-rails-fontawesome.rb
|
51
60
|
- lib/less-rails-fontawesome/engine.rb
|
61
|
+
- lib/less-rails-fontawesome/link_helper.rb
|
52
62
|
- lib/less-rails-fontawesome/version.rb
|
53
63
|
- vendor/assets/fonts/fontawesome-webfont.eot
|
54
64
|
- vendor/assets/fonts/fontawesome-webfont.svg
|
@@ -75,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
85
|
version: '0'
|
76
86
|
requirements: []
|
77
87
|
rubyforge_project: less-rails-fontawesome
|
78
|
-
rubygems_version: 1.8.
|
88
|
+
rubygems_version: 1.8.23
|
79
89
|
signing_key:
|
80
90
|
specification_version: 3
|
81
91
|
summary: Font Awesome in LESS for Rails 3.1+ Asset Pipeline
|
data/application_helper.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
module ApplicationHelper
|
2
|
-
|
3
|
-
def ilink_to(*args, &block)
|
4
|
-
if block_given?
|
5
|
-
icon = args[0]
|
6
|
-
options = args[1] || {}
|
7
|
-
html_options = args[2]
|
8
|
-
ilink_to(icon, capture(&block), options, html_options)
|
9
|
-
else
|
10
|
-
icon = args[0]
|
11
|
-
name = args[1]
|
12
|
-
options = args[2] || {}
|
13
|
-
html_options = args[3]
|
14
|
-
|
15
|
-
html_options = convert_options_to_data_attributes(options, html_options)
|
16
|
-
url = url_for(options)
|
17
|
-
|
18
|
-
href = html_options['href']
|
19
|
-
tag_options = tag_options(html_options)
|
20
|
-
|
21
|
-
href_attr = "href=\"#{ERB::Util.html_escape(url)}\"" unless href
|
22
|
-
"<a #{href_attr}#{tag_options}><i class=\"icon-#{icon}\"></i> #{ERB::Util.html_escape(name || url)}</a>".html_safe
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# TODO:
|
27
|
-
|
28
|
-
# def ilink_to_unless
|
29
|
-
# if condition
|
30
|
-
# if block_given?
|
31
|
-
# block.arity <= 1 ? capture(name, &block) : capture(name, options, html_options, &block)
|
32
|
-
# else
|
33
|
-
# name
|
34
|
-
# end
|
35
|
-
# else
|
36
|
-
# ilink_to(name, options, html_options)
|
37
|
-
# end
|
38
|
-
# end
|
39
|
-
|
40
|
-
# def ilink_to_if(condition, name, options = {}, html_options = {}, &block)
|
41
|
-
# ilink_to_unless !condition, name, options, html_options, &block
|
42
|
-
# end
|
43
|
-
|
44
|
-
# def ilink_to_unless_current(name, options = {}, html_options = {}, &block)
|
45
|
-
# ilink_to_unless current_page?(options), name, options, html_options, &block
|
46
|
-
# end
|
47
|
-
|
48
|
-
end
|