social_colors_rails 0.1.1 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3352a97d6f39b765d8371dde1f47ad40389ddea9
4
- data.tar.gz: f2a9695c95d127e9cc9c0281bcc8efaf6a209bfd
3
+ metadata.gz: 304196c6ade3cbae7f4c750c9b8d33e5bc283ef6
4
+ data.tar.gz: e7ced69b9854874276501d3dbe518748b29194fe
5
5
  SHA512:
6
- metadata.gz: 03f2a5b6ad78b06b9ec0d28468f36a28fb0ea0e98d3935e42a5e7b13801e6bd690d2d30c9c343aa4525a2028407a03462073a933ecd83e01130144bdea6d3537
7
- data.tar.gz: 3ffabc89d434a4164679072c554a208e4ec1f79bc50c2e87580a70f3119c40160911dbd0c0671d8c054defcea5a462ca892e80a0291d7851d77989cf9d2cfdaf
6
+ metadata.gz: 119c38d405b963af0f99e86912e87966dacb6d65cec1ab81acc20f8d40625e6c1a273466922f999099047ce3ced53c3f2b7e73b09f25d4ed61621b14eb938d20
7
+ data.tar.gz: 839536b8bd2124aa75a983251bc7d81d7fdfd6eb91221cd82a095901f2e9c42355d91d7a4b77ed522af04033d0a2ea020289b6e1be22185bb24726cf906a50b8
data/README.md CHANGED
@@ -37,7 +37,7 @@ You can customize the social_colors rails plugin by importing the sass file and
37
37
  // Import your custom variables before the social_colors lib
38
38
  @import "_custom_variables";
39
39
 
40
- @import 'font-awesome";
40
+ @import "font-awesome";
41
41
  @import "social_colors_rails/init";
42
42
  ```
43
43
 
@@ -48,6 +48,16 @@ You can customize the social_colors rails plugin by importing the sass file and
48
48
  The prefered method is to use the `social_tag` helper
49
49
  ```ruby
50
50
 
51
+ social_tag
52
+ # => <a class="icon-stack stack-circle facebook" target="_blank" rel="external nofollow" href="#">
53
+ # <i class="fa fa-facebook"></i>
54
+ # </a>
55
+
56
+ social_tag url: "https://www.facebook.com/devsbrain/"
57
+ # => <a class="icon-stack stack-square facebook" target="_blank" rel="external nofollow" href="https://www.facebook.com/devsbrain/">
58
+ # <i class="fa fa-facebook"></i>
59
+ # </a>
60
+
51
61
  social_tag "github", "https://github.com/TimVille"
52
62
  # => <a class="icon-stack stack-circle github" target="_blank" rel="external nofollow" href="https://github.com/TimVille">
53
63
  # <i class="fa fa-github"></i>
@@ -63,13 +73,18 @@ social_tag "github", "https://github.com/TimVille", size: "2x"
63
73
  # <i class="fa fa-github"></i>
64
74
  # </a>
65
75
 
66
- social_tag "github", "https://github.com/TimVille", style: "square-o", size: "3x"
67
- # => <a class="icon-stack stack-square-o github stack-3x" target="_blank" rel="external nofollow" href="https://github.com/TimVille">
76
+ social_tag "github", "https://github.com/TimVille", title: "My awesome link title"
77
+ # => <a class="icon-stack stack-circle github" target="_blank" rel="external nofollow" title="My awesome link title" href="https://github.com/TimVille">
78
+ # <i class="fa fa-github"></i>
79
+ # </a>
80
+
81
+ social_tag "github", "https://github.com/TimVille", nofollow: false
82
+ # => <a class="icon-stack stack-circle github" target="_blank" rel="external" href="https://github.com/TimVille">
68
83
  # <i class="fa fa-github"></i>
69
84
  # </a>
70
85
 
71
- social_tag "github", "https://github.com/TimVille", size: "3x", title: "My awesome link title"
72
- # => <a class="icon-stack stack-square-o github stack-3x" target="_blank" rel="external nofollow" title="My awesome link title" href="https://github.com/TimVille">
86
+ social_tag "github", "https://github.com/TimVille", external: false
87
+ # => <a class="icon-stack stack-circle github" target="_blank" href="https://github.com/TimVille">
73
88
  # <i class="fa fa-github"></i>
74
89
  # </a>
75
90
  ```
@@ -1,5 +1,6 @@
1
1
  module SocialColorsRails
2
2
  module ApplicationHelper
3
+ include ::FontAwesome::Rails::IconHelper
3
4
  ###
4
5
  #
5
6
  # Create social link tag given name, url and possible title, style, size and nofollow modifiers.
@@ -43,17 +44,26 @@ module SocialColorsRails
43
44
  #
44
45
  ###
45
46
 
46
- def social_tag(name = "facebook", url = "#", title: nil, style: "circle", size: nil, nofollow: true)
47
+ def social_tag(name = "facebook", href = "#", url: nil, title: nil, style: "circle", size: nil, external: true, nofollow: true)
47
48
  classes = "icon-stack stack-#{style} #{name}" + (size.nil? ? "" : " stack-#{size}")
49
+ location = href
48
50
  options = {
49
51
  class: classes,
50
52
  target: "_blank",
51
- rel: "external" + (nofollow ? " nofollow" : "")
52
53
  }
54
+
55
+ if !url.nil?
56
+ location = url
57
+ end
58
+
59
+ if external
60
+ options[:rel] = "external" + (nofollow ? " nofollow" : "")
61
+ end
62
+
53
63
  if !title.nil?
54
64
  options[:title] = title
55
65
  end
56
- html = link_to(fa_icon(name), url, options)
66
+ html = link_to(fa_icon(name), location, options)
57
67
  html
58
68
  end
59
69
  end
@@ -1,3 +1,5 @@
1
+ require "font-awesome-rails"
2
+
1
3
  module SocialColorsRails
2
4
  class Engine < ::Rails::Engine
3
5
  isolate_namespace SocialColorsRails
@@ -1,3 +1,3 @@
1
1
  module SocialColorsRails
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_colors_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timothée Ville
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec-html-matchers
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: sqlite3
57
85
  requirement: !ruby/object:Gem::Requirement