shareable 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.
- data/.gitignore +6 -0
- data/README.md +3 -4
- data/lib/generators/shareable/config_generator.rb +16 -0
- data/lib/generators/shareable/templates/shareable_config.rb +70 -0
- data/lib/shareable/version.rb +1 -1
- data/shareable.gemspec +29 -0
- metadata +131 -120
- data/README.rdoc +0 -74
data/.gitignore
ADDED
data/README.md
CHANGED
@@ -6,7 +6,7 @@ A simple and unobtrusive gem for adding social link sharing to your Rails app. S
|
|
6
6
|
- Pinterest
|
7
7
|
- Reddit
|
8
8
|
- Linkedin
|
9
|
-
-
|
9
|
+
- Google Plus
|
10
10
|
|
11
11
|
Install
|
12
12
|
--------
|
@@ -26,9 +26,9 @@ To add shareable in views use any of the following methods:
|
|
26
26
|
+ facebook_button
|
27
27
|
+ twitter_button
|
28
28
|
+ pinterest_button
|
29
|
+
+ linkedin_button
|
29
30
|
+ reddit_button
|
30
31
|
+ google_plus_button
|
31
|
-
...
|
32
32
|
|
33
33
|
For the easiest way to use shareable, add this helper method to your view:
|
34
34
|
|
@@ -97,6 +97,5 @@ To Do:
|
|
97
97
|
---------
|
98
98
|
- Add Tests.
|
99
99
|
- More buttons.
|
100
|
-
- More.
|
101
100
|
|
102
|
-
This project is based on Akira Matsuda's
|
101
|
+
This project is based on Akira Matsuda's Kaminari project and uses the MIT-LICENSE. Suggestions, bug reports, criticism and all contributions welcome.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Shareable
|
2
|
+
module Generators
|
3
|
+
class ConfigGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
5
|
+
|
6
|
+
desc <<DESC
|
7
|
+
Description:
|
8
|
+
Copies Shareable configuration file to your application's initializer directory.
|
9
|
+
DESC
|
10
|
+
|
11
|
+
def copy_config_file
|
12
|
+
template 'shareable_config.rb', 'config/initializers/shareable.rb'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
Shareable.configure do |config|
|
2
|
+
#config.names = %w[ twitter facebook linkedin pinterest google_plus reddit ]
|
3
|
+
|
4
|
+
##############
|
5
|
+
#facebook
|
6
|
+
##############
|
7
|
+
#config.app_id=''
|
8
|
+
#config.send= 'false'
|
9
|
+
#config.layout=''
|
10
|
+
#config.show_faces=''
|
11
|
+
#config.width='80'
|
12
|
+
#config.action=''
|
13
|
+
#config.font=''
|
14
|
+
#config.colorscheme=''
|
15
|
+
#config.ref=''
|
16
|
+
|
17
|
+
##############
|
18
|
+
#google_plus
|
19
|
+
##############
|
20
|
+
#config.annotation='bubble'
|
21
|
+
#config.align=''
|
22
|
+
#config.expand_to=''
|
23
|
+
#config.callback=''
|
24
|
+
#config.onstartinteraction=''
|
25
|
+
#config.onendinteraction=''
|
26
|
+
#config.recommendations='false'
|
27
|
+
|
28
|
+
##############
|
29
|
+
#linkedin
|
30
|
+
##############
|
31
|
+
#config.counter = 'right'
|
32
|
+
#config.onsuccess = ''
|
33
|
+
#config.onerror = ''
|
34
|
+
#config.showzero = 'true'
|
35
|
+
|
36
|
+
##############
|
37
|
+
#pinterest
|
38
|
+
##############
|
39
|
+
#config.pin_config = 'none'
|
40
|
+
#config.pin_do = 'buttonPin'
|
41
|
+
#config.title= '' # title for content, also used by reddit button
|
42
|
+
#config.alt='' # alternate text for image tag
|
43
|
+
#config.media=''
|
44
|
+
#config.description='Pin This'
|
45
|
+
|
46
|
+
##############
|
47
|
+
#reddit
|
48
|
+
##############
|
49
|
+
#config.target=''
|
50
|
+
#config.color=''
|
51
|
+
#config.bordercolor=''
|
52
|
+
#config.styled='off'
|
53
|
+
#config.newwindow='1'
|
54
|
+
#config.btnsrc='' # alternate reddit button url, eg: 'http://www.reddit.com/buttonlite.js?i=1'
|
55
|
+
#config.type= '1' # button type, eg: 1 to n
|
56
|
+
#config.points = '1' # points style, eg: 0 to 5
|
57
|
+
|
58
|
+
##############
|
59
|
+
#twitter
|
60
|
+
##############
|
61
|
+
#config.via='tweetbutton'
|
62
|
+
#config.text=''
|
63
|
+
#config.related=''
|
64
|
+
#config.count='horizontal'
|
65
|
+
#config.lang='en'
|
66
|
+
#config.counturl=''
|
67
|
+
#config.hashtags=''
|
68
|
+
#config.size='medium'
|
69
|
+
#config.dnt=''
|
70
|
+
end
|
data/lib/shareable/version.rb
CHANGED
data/shareable.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "shareable/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "shareable"
|
9
|
+
s.version = Shareable::VERSION
|
10
|
+
s.authors = ["Hermango"]
|
11
|
+
s.homepage = "http://github.com/hermango/shareable"
|
12
|
+
s.summary = "Simple and unobtrusive gem for adding social links to your Rails app."
|
13
|
+
s.description = "Add social sharing links to a view in your Rails app with one method call. The configuration options for each social link are customizable. Please see read me doc for more details."
|
14
|
+
s.require_paths = ['lib']
|
15
|
+
s.licenses = ['MIT']
|
16
|
+
s.files = `git ls-files`.split($/)
|
17
|
+
|
18
|
+
#s.test_files = Dir["test/**/*"]
|
19
|
+
|
20
|
+
s.add_dependency 'activesupport', ['>= 3.0.0']
|
21
|
+
s.add_dependency 'actionpack', ['>= 3.0.0']
|
22
|
+
|
23
|
+
s.add_development_dependency 'bundler', ['>= 1.0.0']
|
24
|
+
s.add_development_dependency 'tzinfo', ['>= 0']
|
25
|
+
s.add_development_dependency 'rspec', ['>= 0']
|
26
|
+
s.add_development_dependency 'rr', ['>= 0']
|
27
|
+
s.add_development_dependency 'capybara', ['>= 1.0']
|
28
|
+
|
29
|
+
end
|
metadata
CHANGED
@@ -1,122 +1,140 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: shareable
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
version: 0.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Hermango
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-03-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: activesupport
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 3
|
29
|
-
- 0
|
30
|
-
- 0
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
31
21
|
version: 3.0.0
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: actionpack
|
36
23
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: actionpack
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
45
37
|
version: 3.0.0
|
46
38
|
type: :runtime
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: bundler
|
50
39
|
prerelease: false
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.0.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
59
53
|
version: 1.0.0
|
60
54
|
type: :development
|
61
|
-
version_requirements: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: tzinfo
|
64
55
|
prerelease: false
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: tzinfo
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
72
70
|
type: :development
|
73
|
-
version_requirements: *id004
|
74
|
-
- !ruby/object:Gem::Dependency
|
75
|
-
name: rspec
|
76
71
|
prerelease: false
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
84
86
|
type: :development
|
85
|
-
version_requirements: *id005
|
86
|
-
- !ruby/object:Gem::Dependency
|
87
|
-
name: rr
|
88
87
|
prerelease: false
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rr
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
96
102
|
type: :development
|
97
|
-
version_requirements: *id006
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: capybara
|
100
103
|
prerelease: false
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: capybara
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.0'
|
109
118
|
type: :development
|
110
|
-
|
111
|
-
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '1.0'
|
126
|
+
description: Add social sharing links to a view in your Rails app with one method
|
127
|
+
call. The configuration options for each social link are customizable. Please see
|
128
|
+
read me doc for more details.
|
112
129
|
email:
|
113
130
|
executables: []
|
114
|
-
|
115
131
|
extensions: []
|
116
|
-
|
117
132
|
extra_rdoc_files: []
|
118
|
-
|
119
|
-
|
133
|
+
files:
|
134
|
+
- .gitignore
|
135
|
+
- Gemfile
|
136
|
+
- MIT-LICENSE
|
137
|
+
- README.md
|
120
138
|
- app/views/shareable/_facebook.html.erb
|
121
139
|
- app/views/shareable/_google_plus.html.erb
|
122
140
|
- app/views/shareable/_linkedin.html.erb
|
@@ -124,48 +142,41 @@ files:
|
|
124
142
|
- app/views/shareable/_reddit.html.erb
|
125
143
|
- app/views/shareable/_social_buttons.html.erb
|
126
144
|
- app/views/shareable/_twitter.html.erb
|
145
|
+
- lib/generators/shareable/config_generator.rb
|
146
|
+
- lib/generators/shareable/templates/shareable_config.rb
|
147
|
+
- lib/shareable.rb
|
148
|
+
- lib/shareable/config.rb
|
149
|
+
- lib/shareable/engine.rb
|
127
150
|
- lib/shareable/helpers/action_view_extension.rb
|
128
151
|
- lib/shareable/helpers/social_buttons.rb
|
129
152
|
- lib/shareable/helpers/tags.rb
|
130
|
-
- lib/shareable/config.rb
|
131
|
-
- lib/shareable/engine.rb
|
132
153
|
- lib/shareable/hooks.rb
|
133
154
|
- lib/shareable/railtie.rb
|
134
155
|
- lib/shareable/version.rb
|
135
|
-
-
|
136
|
-
- MIT-LICENSE
|
137
|
-
- Gemfile
|
138
|
-
- README.rdoc
|
139
|
-
- README.md
|
140
|
-
has_rdoc: true
|
156
|
+
- shareable.gemspec
|
141
157
|
homepage: http://github.com/hermango/shareable
|
142
|
-
licenses:
|
158
|
+
licenses:
|
143
159
|
- MIT
|
144
160
|
post_install_message:
|
145
161
|
rdoc_options: []
|
146
|
-
|
147
|
-
require_paths:
|
162
|
+
require_paths:
|
148
163
|
- lib
|
149
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
requirements:
|
158
|
-
- -
|
159
|
-
- !ruby/object:Gem::Version
|
160
|
-
|
161
|
-
- 0
|
162
|
-
version: "0"
|
164
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
+
none: false
|
166
|
+
requirements:
|
167
|
+
- - ! '>='
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
163
176
|
requirements: []
|
164
|
-
|
165
177
|
rubyforge_project:
|
166
|
-
rubygems_version: 1.
|
178
|
+
rubygems_version: 1.8.24
|
167
179
|
signing_key:
|
168
180
|
specification_version: 3
|
169
181
|
summary: Simple and unobtrusive gem for adding social links to your Rails app.
|
170
182
|
test_files: []
|
171
|
-
|
data/README.rdoc
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
= Shareable
|
2
|
-
A simple and unobtrusive gem for adding social link sharing to your Rails app. Social sites include:
|
3
|
-
- Facebook
|
4
|
-
- Twitter
|
5
|
-
- Pinterest
|
6
|
-
- Reddit
|
7
|
-
- & Google Plus
|
8
|
-
|
9
|
-
===Install
|
10
|
-
Put this line in your Gemfile:
|
11
|
-
gem 'shareable'
|
12
|
-
|
13
|
-
Then run bundle command:
|
14
|
-
bundle
|
15
|
-
|
16
|
-
==Usage
|
17
|
-
=== Views
|
18
|
-
To use shareable in views add any of the following methods:
|
19
|
-
-render_shareable
|
20
|
-
-facebook_button
|
21
|
-
-twitter_button
|
22
|
-
-pinterest_button
|
23
|
-
-reddit_button
|
24
|
-
-google_plus_button
|
25
|
-
...
|
26
|
-
|
27
|
-
For example, add the helper method to your view:
|
28
|
-
<%= render_shareable %>
|
29
|
-
|
30
|
-
===Advanced Usage
|
31
|
-
Overwrite options locally by passing hash values to the render_shareable method like so:
|
32
|
-
<%= render_shareable :url=> 'http://github.com/hermango/', :facebook=> {:send=> 'true', :width=> '100', :url=> 'http://demo.com'} %>
|
33
|
-
To render only certain buttons:
|
34
|
-
<%= render_shareable :buttons=> ['twitter', 'facebook'] %>
|
35
|
-
|
36
|
-
Alternatively, omit the render_shareable method entirely and instead add each social link individually.
|
37
|
-
The helper method for each social link, is the site name joined with an underscore to the word 'button'. E.g.:
|
38
|
-
<%= twitter_button %>
|
39
|
-
<%= reddit_button :title=> 'Alternate Title' %>
|
40
|
-
|
41
|
-
To override the default view for a button, place your own template file in the
|
42
|
-
app/views/shareable/ directory and prepend your filename with an underscore.
|
43
|
-
E.g.: facebook_button -> *app/views/shareable/_facebook.html.erb*
|
44
|
-
|
45
|
-
*Facebook compatibility with Internet Explorer*
|
46
|
-
Add an XML namespace fb="http://ogp.me/ns/fb#" to the <html> tag of your view. Eg: <html xmlns:fb="http://ogp.me/ns/fb#">
|
47
|
-
This is necessary for XFBML to work in earlier versions of Internet Explorer for pages on which the like button appears.
|
48
|
-
|
49
|
-
*Styling for social buttons*
|
50
|
-
For horizontally aligned buttons, try this CSS:
|
51
|
-
nav.share {display:inline-block;} /* shareable's nav tag */
|
52
|
-
nav.share div {float:left; overflow:hidden;}
|
53
|
-
nav.share iframe {max-height:20px; border:0; margin-top:0; padding-top:0;} /* if using medium sized buttons */
|
54
|
-
#___plusone_0 {max-width:70px; font-size: default; !important}
|
55
|
-
.twitter-share-button, .twitter-count-horizontal {max-width:80px;}
|
56
|
-
.fb_iframe_widget span { vertical-align: top; }
|
57
|
-
.fb_edge_widget_with_comment { vertical-align: top;}
|
58
|
-
.fb-like{display:inline-block}
|
59
|
-
* html .fb-like{display:inline}/* ie6 inline block fix*/
|
60
|
-
*+html .fb-like{display:inline}/* ie7 inline block fix*/
|
61
|
-
|
62
|
-
===Configuration
|
63
|
-
Use shareable's configuration settings or add your own initializer named 'shareable.rb' to the 'config/initializers' directory.
|
64
|
-
|
65
|
-
A generator is available for generating the default configuration file into the 'config/initializers' directory.
|
66
|
-
Run the following generator command, then edit the generated file.
|
67
|
-
% rails g shareable:config
|
68
|
-
|
69
|
-
==To Do:
|
70
|
-
- Add Tests.
|
71
|
-
- More buttons.
|
72
|
-
- More.
|
73
|
-
|
74
|
-
This project is based on Akira Matsuda's Kamanari project and uses the MIT-LICENSE. Suggestions, bug reports, criticism and all contributions welcome.
|