weather-icons-rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66cc31dedd6673806fc377eba6d42b80e33f3586
4
- data.tar.gz: d21b0ada46ff297aa00a36b61cd7ff627d4cf956
3
+ metadata.gz: e2749e85b930c8561fde3a12cc0f0af280d0d5c1
4
+ data.tar.gz: 9129d36017c98dacc724ac3c152b94d5711c04a3
5
5
  SHA512:
6
- metadata.gz: 63dc1cf232b3a4d3182d01354a40f313602dfd1b7ca8163ebad48c289ab73ce5eda998ee3a6baf187a91e5a1833270c584548176e5a0a2577233062f5c2d9fa0
7
- data.tar.gz: f9a0d24e3f5f564e4f61e0e5a981b8a70ab9322d30aabf6f7d66c9a8d4e16b2e8b825f2a57718007976771dfb65d2ae3b5098ea2a8bfba67874c75e72ec3a4dd
6
+ metadata.gz: 2158c03b377609b45ebd1795b887a0ee37c78d40205bf9860aa67b1d8f8a4a74b488108f6f07d59a4dae10211d3dcd1263a912bf530e7080826ddb1eed5f2b4d
7
+ data.tar.gz: b4da17ffb6388d6da0e350085f9a2aa4d112236e7f35660dcd63657df3fe97193e62aeb6e106071d62e751d48c048554c209ba1ee6a19fc77cbc3a02872bd88b
data/README.md CHANGED
@@ -1,40 +1,128 @@
1
- #In the midst of adapting this into a gem. I'm not the original author, all credit goes to Erik Flowers.
2
1
 
3
- # Weather Icons
4
- *Version Beta 1 - August 3rd 2013*
2
+ # Weather::Icons::Rails [![Gem Version](https://badge.fury.io/rb/weather-icons-rails@2x.svg)](http://rubygems.org/gems/weather-icons-rails)
3
+ Weather-Icons-Rails gem for use in Ruby projects
5
4
 
6
- ## A free, open source icon-font of Weather icons
5
+ ## A free, open source font of Weather icons
7
6
 
