pin_it 0.0.1 → 0.0.2

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.
Files changed (4) hide show
  1. data/README.md +23 -2
  2. data/lib/pin_it.rb +18 -6
  3. data/lib/pin_it/version.rb +1 -1
  4. metadata +7 -7
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # PinIt
2
2
 
3
- TODO: Write a gem description
3
+ This gem is a Rails plugin for adding a Pinterest.com "Pin It" button
4
+ to your views.
5
+
6
+ Pinterest's [“Pin It” Button for Websites](http://pinterest.com/about/goodies/#button_for_websites) page.
7
+
8
+ NOTE: This gem's authors are not in any way affiliated with Pinterest.
4
9
 
5
10
  ## Installation
6
11
 
@@ -16,7 +21,23 @@ Or install it yourself as:
16
21
 
17
22
  $ gem install pin_it
18
23
 
19
- ## Usage
24
+ ## Usage
25
+
26
+ ### Rails 2.3.11-ish
27
+
28
+ After adding the gem to your Rails app and running the bundle command,
29
+ you need to add this line to get the small JavaScript component included.
30
+ In your application layout, include this:
31
+
32
+ <%= javascript_tag pin_it_js %>
33
+
34
+ Then, in your views, do something like this:
35
+
36
+ <%= pin_it_button :media => image_url(@photo.url)
37
+ :description => @photo.description,
38
+ :url => photo_url(@photo) %>
39
+
40
+ ### Rails > 3.1
20
41
 
21
42
  After adding the gem to your Rails app and running the bundle command,
22
43
  you need to add this line to get the small JavaScript component included.
data/lib/pin_it.rb CHANGED
@@ -1,5 +1,9 @@
1
1
  require "pin_it/version"
2
- require "active_support/core_ext/object/to_query"
2
+ begin
3
+ require "active_support/core_ext/object/to_query"
4
+ rescue LoadError
5
+ require "active_support/core_ext/object/conversions"
6
+ end
3
7
 
4
8
  module PinIt
5
9
  module Helper
@@ -10,16 +14,24 @@ module PinIt
10
14
  "class" => "pin-it-button",
11
15
  "count-layout" => "horizontal"
12
16
  end
17
+
18
+ def pin_it_js
19
+ IO.read(File.expand_path("../../vendor/assets/javascripts/pin_it.js", __FILE__))
20
+ end
13
21
  end
14
22
 
15
- class Railtie < ::Rails::Railtie
16
- initializer "pin_it.view_helpers" do |app|
17
- ::ActionView::Base.send :include, PinIt::Helper
23
+ if defined? ::Rails::Railtie
24
+ class Railtie < ::Rails::Railtie
25
+ initializer "pin_it.view_helpers" do |app|
26
+ ::ActionView::Base.send :include, PinIt::Helper
27
+ end
18
28
  end
19
29
  end
20
30
 
21
- module Rails
22
- class Engine < ::Rails::Engine
31
+ if defined? ::Rails::Engine
32
+ module Rails
33
+ class Engine < ::Rails::Engine
34
+ end
23
35
  end
24
36
  end
25
37
  end
@@ -1,3 +1,3 @@
1
1
  module PinIt
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pin_it
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:
@@ -13,7 +13,7 @@ date: 2012-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70211000659920 !ruby/object:Gem::Requirement
16
+ requirement: &70302918933660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70211000659920
24
+ version_requirements: *70302918933660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70211000659180 !ruby/object:Gem::Requirement
27
+ requirement: &70302918933080 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70211000659180
35
+ version_requirements: *70302918933080
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70211000658520 !ruby/object:Gem::Requirement
38
+ requirement: &70302918932300 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70211000658520
46
+ version_requirements: *70302918932300
47
47
  description: Rails helpers for adding Pinterest.com "Pin It" buttons to views
48
48
  email:
49
49
  - joshua@fanzter.com