holder_rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -24,6 +24,25 @@ Add to your JavaScript manifest file:
24
24
  //= require holder
25
25
  ```
26
26
 
27
+ You can use `holder_tag` helper in your views:
28
+
29
+ ```ruby
30
+ holder_tag 100
31
+ # => <img data-src="holder.js/100x100/text:100x100/" src="" />
32
+
33
+ holder_tag '200x300'
34
+ # => <img data-src="holder.js/200x300/text:200x300/" src="" />
35
+
36
+ holder_tag '200x300', 'Lorem ipsum'
37
+ # => <img data-src="holder.js/200x300/text:Lorem ipsum/" src="" />
38
+
39
+ holder_tag '200x300', 'Lorem ipsum', 'social'
40
+ # => <img data-src="holder.js/200x300/text:Lorem ipsum/social" src="" />
41
+
42
+ holder_tag '500x800', 'Example text', 'gray', :id => 'new', :class => 'special'
43
+ # => <img class="special" data-src="holder.js/500x800/text:Example text/gray" id="new" src="" />
44
+ ```
45
+
27
46
  For more information, check out [holder readme](https://github.com/imsky/holder#readme).
28
47
 
29
48
  ## License
@@ -0,0 +1,12 @@
1
+ module HolderRails
2
+ module Helpers
3
+ def holder_tag(size, text='', theme=nil, html_options={})
4
+ size = "#{size}x#{size}" unless size =~ /^\d+x\d+$/
5
+ text = text.to_s.empty? ? size : text
6
+ options = {:src => '', :data => {:src => "holder.js/#{size}/text:#{text}/#{theme}"}}
7
+ options = options.merge(html_options)
8
+
9
+ tag :img, options
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module HolderRails
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/holder_rails.rb CHANGED
@@ -1,6 +1,9 @@
1
1
  require "holder_rails/version"
2
+ require "holder_rails/helpers"
2
3
  require "rails/engine"
3
4
 
4
5
  module HolderRails
5
6
  class Engine < ::Rails::Engine; end
6
7
  end
8
+
9
+ ActionView::Base.send :include, HolderRails::Helpers
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: holder_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-07 00:00:00.000000000 Z
12
+ date: 2012-09-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -42,6 +42,7 @@ files:
42
42
  - Rakefile
43
43
  - holder_rails.gemspec
44
44
  - lib/holder_rails.rb
45
+ - lib/holder_rails/helpers.rb
45
46
  - lib/holder_rails/version.rb
46
47
  - vendor/assets/javascripts/holder.js
47
48
  homepage: https://github.com/narkoz/holder_rails
@@ -58,7 +59,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
59
  version: '0'
59
60
  segments:
60
61
  - 0
61
- hash: 1373212328217276062
62
+ hash: -451430194701671382
62
63
  required_rubygems_version: !ruby/object:Gem::Requirement
63
64
  none: false
64
65
  requirements:
@@ -67,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
68
  version: '0'
68
69
  segments:
69
70
  - 0
70
- hash: 1373212328217276062
71
+ hash: -451430194701671382
71
72
  requirements: []
72
73
  rubyforge_project:
73
74
  rubygems_version: 1.8.24