sociality 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,107 @@
1
+ /*======================= NEW ICONS, NEW STYLES ==================================*/
2
+ /* --------------- TWITTER */
3
+
4
+ .social-share-button-twitter {
5
+ display: inline-block;
6
+ position: relative;
7
+ text-indent: -9999px;
8
+ width: 30px;
9
+ height: 30px;
10
+ background:url(icons/social_icons_transp.svg) no-repeat;
11
+ }
12
+
13
+ .social-share-button-twitter span {
14
+ position: absolute;
15
+ top: 0; left: 0; bottom: 0; right: 0;
16
+ background:url(icons/social_icons_transp.svg) no-repeat;
17
+ background-position: -30px 0;
18
+ opacity: 0;
19
+ -webkit-transition: opacity 0.5s;
20
+ -moz-transition: opacity 0.5s;
21
+ -o-transition: opacity 0.5s;
22
+ }
23
+
24
+ .social-share-button-twitter:hover span {
25
+ opacity: 1;
26
+ }
27
+
28
+ /* --------------- Facebook */
29
+
30
+ .social-share-button-facebook {
31
+ display: inline-block;
32
+ position: relative;
33
+ text-indent: -9999px;
34
+ width: 30px;
35
+ height: 30px;
36
+ background:url(icons/social_icons_transp.svg) no-repeat;
37
+ background-position:0 -180px;
38
+ }
39
+
40
+ .social-share-button-facebook span {
41
+ position: absolute;
42
+ top: 0; left: 0; bottom: 0; right: 0;
43
+ background:url(icons/social_icons_transp.svg) no-repeat;
44
+ background-position: -30px -180px;
45
+ opacity: 0;
46
+ -webkit-transition: opacity 0.5s;
47
+ -moz-transition: opacity 0.5s;
48
+ -o-transition: opacity 0.5s;
49
+ }
50
+
51
+ .social-share-button-facebook:hover span {
52
+ opacity: 1;
53
+ }
54
+
55
+ /* --------------- Google plus */
56
+
57
+ .social-share-button-google_plus{
58
+ display: inline-block;
59
+ position: relative;
60
+ text-indent: -9999px;
61
+ width: 30px;
62
+ height: 30px;
63
+ background:url(icons/social_icons_transp.svg) no-repeat;
64
+ background-position:0 -270px;
65
+ }
66
+
67
+ .social-share-button-google_plus span {
68
+ position: absolute;
69
+ top: 0; left: 0; bottom: 0; right: 0;
70
+ background:url(icons/social_icons_transp.svg) no-repeat;
71
+ background-position: -30px -270px;
72
+ opacity: 0;
73
+ -webkit-transition: opacity 0.5s;
74
+ -moz-transition: opacity 0.5s;
75
+ -o-transition: opacity 0.5s;
76
+ }
77
+
78
+ .social-share-button-google_plus:hover span {
79
+ opacity: 1;
80
+ }
81
+
82
+ /* --------------- LINKEDIN */
83
+
84
+ .social-share-button-linkedin {
85
+ display: inline-block;
86
+ position: relative;
87
+ text-indent: -9999px;
88
+ width: 30px;
89
+ height: 30px;
90
+ background:url(icons/social_icons_transp.svg) no-repeat;
91
+ background-position:0 -30px;
92
+ }
93
+
94
+ .social-share-button-linkedin span {
95
+ position: absolute;
96
+ top: 0; left: 0; bottom: 0; right: 0;
97
+ background:url(icons/social_icons_transp.svg) no-repeat;
98
+ background-position: -30px -30px;
99
+ opacity: 0;
100
+ -webkit-transition: opacity 0.5s;
101
+ -moz-transition: opacity 0.5s;
102
+ -o-transition: opacity 0.5s;
103
+ }
104
+
105
+ .social-share-button-linkedin:hover span {
106
+ opacity: 1;
107
+ }
@@ -0,0 +1,12 @@
1
+ module Sociality
2
+ module Generators
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+ desc "Copy Sociality default files"
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ def copy_config
8
+ directory 'config'
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ Sociality.configure do |config|
2
+ config.allow_sites = %w(twitter facebook google_plus linkedin)
3
+ end
@@ -0,0 +1,13 @@
1
+ en:
2
+ social_share_button:
3
+ share_to: Share to %{name}
4
+ twitter: Twitter
5
+ facebook: Facebook
6
+ delicious: Delicious
7
+ google_plus: Google+
8
+ linkedin: Linkedin
9
+ google_bookmark: Google Bookmark
10
+ tumblr: Tumblr
11
+ plurk: Plurk
12
+ pinterest: Pinterest
13
+ email: Email
@@ -0,0 +1,14 @@
1
+ module Sociality
2
+ class << self
3
+ attr_accessor :config
4
+ def configure
5
+ yield self.config ||= Config.new
6
+ end
7
+ end
8
+
9
+ class Config
10
+ attr_accessor :allow_sites
11
+ def initialize
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ # coding: utf-8
2
+ module Sociality
3
+ module Rails
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ module Sociality
3
+ module Helper
4
+ def social_share_button_tag(title = "", opts = {})
5
+ extra_data = {}
6
+ rel = opts[:rel]
7
+ html = []
8
+ html << "<div class='social-share-button' data-title='#{h title}' data-img='#{opts[:image]}'"
9
+ html << "data-url='#{opts[:url]}' data-desc='#{opts[:desc]}' data-popup='#{opts[:popup]}' data-via='#{opts[:via]}'>"
10
+
11
+ Sociality.config.allow_sites.each do |name|
12
+ extra_data = opts.select { |k, _| k.to_s.start_with?('data') } if name.eql?('tumblr')
13
+ special_data = opts.select { |k, _| k.to_s.start_with?('data-' + name) }
14
+
15
+ link_title = t "sociality.share_to", :name => t("sociality.#{name.downcase}")
16
+ html << link_to(content_tag(:span), "#", {:rel => ["nofollow", rel],
17
+ "data-site" => name,
18
+ :class => "social-share-button-#{name}",
19
+ :onclick => "return SocialShareButton.share(this);",
20
+ :title => h(link_title)}.merge(extra_data).merge(special_data)).html_safe
21
+ end
22
+ html << "</div>"
23
+ raw html.join("\n")
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module Sociality
2
+ VERSION = "0.0.1"
3
+ end
data/lib/sociality.rb ADDED
@@ -0,0 +1,13 @@
1
+ require "sociality/version"
2
+ require "sociality/config"
3
+ require "sociality/helper"
4
+
5
+ I18n.load_path += Dir.glob( File.dirname(__FILE__) + "lib/locales/*.{rb,yml}" )
6
+
7
+ module Sociality
8
+ module Rails
9
+ require "sociality/engine"
10
+ end
11
+ end
12
+
13
+ ActionView::Base.send :include, Sociality::Helper
data/sociality.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sociality/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sociality"
8
+ spec.version = Sociality::VERSION
9
+ spec.authors = ["Amirkhan Mullabaev"]
10
+ spec.email = ["a.mullabaev@gmail.com"]
11
+ spec.summary = ["Gem adds flat-designed buttons for sharing posts in social networks"]
12
+ spec.description = [""]
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sociality
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Amirkhan Mullabaev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: '[""]'
42
+ email:
43
+ - a.mullabaev@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".idea/.name"
50
+ - ".idea/.rakeTasks"
51
+ - ".idea/encodings.xml"
52
+ - ".idea/misc.xml"
53
+ - ".idea/modules.xml"
54
+ - ".idea/sociality.iml"
55
+ - ".idea/vcs.xml"
56
+ - ".idea/workspace.xml"
57
+ - Gemfile
58
+ - LICENSE.txt
59
+ - README.md
60
+ - README.md~
61
+ - Rakefile
62
+ - app/assets/javascripts/sociality.coffee
63
+ - app/assets/stylesheets/icons/social_icons_transp.svg
64
+ - app/assets/stylesheets/sociality.scss
65
+ - lib/generators/sociality/install_generator.rb
66
+ - lib/generators/sociality/templates/config/initializers/sociality.rb
67
+ - lib/generators/sociality/templates/config/locales/sociality.en.yml
68
+ - lib/sociality.rb
69
+ - lib/sociality/config.rb
70
+ - lib/sociality/engine.rb
71
+ - lib/sociality/helper.rb
72
+ - lib/sociality/version.rb
73
+ - sociality.gemspec
74
+ homepage: ''
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.3
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: '["Gem adds flat-designed buttons for sharing posts in social networks"]'
98
+ test_files: []