cookies_eu 1.7.4 → 1.7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -0
- data/app/assets/javascripts/cookies_eu.js +4 -1
- data/app/views/cookies_eu/_consent_banner.html.erb +14 -10
- data/config/locales/bg.yml +5 -0
- data/config/locales/el.yml +1 -1
- data/config/locales/he.yml +6 -0
- data/config/locales/lt.yml +5 -0
- data/config/locales/tr.yml +5 -0
- data/cookies_eu.gemspec +2 -2
- data/lib/cookies_eu/version.rb +1 -1
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef0d89db9e2357389f70112e9a4297b66425c05f650388b0faad52ac093bdc95
|
4
|
+
data.tar.gz: 1c4ad2c16def8a1c133fd43bae71ab719e35adb979307047fd7b9ad392844892
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc9a1a68a0199e56fe4c7c8af2a0e7a39cb9b0f558280d2c972aa65080901a1de9f97622aab838aae99c5a797b7c53c07ea0f6d8a947752588ecd1f6b37a4b53
|
7
|
+
data.tar.gz: d3d46d5e74e8eab57e1cb670a81503ad42213d3540d0766832f2116a085564f749254ca06bb9f79e1a8366c768174caee59072d99671283572cc481a1ae2ad10
|
data/README.md
CHANGED
@@ -8,6 +8,7 @@ Gem to add cookie consent to rails application
|
|
8
8
|
|
9
9
|
* Albanian
|
10
10
|
* Basque
|
11
|
+
* Bulgarian
|
11
12
|
* Catalan
|
12
13
|
* Croatian
|
13
14
|
* Czech
|
@@ -19,8 +20,10 @@ Gem to add cookie consent to rails application
|
|
19
20
|
* French
|
20
21
|
* German
|
21
22
|
* Greek
|
23
|
+
* Hebrew
|
22
24
|
* Hungarian
|
23
25
|
* Italian
|
26
|
+
* Lithuanian
|
24
27
|
* Norwegian
|
25
28
|
* Polish
|
26
29
|
* Portuguese
|
@@ -29,8 +32,13 @@ Gem to add cookie consent to rails application
|
|
29
32
|
* Slovenian
|
30
33
|
* Spanish
|
31
34
|
* Swedish
|
35
|
+
* Turkish
|
32
36
|
* Ukrainian
|
33
37
|
|
38
|
+
## Screenshot
|
39
|
+
|
40
|
+
![Cookies eu screenshot](https://user-images.githubusercontent.com/2737390/86209657-5a5e8b00-bb73-11ea-91fc-e5ff36af148f.png)
|
41
|
+
|
34
42
|
## Installation
|
35
43
|
|
36
44
|
Add this line to your application's Gemfile:
|
@@ -91,6 +99,18 @@ If you wish to customize the style of the div the classes are:
|
|
91
99
|
.cookies-eu-link /* link */
|
92
100
|
```
|
93
101
|
|
102
|
+
If you wish to customize the HTML, create a folder `cookies_eu`, create a partial `_consent_banner.html.erb` and paste the HTML from [here](app/views/cookies_eu/_consent_banner.html.erb)
|
103
|
+
|
104
|
+
If you wish to run some arbitrary code when the user acknowledges the cookie message, you can register a callback. This is useful if you wish to persist the user's preference to the database.
|
105
|
+
|
106
|
+
```javascript
|
107
|
+
document.addEventListener('cookies-eu-acknowledged', function() {
|
108
|
+
// The user has acknowledged cookies! If they're logged in, make an api call
|
109
|
+
// so we remember their preference.
|
110
|
+
fetch('...');
|
111
|
+
});
|
112
|
+
```
|
113
|
+
|
94
114
|
## Cookies used
|
95
115
|
|
96
116
|
This gem uses a cookie called **cookie_eu_consented** to track whether a user has accepted the cookie notice and whether it needs to be shown again or not.
|
@@ -24,10 +24,13 @@ var cookiesEu = {
|
|
24
24
|
},
|
25
25
|
|
26
26
|
setCookie: function() {
|
27
|
-
|
27
|
+
var isSecure = location.protocol === 'https:';
|
28
|
+
Cookies.set('cookie_eu_consented', true, { path: '/', expires: 365, secure: isSecure });
|
28
29
|
|
29
30
|
var container = document.querySelector('.js-cookies-eu');
|
30
31
|
container.parentNode.removeChild(container);
|
32
|
+
|
33
|
+
document.dispatchEvent(new CustomEvent('cookies-eu-acknowledged'));
|
31
34
|
}
|
32
35
|
};
|
33
36
|
|
@@ -1,11 +1,15 @@
|
|
1
|
-
<% if cookies
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
<% if cookies.kind_of? ActionDispatch::Cookies::CookieJar %>
|
2
|
+
<% if cookies && cookies['cookie_eu_consented'] != 'true' %>
|
3
|
+
<div class="cookies-eu js-cookies-eu" <%= "dir=rtl" if I18n.exists?('cookies_eu.direction', I18n.locale) && I18n.t("cookies_eu.direction") == "rtl" %>>
|
4
|
+
<span class="cookies-eu-content-holder"><%= t('cookies_eu.cookies_text') %></span>
|
5
|
+
<span class="cookies-eu-button-holder">
|
6
|
+
<button class="cookies-eu-ok js-cookies-eu-ok"> <%= t('cookies_eu.ok') %> </button>
|
7
|
+
<% if defined?(link).present? %>
|
8
|
+
<a href="<%= link %>" class="cookies-eu-link" target="<%= defined?(target).present? ? target : '' %>"> <%= t('cookies_eu.learn_more') %> </a>
|
9
|
+
<% end %>
|
10
|
+
</span>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
<% else %>
|
14
|
+
<% raise Exception.new "'cookies' is a reserved Rails class, please rename your method" %>
|
11
15
|
<% end %>
|
data/config/locales/el.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
el:
|
2
2
|
cookies_eu:
|
3
|
-
cookies_text: "Τα cookies μας βοηθούν να προσφέρουμε τις υπηρεσίες μας. Με την
|
3
|
+
cookies_text: "Τα cookies μας βοηθούν να προσφέρουμε τις υπηρεσίες μας. Με την χρήση των υπηρεσιών μας, συμφωνείτε στην χρήση των cookies."
|
4
4
|
learn_more: "Μάθετε περισσότερα"
|
5
5
|
ok: "OK"
|
data/cookies_eu.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'cookies_eu/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "cookies_eu"
|
8
8
|
spec.version = CookiesEu::VERSION
|
9
|
-
spec.authors = ["Stjepan Hadjic"]
|
10
|
-
spec.email = ["stjepan.hadjic@infinum.hr"]
|
9
|
+
spec.authors = ["Stjepan Hadjic", "Gabrijel Skoro"]
|
10
|
+
spec.email = ["stjepan.hadjic@infinum.hr", "gabrijel.skoro@gmail.com"]
|
11
11
|
spec.description = %q{Displays a cookie consent}
|
12
12
|
spec.summary = %q{Displays a cookie consent. If you dont disable cokkies in settings, we assume you are ok with us using cookies}
|
13
13
|
spec.homepage = "https://github.com/infinum/cookies_eu"
|
data/lib/cookies_eu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookies_eu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stjepan Hadjic
|
8
|
+
- Gabrijel Skoro
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-07-31 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: js_cookie_rails
|
@@ -55,6 +56,7 @@ dependencies:
|
|
55
56
|
description: Displays a cookie consent
|
56
57
|
email:
|
57
58
|
- stjepan.hadjic@infinum.hr
|
59
|
+
- gabrijel.skoro@gmail.com
|
58
60
|
executables: []
|
59
61
|
extensions: []
|
60
62
|
extra_rdoc_files: []
|
@@ -69,6 +71,7 @@ files:
|
|
69
71
|
- app/assets/stylesheets/cookies_eu.scss
|
70
72
|
- app/views/cookies_eu/_consent_banner.html.erb
|
71
73
|
- app/views/cookies_eu/cookies_info.html.haml
|
74
|
+
- config/locales/bg.yml
|
72
75
|
- config/locales/ca.yml
|
73
76
|
- config/locales/cs.yml
|
74
77
|
- config/locales/da.yml
|
@@ -80,9 +83,11 @@ files:
|
|
80
83
|
- config/locales/eu.yml
|
81
84
|
- config/locales/fi.yml
|
82
85
|
- config/locales/fr.yml
|
86
|
+
- config/locales/he.yml
|
83
87
|
- config/locales/hr.yml
|
84
88
|
- config/locales/hu.yml
|
85
89
|
- config/locales/it.yml
|
90
|
+
- config/locales/lt.yml
|
86
91
|
- config/locales/nl.yml
|
87
92
|
- config/locales/no.yml
|
88
93
|
- config/locales/pl.yml
|
@@ -93,6 +98,7 @@ files:
|
|
93
98
|
- config/locales/sl.yml
|
94
99
|
- config/locales/sq.yml
|
95
100
|
- config/locales/sv.yml
|
101
|
+
- config/locales/tr.yml
|
96
102
|
- config/locales/ua.yml
|
97
103
|
- cookies_eu.gemspec
|
98
104
|
- lib/cookies_eu.rb
|
@@ -118,8 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
124
|
- !ruby/object:Gem::Version
|
119
125
|
version: '0'
|
120
126
|
requirements: []
|
121
|
-
|
122
|
-
rubygems_version: 2.7.3
|
127
|
+
rubygems_version: 3.1.4
|
123
128
|
signing_key:
|
124
129
|
specification_version: 4
|
125
130
|
summary: Displays a cookie consent. If you dont disable cokkies in settings, we assume
|