8
7
  Weather Icons is a font of 92 weather themed icons, ready to be dropped right into [Bootstrap](http://www.getbootstrap.com) or any other project.
9
8
 
10
- Inspired by [Font Awesome](http://fontawesome.io/), They work in essentially the same way. They are infinitley scalable and any CSS that can be applied to text can be applied to them. All you need to do to insert an icon is add the class to an "i" element:
11
-
12
- ``<i class="wi-day-lightning"></i>``
13
-
14
- At this time, there are no other effects/mixins to do advanced icon manipulation yet.
9
+ Inspired by [Font Awesome](http://fontawesome.io/), They work in essentially the same way. They are infinitely scalable and any CSS that can be applied to text can be applied to them. All you need to do to insert an icon is add the class to an "i" element like this: `<i class="wi wi-day-lightning"></i>`
15
10
 
16
11
  ####[View demo and full icon reference](http://erikflowers.github.io/weather-icons/)
17
12
 
18
13
  ## Getting Started
19
- Getting started is easy. First, put the fonts in the directory ABOVE your css directory. By default, the fonts are referencing a ../font/ folder that is on the same level as /css. This can be changed via the `@WeatherIconPath` variable in variables.less
20
-
21
- Include in your main .less file `weather-icons/weather-icons.less` and that is all you need to do.
22
-
23
- #### CSS Only Method
24
- If you just want to add a css file to your project with no Less compiling, you just need to reference the `weather-icons.css` included in the css folder. *If you are not familiar with using Bootstrap, or using Bootstrap in the precompiled Less mode, I would reccommend you give it a try)*
25
-
26
- ## Version Beta 1
27
- This is my first attempt at a [Bootstrap](http://www.getbootstrap.com) and/or web ready icon-font, so there will be updates and improvements. It is best to download the [repo](http://www.github.com/erikflowers/weather-icons) from Github if you want to keep up to date. Please report any issues or requests to the repository here
28
14
 
29
- The icon designs are originally by [Lukas Bischoff](http://www.twitter.com/artill). The font has been modified slightly for icon-font usage, and turned into a HTML/CSS/LESS addon by [me (Erik)](http://www.helloerik.com).
15
+ The original author Erik put these web fonts together, I have packaged his hard work into a simple Sass based gem.
16
+
17
+ To install simply add
18
+
19
+ ```ruby
20
+ gem 'weather-icons-rails'
21
+ ```
22
+ then after bundeling add
23
+
24
+ ```css
25
+ *= require weather-icons
26
+ ```
27
+
28
+ right before `*= require_self`
29
+
30
+ ###### Now it's time to have at it, and class up your HTML.
31
+
32
+ To add icons anywhere in your html just add one of these tags with your symbole of choice:
33
+
34
+ ```html
35
+ <i class="wi wi-day-lightning"></i>
36
+ ```
37
+ ## If that wasn't easy enough, Helpers make it even easier!
38
+
39
+ In your view just add these to your HAML or ERB:
40
+ ```ruby
41
+ wi_icon('day-lightning')
42
+ # => <i class="wi wi-day-lightning"></i>
43
+ ```
44
+ ```ruby
45
+ wi_icon('day-lightning', '', class: 'strong')
46
+ # => <i class="wi wi-day-lightning strong"></i>
47
+ # Although this currently does not change the actual look of the font yet. Any suggestions?
48
+ ```
49
+ ```ruby
50
+ wi_icon "day-lightning lg", class: "text-muted pull-left"
51
+ # => <i class="wi wi-day-lightning wi-lg text-muted pull-left"></i>
52
+ ```
53
+ ```ruby
54
+ wi_icon('day-lightning', 'Weather Icons', id: 'lightning', class: 'strong')
55
+ # => <i id="lightning" class="wi wi-day-lightning strong"></i> Weather Icons
56
+ ```
57
+
58
+ ```ruby
59
+ content_tag(:li, wi_icon("day-lightning li", text: "Bulleted list item"))
60
+ # => <li><i class="wi wi-day-lightning wi-li"></i> Bulleted list item</li>
61
+ ```
62
+ ```ruby
63
+ wi_stacked_icon "day-lightning", base: "day-cloudy-gusts"
64
+ # => <span class="fa-stack">
65
+ # => <i class="wi wi-day-cloudy-gusts wi-stack-2x"></i>
66
+ # => <i class="wi wi-day-lightning wi-stack-1x"></i>
67
+ # => </span>
68
+
69
+ wi_stacked_icon "day-lightning inverse", base: 'day-cloudy-gusts', class: "pull-right", text: "Hi!"
70
+ # => <span class="wi-stack pull-right">
71
+ # => <i class="wi wi-day-cloudy-gusts wi-stack-2x"></i>
72
+ # => <i class="wi wi-day-lightning wi-inverse wi-stack-1x"></i>
73
+ # => </span> Hi!
74
+ ```
75
+
76
+ ##Fancy css classes for fancy people.
77
+
78
+ Supported classes:
79
+
80
+ ```css
81
+ .wi-spin
82
+
83
+ .wi-rotate-90
84
+ .wi-rotate-180
85
+ .wi-rotate-270
86
+
87
+ .wi-flip-horizontal
88
+ .wi-flip-vertical
89
+
90
+ .wi-ul
91
+ .wi-li
92
+
93
+ .wi-md
94
+ .wi-lg
95
+ .wi-xl
96
+ .wi-2x
97
+ .wi-3x
98
+ ...
99
+ .wi-9x
100
+
101
+ .wi-fw // Fixed Width Icons
102
+
103
+ .wi-border
104
+ ```
105
+
106
+ ## Version 0.0.2 (BETA?)
107
+ This is my first attempt at making a gem, please feel free to send me any pull requests or questions. I'm happy to help and or learn. Thanks!
108
+
109
+ The icon designs are originally by [Lukas Bischoff](http://www.twitter.com/artill). The font has been modified slightly for icon-font usage, which was then turned into a HTML/CSS/LESS addon by [Erik Flowers](http://www.helloerik.com). My gem was originally based off of the hard work over at [Font Awesome Rails](https://github.com/bokmann/font-awesome-rails) and then updated to closely mirror the Sass based version at [Font Awesome Sass](https://github.com/FortAwesome/font-awesome-sass).
30
110
 
31
111
  ### Collaboration
32
- If you feel so inclined to add icon ideas, icon art, or other fixes/changes to how the package works, feel free to help! I'd also love it if someone wanted to make this a component as well for bower, npm, component, etc. No idea how to do that myself (yet).
112
+ Any additional icon ideas, icon art, or other fixes/changes to how the package works are more than welcome.
33
113
 
34
114
  ## Credit
35
- None of this would be possible without [Bootstrap](http://www.getbootstrap.com), [Font Awesome](http://fontawesome.io/) and [Lukas Bischoff](http://www.twitter.com/artill). I just put it all together into a neat package. Cheatsheet provided by Michael Woywod.
115
+ None of this would be possible without [Bootstrap](http://www.getbootstrap.com), [Font Awesome](http://fontawesome.io/), [Lukas Bischoff](http://www.twitter.com/artill), and [Erik Flowers](http://www.helloerik.com). I just put it into a gem and added the helpers, and extra styling css classes from font-awesome-sass. Cheatsheet provided by Michael Woywod.
36
116
 
37
117
  Weather Icons licensed under [SIL OFL 1.1](http://scripts.sil.org/OFL) &mdash; Code licensed under [MIT License](http://opensource.org/licenses/mit-license.html) &mdash; Documentation licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0)
38
118
 
39
119
  ## Contact
40
- Weather Icons is maintained by me, Erik Flowers. Reach me at [@Erik_UX](http://www.twitter.com/Erik_UX) or at [helloerik.com](http;//www.helloerik.com).
120
+ Weather Icons Rails is maintained by me, Cody Schaaf. Reach me at [@TheCodingCody](http://www.twitter.com/TheCodingCody) or through [GitHub](https://github.com/CodySchaaf/weather-icons-rails).
121
+
122
+ * The Weather Icons font is
123
+ licensed under the [SIL Open Font License](http://scripts.sil.org/OFL).
124
+ * Weather Icons CSS files are
125
+ licensed under the
126
+ [MIT License](http://opensource.org/licenses/mit-license.html).
127
+ * The remainder of the weather-icons-rails project is licensed under the
128
+ [MIT License](http://opensource.org/licenses/mit-license.html).
@@ -0,0 +1,92 @@
1
+ # module WeatherIcons
2
+ # module Rails
3
+ # module IconHelper
4
+ # # Creates an icon tag given an icon name and possible icon
5
+ # # modifiers.
6
+ # #
7
+ # # Examples
8
+ # #
9
+ # # wi_icon "camera-retro"
10
+ # # # => <i class="wi-camera-retro"></i>
11
+ # #
12
+ # # wi_icon "camera-retro", text: "Take a photo"
13
+ # # # => <i class="wi-camera-retro"></i> Take a photo
14
+ # #
15
+ # # wi_icon "camera-retro 2x"
16
+ # # # => <i class="wi-camera-retro wi-2x"></i>
17
+ # # wi_icon ["camera-retro", "4x"]
18
+ # # # => <i class="wi-camera-retro wi-4x"></i>
19
+ # # wi_icon "spinner spin lg"
20
+ # # # => <i class="wi-spinner wi-spin wi-lg">
21
+ # #
22
+ # # wi_icon "quote-left 4x", class: "pull-left"
23
+ # # # => <i class="wi-quote-left wi-4x pull-left"></i>
24
+ # #
25
+ # # wi_icon "user", data: { id: 123 }
26
+ # # # => <i class="wi-user" data-id="123"></i>
27
+ # #
28
+ # # content_tag(:li, wi_icon("check li", text: "Bulleted list item"))
29
+ # # # => <li><i class="wi-check wi-li"></i> Bulleted list item</li>
30
+ # def wi_icon(names = "flag", options = {})
31
+ # classes = []
32
+ # classes.concat Private.icon_names(names)
33
+ # classes.concat Array(options.delete(:class))
34
+ # text = options.delete(:text)
35
+ # icon = content_tag(:i, nil, options.merge(:class => classes))
36
+ # Private.icon_join(icon, text)
37
+ # end
38
+ #
39
+ # # Creates an stack set of icon tags given a base icon name, a main icon
40
+ # # name, and possible icon modifiers.
41
+ # #
42
+ # # Examples
43
+ # #
44
+ # # wi_stacked_icon "twitter", base: "square-o"
45
+ # # # => <span class="wi-stack">
46
+ # # # => <i class="wi-square-o wi-stack-2x"></i>
47
+ # # # => <i class="wi-twitter wi-stack-1x"></i>
48
+ # # # => </span>
49
+ # #
50
+ # # wi_stacked_icon "terminal inverse", base: "square", class: "pull-right", text: "Hi!"
51
+ # # # => <span class="wi-stack pull-right">
52
+ # # # => <i class="wi-square wi-stack-2x"></i>
53
+ # # # => <i class="wi-terminal wi-inverse wi-stack-1x"></i>
54
+ # # # => </span> Hi!
55
+ # #
56
+ # # wi_stacked_icon "camera", base: "ban-circle", reverse: true
57
+ # # # => <span class="wi-stack">
58
+ # # # => <i class="wi-camera wi-stack-1x"></i>
59
+ # # # => <i class="wi-ban-circle wi-stack-2x"></i>
60
+ # # # => </span>
61
+ # def wi_stacked_icon(names = "flag", options = {})
62
+ # classes = Private.icon_names("stack").concat(Array(options.delete(:class)))
63
+ # base_names = Private.array_value(options.delete(:base) || "square-o").push("stack-2x")
64
+ # names = Private.array_value(names).push("stack-1x")
65
+ # base = wi_icon(base_names, options.delete(:base_options) || {})
66
+ # icon = wi_icon(names, options.delete(:icon_options) || {})
67
+ # icons = [base, icon]
68
+ # icons.reverse! if options.delete(:reverse)
69
+ # text = options.delete(:text)
70
+ # stacked_icon = content_tag(:span, safe_join(icons), options.merge(:class => classes))
71
+ # Private.icon_join(stacked_icon, text)
72
+ # end
73
+ #
74
+ # module Private
75
+ # extend ActionView::Helpers::OutputSafetyHelper
76
+ #
77
+ # def self.icon_join(icon, text)
78
+ # return icon if text.blank?
79
+ # safe_join([icon, ERB::Util.html_escape(text)], " ")
80
+ # end
81
+ #
82
+ # def self.icon_names(names = [])
83
+ # array_value(names).map { |n| "wi-#{n}" }
84
+ # end
85
+ #
86
+ # def self.array_value(value = [])
87
+ # value.is_a?(Array) ? value : value.to_s.split(/\s+/)
88
+ # end
89
+ # end
90
+ # end
91
+ # end
92
+ # end
@@ -0,0 +1,58 @@
1
+ module WeatherIcons
2
+ module Rails
3
+ class << self
4
+ def load!
5
+ if rails?
6
+ register_rails_engine
7
+ end
8
+
9
+ if compass?
10
+ register_compass_extension
11
+ end
12
+ end
13
+
14
+ def gem_path
15
+ @gem_path ||= File.expand_path('..', File.dirname(__FILE__))
16
+ end
17
+
18
+ def stylesheets_path
19
+ File.join(assets_path, 'stylesheets')
20
+ end
21
+
22
+ def fonts_path
23
+ File.join(assets_path, 'fonts')
24
+ end
25
+
26
+ def assets_path
27
+ @assets_path ||= File.join(gem_path, 'vendor', 'assets')
28
+ end
29
+
30
+ def compass?
31
+ defined?(::Compass)
32
+ end
33
+
34
+ def rails?
35
+ defined?(::Rails)
36
+ end
37
+
38
+ private
39
+
40
+ def register_compass_extension
41
+ ::Compass::Frameworks.register(
42
+ 'weather-icons-rails',
43
+ path: gem_path,
44
+ stylesheets_directory: stylesheets_path,
45
+ templates_directory: File.join(gem_path, 'templates')
46
+ )
47
+ end
48
+
49
+ def register_rails_engine
50
+ require 'sass-rails'
51
+ require 'weather-icons-rails/rails/rails/engine'
52
+ require 'weather-icons-rails/rails/rails/railtie'
53
+ end
54
+ end
55
+ end
56
+ end
57
+
58
+ WeatherIcons::Rails.load!
@@ -8,28 +8,28 @@ module WeatherIcons
8
8
  # Examples
9
9
  #
10
10
  # wi_icon "camera-retro"
11
- # # => <i class="wi-camera-retro"></i>
11
+ # # => <i class="wi wi-camera-retro"></i>
12
12
  #
13
13
  # wi_icon "camera-retro", text: "Take a photo"
14
- # # => <i class="wi-camera-retro"></i> Take a photo
14
+ # # => <i class="wi wi-camera-retro"></i> Take a photo
15
15
  #
16
16
  # wi_icon "camera-retro 2x"
17
- # # => <i class="wi-camera-retro wi-2x"></i>
17
+ # # => <i class="wi wi-camera-retro wi-2x"></i>
18
18
  # wi_icon ["camera-retro", "4x"]
19
- # # => <i class="wi-camera-retro wi-4x"></i>
19
+ # # => <i class="wi wi-camera-retro wi-4x"></i>
20
20
  # wi_icon "spinner spin lg"
21
- # # => <i class="wi-spinner wi-spin wi-lg">
21
+ # # => <i class="wi wi-spinner wi-spin wi-lg">
22
22
  #
23
23
  # wi_icon "quote-left 4x", class: "pull-left"
24
- # # => <i class="wi-quote-left wi-4x pull-left"></i>
24
+ # # => <i class="wi wi-quote-left wi-4x pull-left"></i>
25
25
  #
26
26
  # wi_icon "user", data: { id: 123 }
27
- # # => <i class="wi-user" data-id="123"></i>
27
+ # # => <i class="wi wi-user" data-id="123"></i>
28
28
  #
29
29
  # content_tag(:li, wi_icon("check li", text: "Bulleted list item"))
30
- # # => <li><i class="wi-check wi-li"></i> Bulleted list item</li>
30
+ # # => <li><i class="wi wi-check wi-li"></i> Bulleted list item</li>
31
31
  def wi_icon(names = "flag", options = {})
32
- classes = []
32
+ classes = ['wi ']
33
33
  classes.concat Private.icon_names(names)
34
34
  classes.concat Array(options.delete(:class))
35
35
  text = options.delete(:text)
@@ -44,20 +44,20 @@ module WeatherIcons
44
44
  #
45
45
  # wi_stacked_icon "twitter", base: "square-o"
46
46
  # # => <span class="wi-stack">
47
- # # => <i class="wi-square-o wi-stack-2x"></i>
48
- # # => <i class="wi-twitter wi-stack-1x"></i>
47
+ # # => <i class="wi wi-square-o wi-stack-2x"></i>
48
+ # # => <i class="wi wi-twitter wi-stack-1x"></i>
49
49
  # # => </span>
50
50
  #
51
51
  # wi_stacked_icon "terminal inverse", base: "square", class: "pull-right", text: "Hi!"
52
52
  # # => <span class="wi-stack pull-right">
53
- # # => <i class="wi-square wi-stack-2x"></i>
54
- # # => <i class="wi-terminal wi-inverse wi-stack-1x"></i>
53
+ # # => <i class="wi wi-square wi-stack-2x"></i>
54
+ # # => <i class="wi wi-terminal wi-inverse wi-stack-1x"></i>
55
55
  # # => </span> Hi!
56
56
  #
57
57
  # wi_stacked_icon "camera", base: "ban-circle", reverse: true
58
58
  # # => <span class="wi-stack">
59
- # # => <i class="wi-camera wi-stack-1x"></i>
60
- # # => <i class="wi-ban-circle wi-stack-2x"></i>
59
+ # # => <i class="wi wi-camera wi-stack-1x"></i>
60
+ # # => <i class="wi wi-ban-circle wi-stack-2x"></i>
61
61
  # # => </span>
62
62
  def wi_stacked_icon(names = "flag", options = {})
63
63
  classes = Private.icon_names("stack").concat(Array(options.delete(:class)))
@@ -1,5 +1,5 @@
1
1
  module WeatherIcons
2
2
  module Rails
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weather-icons-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Schaaf
@@ -144,7 +144,9 @@ files:
144
144
  - app/assets/stylesheets/weather-icons/_spinning.css.scss
145
145
  - app/assets/stylesheets/weather-icons/_stacked.css.scss
146
146
  - app/assets/stylesheets/weather-icons/_variables.css.scss
147
+ - app/helpers/weather_icons/rails/icon_helper.rb
147
148
  - lib/weather-icons-rails.rb
149
+ - lib/weather-icons-rails/rails.rb
148
150
  - lib/weather-icons/rails.rb
149
151
  - lib/weather-icons/rails/rails/engine.rb
150
152
  - lib/weather-icons/rails/rails/helpers.rb