pin_it 0.0.5 → 0.0.6
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.
- data/README.md +9 -0
- data/lib/pin_it.rb +2 -1
- data/lib/pin_it/version.rb +1 -1
- data/spec/pin_it_spec.rb +15 -3
- metadata +14 -8
data/README.md
CHANGED
@@ -37,6 +37,15 @@ Then, in your views, do something like this:
|
|
37
37
|
:description => @photo.description,
|
38
38
|
:url => photo_url(@photo) %>
|
39
39
|
|
40
|
+
The button defaults to the horizontal layout, to specify an alternative version just pass through `count_layout` like so:
|
41
|
+
|
42
|
+
<%= pin_it_button :media => image_url(@photo.url),
|
43
|
+
:description => @photo.description,
|
44
|
+
:url => photo_url(@photo),
|
45
|
+
:count_layout => 'vertical' %>
|
46
|
+
|
47
|
+
The current available options are `vertical` `horizontal` and `none`
|
48
|
+
|
40
49
|
### Rails > 3.1
|
41
50
|
|
42
51
|
After adding the gem to your Rails app and running the bundle command,
|
data/lib/pin_it.rb
CHANGED
@@ -10,10 +10,11 @@ module PinIt
|
|
10
10
|
def pin_it_button(options = {})
|
11
11
|
%{<a href="http://pinterest.com/pin/create/button/?url=page_url&media=img_url&description=description" class="pin-it-button" count-layout="horizontal">Pin It</a>}
|
12
12
|
query_params = options.slice(:url, :media, :description)
|
13
|
+
layout_params = options[:count_layout]
|
13
14
|
img = tag :img, :src => "//assets.pinterest.com/images/PinExt.png", :title => "Pin It", :border => "0"
|
14
15
|
content_tag :a, img, "href" => "http://pinterest.com/pin/create/button/?#{query_params.to_query}",
|
15
16
|
"class" => "pin-it-button",
|
16
|
-
"count-layout" => "horizontal"
|
17
|
+
"count-layout" => layout_params || "horizontal"
|
17
18
|
end
|
18
19
|
|
19
20
|
def pin_it_js
|
data/lib/pin_it/version.rb
CHANGED
data/spec/pin_it_spec.rb
CHANGED
@@ -14,11 +14,23 @@ describe PinIt::Helper do
|
|
14
14
|
@view.should respond_to(:pin_it_button)
|
15
15
|
end
|
16
16
|
|
17
|
-
it "should return a pin it button" do
|
17
|
+
it "should return a pin it button with horizontal count layout(default)" do
|
18
18
|
expected = %{<a href="http://pinterest.com/pin/create/button/?url=page_url&media=img_url&description=description" class="pin-it-button" count-layout="horizontal">Pin It</a>}
|
19
|
-
|
20
19
|
@view.pin_it_button(url:"page_url", media: "img_url", description: "description").should_not be_nil
|
20
|
+
@view.pin_it_button(url:"page_url", media: "img_url", description: "description").should match('count-layout="horizontal"')
|
21
21
|
end
|
22
|
+
|
23
|
+
it "should return a pin it button with vertical count layout" do
|
24
|
+
expected = %{<a href="http://pinterest.com/pin/create/button/?url=page_url&media=img_url&description=description" class="pin-it-button" count-layout="vertical">Pin It</a>}
|
25
|
+
@view.pin_it_button(url:"page_url", media: "img_url", description: "description", count_layout: 'vertical').should_not be_nil
|
26
|
+
@view.pin_it_button(url:"page_url", media: "img_url", description: "description", count_layout: 'vertical').should match('count-layout="vertical"')
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should return a pin it button with no count layout" do
|
30
|
+
expected = %{<a href="http://pinterest.com/pin/create/button/?url=page_url&media=img_url&description=description" class="pin-it-button" count-layout="none">Pin It</a>}
|
31
|
+
@view.pin_it_button(url:"page_url", media: "img_url", description: "description", count_layout: 'none').should_not be_nil
|
32
|
+
@view.pin_it_button(url:"page_url", media: "img_url", description: "description", count_layout: 'none').should match('count-layout="none"')
|
33
|
+
end
|
34
|
+
|
22
35
|
end
|
23
36
|
end
|
24
|
-
|
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.
|
4
|
+
version: 0.0.6
|
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-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70266961317820 !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: *
|
24
|
+
version_requirements: *70266961317820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70266961316780 !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: *
|
35
|
+
version_requirements: *70266961316780
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70266961314860 !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: *
|
46
|
+
version_requirements: *70266961314860
|
47
47
|
description: Rails helpers for adding Pinterest.com "Pin It" buttons to views
|
48
48
|
email:
|
49
49
|
- joshua@fanzter.com
|
@@ -75,12 +75,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
hash: 4450300412736373687
|
78
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
82
|
none: false
|
80
83
|
requirements:
|
81
84
|
- - ! '>='
|
82
85
|
- !ruby/object:Gem::Version
|
83
86
|
version: '0'
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
hash: 4450300412736373687
|
84
90
|
requirements: []
|
85
91
|
rubyforge_project:
|
86
92
|
rubygems_version: 1.8.15
|