font-awesome-helper 0.0.1
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +21 -0
- data/lib/font-awesome-helper.rb +3 -0
- data/lib/font-awesome-helper/fa-icon.rb +30 -0
- data/lib/font-awesome-helper/helpers.rb +19 -0
- data/lib/font-awesome-helper/railtie.rb +12 -0
- data/lib/font-awesome-helper/version.rb +3 -0
- data/lib/tasks/font_awesome_helper_tasks.rake +4 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dd42eb5dca756b304415112f29e5f6a0e3c8af7e
|
4
|
+
data.tar.gz: 010eaecf5a4f5dcbd8ad7bc7c26fe1ee7455c280
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8ff1ea543f1b67dd56efc26df4a947c75b51bfbe010fe5c7368942e659f9bc155c1cfccd665e40462df66af0052618c995629cc6a5f0d22fd0a80001ae347ff7
|
7
|
+
data.tar.gz: 8a9636c985040588477e0e92405f51540cbaf12812d64bbd7a47b05b733048d5b533933ffa43810a1dea61cd636c310d916c0122eef9f4ba31053385ccce696a
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'FontAwesomeHelper'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module FontAwesomeHelper
|
2
|
+
class FaIcon
|
3
|
+
include ActionView::Helpers::TagHelper
|
4
|
+
FA_CLASS_PREFIX = 'fa'
|
5
|
+
|
6
|
+
def initialize(names, options = {})
|
7
|
+
@classes = [FA_CLASS_PREFIX]
|
8
|
+
@classes.concat fa_prefixize(names_to_a(names))
|
9
|
+
@classes.concat names_to_a(options.delete(:class))
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_tag
|
13
|
+
content_tag(:i, nil, class: @classes.join(' '))
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def names_to_a(names)
|
19
|
+
case names
|
20
|
+
when Array then names
|
21
|
+
when String then names.split(/\s+/)
|
22
|
+
else []
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def fa_prefixize(names)
|
27
|
+
names.map { |n| "#{FA_CLASS_PREFIX}-#{n}" }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module FontAwesomeHelper
|
2
|
+
module Helpers
|
3
|
+
FA_CLASS_PREFIX = 'fa'
|
4
|
+
|
5
|
+
# TODO: fw (e.g. `fa_icon 'github', fixed: true`)
|
6
|
+
# TODO: border (e.g. `fa_icon 'github', border: true`)
|
7
|
+
# TODO: spin (e.g. `fa_icon 'github', spin: true`)
|
8
|
+
# TODO: size (e.g. `fa_icon 'github', size: '2x'`)
|
9
|
+
# TODO: rotate (e.g. `fa_icon 'github', rotate: 90`)
|
10
|
+
# TODO: flip (e.g. `fa_icon 'github', flip: :vertical`)
|
11
|
+
def fa_icon(names, options = {})
|
12
|
+
icon = FaIcon.new(names, options)
|
13
|
+
(block_given? ? yield(icon.to_tag) : icon.to_tag).html_safe
|
14
|
+
end
|
15
|
+
|
16
|
+
# TODO: stackしやすいやつ
|
17
|
+
# TODO: fa-ul,fa-liのやつ
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: font-awesome-helper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masayuki IZUMI
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.1.8
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.1.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Provide useful helper methods for Font Awesome.
|
56
|
+
email:
|
57
|
+
- masayuki@izumin.info
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- MIT-LICENSE
|
63
|
+
- README.rdoc
|
64
|
+
- Rakefile
|
65
|
+
- lib/font-awesome-helper.rb
|
66
|
+
- lib/font-awesome-helper/fa-icon.rb
|
67
|
+
- lib/font-awesome-helper/helpers.rb
|
68
|
+
- lib/font-awesome-helper/railtie.rb
|
69
|
+
- lib/font-awesome-helper/version.rb
|
70
|
+
- lib/tasks/font_awesome_helper_tasks.rake
|
71
|
+
homepage: http://izumin.info
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.2.2
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: Useful helper for Font Awesome.
|
95
|
+
test_files: []
|