tarteaucitron 0.3.0 → 0.3.1

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.
@@ -1,3 +1,3 @@
1
1
  module Tarteaucitron
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -6,6 +6,7 @@ module Tarteaucitron
6
6
  ip = request.remote_ip
7
7
  if ["EU", "--"].include?(GeoIP.new(Rails.root.join('db', 'GeoIP.dat')).country(ip).continent_code)
8
8
  result += content_tag("script", '', src: "/tarteaucitron/tarteaucitron.js", type: "text/javascript")
9
+
9
10
  default = {
10
11
  "hashtag"=> "#tarteaucitron",
11
12
  "highPrivacy"=> false,
@@ -15,7 +16,14 @@ module Tarteaucitron
15
16
  "cookieslist"=> true,
16
17
  "removeCredit"=> false,
17
18
  }
18
- script = "tarteaucitron.init(#{default.to_json});"
19
+
20
+ init_options = default
21
+
22
+ if options["options"]
23
+ init_options = default.merge(options["options"].with_indifferent_access)
24
+ end
25
+
26
+ script = "tarteaucitron.init(#{init_options.to_json});"
19
27
  if options["google_analytics"]
20
28
  script += "tarteaucitron.user.gajsUa = '#{options["google_analytics"]}';"
21
29
  script += "tarteaucitron.user.gajsMore = function () {};"
@@ -25,11 +33,11 @@ module Tarteaucitron
25
33
  if options["facebook"]
26
34
  script += "(tarteaucitron.job = tarteaucitron.job || []).push('facebook');"
27
35
  end
28
-
36
+
29
37
  if options["googleplus"]
30
38
  script += "(tarteaucitron.job = tarteaucitron.job || []).push('gplus');"
31
39
  end
32
-
40
+
33
41
  if options["twitter"]
34
42
  script += "(tarteaucitron.job = tarteaucitron.job || []).push('twitter');"
35
43
  end
@@ -47,31 +55,38 @@ module Tarteaucitron
47
55
 
48
56
  content_tag(:div, '', class: "fb-like", data: options).html_safe
49
57
 
50
- end
51
-
58
+ end
59
+
52
60
  def googleplus(options = {})
53
-
61
+
54
62
  default_options = {size: "small", annotation: "inline", width: "300"}
55
63
  options = default_options.merge(options)
56
64
 
57
65
  content_tag(:div, '', class: "g-plusone", data: options).html_safe
58
-
66
+
59
67
  end
60
-
68
+
61
69
  def twitter(options = {})
62
-
70
+
63
71
  result = ""
64
-
72
+
65
73
  default_options = {via: "twitter_username", count: "vertical", dnt: "true"}
66
74
  options = default_options.merge(options)
67
-
75
+
68
76
  result += content_tag(:span, '', class: "tacTwitter").html_safe
69
-
77
+
70
78
  result += content_tag(:a,'', href: "https://twitter.com/share", class: "twitter-share-button", data: options).html_safe
71
-
72
- result.html_safe
73
-
79
+
80
+ result.html_safe
81
+
74
82
  end
75
-
83
+
84
+ def cookie_manager_link(text = "Gestion des cookies")
85
+
86
+ content_tag(:a, h(text), href: "javascript:tarteaucitron.userInterface.openPanel();").html_safe
87
+
88
+ end
89
+
76
90
  end
77
91
  end
92
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tarteaucitron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-04-16 00:00:00.000000000 Z
12
+ date: 2015-04-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: geoip