share 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0e608c158017b4bc932c619239600eb771a8048
4
- data.tar.gz: f5ec77370f02e14e35c14801cea379e8b7034aff
3
+ metadata.gz: 0374ee25c1a3139f90a10af8a2be39cb8836ecc1
4
+ data.tar.gz: 22185cb1787d729a44ad69a1d06564c57143dd6c
5
5
  SHA512:
6
- metadata.gz: a6962a9b6ecf61230cf3e9e0505bf0f8c2ef259c114c298ede8ecbb738da4d427c436f8ed749e051db1ac4a1905eb6b354d5ce09b1256b83e7d1ca483a133aff
7
- data.tar.gz: d01132fcbd1a2de9022fd4930c25b65494dbfe8d28b2d7bd509c07dd9e02c445db45df16fca9875779466c4aadc486cab794bb6a73878ac80b77150a9428728a
6
+ metadata.gz: c88a11fa3892e5db4bac029a3b72c0f3a1e8b9200135f41225d013dccbbeebd2efa937769cfe5c2e604c8e7d9ff06f5ce16cb4e2f715a987054a6026d2e8f0a0
7
+ data.tar.gz: e67a80cc49097c13c38c3c37e42ebbfcc75debc0d3dedbd0633aa9838386b7fa770f884a8be7d45560ce80aa1df5ce135377027f09872e1d6d1ce05b934409d7
@@ -1,16 +1,25 @@
1
1
  module Share
2
2
  module Helpers
3
- def share_links text
3
+ def share_links options_or_text
4
4
  url = request.url
5
+ text = options_or_text.is_a?(Hash) ? options_or_text[:tweet] : options_or_text
5
6
  content_tag :ul, :class => "share-container" do |content|
6
- { :twitter => "http://twitter.com/intent/tweet?&text=" + URI.encode("#{text} #{url}"),
7
- :facebook => "http://facebook.com/sharer.php?u=#{url}",
8
- "google-plus" => "https://plus.google.com/share?url=#{url}"}.map do |key, value|
7
+ lis = { :twitter => "http://twitter.com/intent/tweet?&text=" + URI.encode("#{text} #{url}"),
8
+ :facebook => "http://facebook.com/sharer.php?u=#{url}",
9
+ "google-plus" => "https://plus.google.com/share?url=#{url}"}.map do |key, value|
9
10
  content_tag(:li,
10
11
  link_to("<i class=\"icon-fa-social icon-#{key}\"></i>".html_safe, value, :title => "Share on #{key.to_s.humanize}", :class => "share-link #{key}",
11
12
  "onclick" => "javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;"
12
13
  ), :class => "share-item")
13
- end.join.html_safe
14
+ end
15
+ if options_or_text.is_a?(Hash) && options_or_text[:email].present?
16
+ body = options_or_text[:email][:body].gsub("{{url}}", request.url)
17
+ target = "mailto:?subject=#{options_or_text[:email][:subject]}&body=#{body}"
18
+ lis << content_tag(:li,
19
+ link_to("<i class=\"icon-fa-social icon-envelope\"></i>".html_safe, target, :title => "Share with email", :class => "share-link email",
20
+ ), :class => "share-item")
21
+ end
22
+ lis.join.html_safe
14
23
  end
15
24
  end
16
25
  end
@@ -1,3 +1,3 @@
1
1
  module Share
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: share
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samer Buna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-04 00:00:00.000000000 Z
11
+ date: 2013-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -31,25 +31,13 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - app/assets/stylesheets/share/style.css.scss.erb
34
35
  - config/routes.rb
35
36
  - lib/share.rb
36
37
  - lib/tasks/share_tasks.rake
37
38
  - lib/share/version.rb
38
39
  - lib/share/engine.rb
39
40
  - lib/share/helpers.rb
40
- - lib/assets/images/share/picasa.png
41
- - lib/assets/images/share/rss.png
42
- - lib/assets/images/share/tumblr.png
43
- - lib/assets/images/share/facebook.png
44
- - lib/assets/images/share/flickr.png
45
- - lib/assets/images/share/googleplus.png
46
- - lib/assets/images/share/linkedin.png
47
- - lib/assets/images/share/pinterest.png
48
- - lib/assets/images/share/twitter.png
49
- - lib/assets/images/share/yahoo.png
50
- - lib/assets/images/share/youtube.png
51
- - lib/assets/stylesheets/share/icons.css.scss.erb
52
- - lib/assets/stylesheets/share/style.css.scss.erb
53
41
  - MIT-LICENSE
54
42
  - Rakefile
55
43
  - README.md
@@ -1,22 +0,0 @@
1
- .share-container {
2
- list-style: none;
3
- padding: 0;
4
- a {
5
- display: inline-block;
6
- height: 32px;
7
- width: 32px;
8
- }
9
- .share-item {
10
- display: inline;
11
- padding: 0.4em;
12
- }
13
- a.twitter {
14
- background: url('<%= image_path "share/twitter.png" %>') no-repeat;
15
- }
16
- a.facebook {
17
- background: url('<%= image_path "share/facebook.png" %>') no-repeat;
18
- }
19
- a.google {
20
- background: url('<%= image_path "share/googleplus.png" %>') no-repeat;
21
- }
22
- }