1
0
Fork 0
mirror of https://github.com/infinum/cookies_eu synced 2023-03-27 23:21:16 -04:00

Compare commits

...

26 commits

Author SHA1 Message Date
Gabrijel Skoro
3a0ad36b51 chore: bump version to 1.7.8 2021-07-31 11:18:49 +02:00
Jeremy Fleischman
82167b3e3d Add support for an optional hook to know when cookies were acknowledged.
This fixes https://github.com/infinum/cookies_eu/issues/90
2021-07-31 11:13:46 +02:00
Tuna Çağlar Gümüş
3f91806082
added Turkish support (#88)
* added turkish support

* Update tr.yml

* Update README.md
2021-05-03 14:19:00 +02:00
Gabrijel Škoro
e00e4d39fa update readme to include banner HTML customization 2020-10-02 22:52:50 +02:00
Gabrijel Škoro
cf95a398b7 fix banner not being render after using cookies as the method name 2020-10-02 22:46:02 +02:00
Itay
1827842c03 hebrew and rtl language support added 2020-10-02 22:39:02 +02:00
Elvinas Predkelis
9e27ef7295 Adding support for Lithuanian language 2020-10-02 22:30:57 +02:00
Gabrijel Škoro
bae2eee30c
Add screenshot to the readme file 2020-07-01 08:19:02 +02:00
Gabrijel Škoro
dc0cc6a0c3 bump version to 1.7.6 2019-10-17 17:28:25 +02:00
Gabrijel Škoro
adb8404543
Merge pull request #76 from frostblooded/master
Add support for Bulgarian (BG)
2019-10-17 17:25:51 +02:00
Николай Данаилов
b9b2d20d1b
Add Bulgarian as a supported language in the Readme 2019-10-16 20:40:34 +03:00
Николай Данаилов
315680a5c7
Fix indentation in BG locales
Previously used 4 spaces. Now uses 2 spaces as in the other locales.
2019-10-16 20:37:10 +03:00
Nikolay Danailov
f46c4ab522 Add support for Bulgarian (BG) 2019-10-16 20:33:44 +03:00
Gabrijel Škoro
89da8f2c00
Merge pull request #74 from MrWhizzy/patch-1
minor fix in Greek locale
2019-06-17 21:20:34 +02:00
Christos Melas
644044a8dd
minor fix in Greek locale 2019-06-12 21:53:19 +01:00
Gabrijel Škoro
c3cec6f75a bump version to 1.7.5 2019-01-30 15:35:30 +01:00
Gabrijel Škoro
c26aa6b42d
Merge pull request #72 from davidhrbac/secure_cookie
Set cookie to secure when SSL connection
2019-01-30 14:46:40 +01:00
David Hrbáč
0ab13f6288 Have a variable 2019-01-30 14:45:08 +01:00
David Hrbáč
70c94cd900 Refactored to bool value 2019-01-30 14:39:39 +01:00
David Hrbáč
d84fcd4d33 Set cookie to secure when SSL connection 2019-01-30 14:19:31 +01:00
Gabrijel Škoro
e20a447932 bump version to 1.7.4 2019-01-04 16:54:21 +01:00
Gabrijel Škoro
2662ccbc11
Update README.md
Add CA and EU languages to the readme
2019-01-04 16:52:49 +01:00
Gabrijel Škoro
a12a7ad110
Merge pull request #70 from BRONSON77/i18n_basque
add eu.yml locale
2019-01-04 10:57:48 +01:00
Gabrijel Škoro
d6431c065d
Merge pull request #69 from BRONSON77/i18n_catalan
add ca.yml locale
2019-01-04 10:55:50 +01:00
santi
96bd3d0ab6 add eu.yml locale 2019-01-04 09:40:38 +01:00
santi
3df0f54624 add ca.yml locale 2019-01-03 16:24:36 +01:00
12 changed files with 75 additions and 15 deletions

View file

@ -7,6 +7,9 @@ Gem to add cookie consent to rails application
## Supported languages
* Albanian
* Basque
* Bulgarian
* Catalan
* Croatian
* Czech
* Danish
@ -17,8 +20,10 @@ Gem to add cookie consent to rails application
* French
* German
* Greek
* Hebrew
* Hungarian
* Italian
* Lithuanian
* Norwegian
* Polish
* Portuguese
@ -27,8 +32,13 @@ Gem to add cookie consent to rails application
* Slovenian
* Spanish
* Swedish
* Turkish
* Ukrainian
## Screenshot
![Cookies eu screenshot](https://user-images.githubusercontent.com/2737390/86209657-5a5e8b00-bb73-11ea-91fc-e5ff36af148f.png)
## Installation
Add this line to your application's Gemfile:
@ -89,6 +99,18 @@ If you wish to customize the style of the div the classes are:
.cookies-eu-link /* link */
```
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)
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.
```javascript
document.addEventListener('cookies-eu-acknowledged', function() {
// The user has acknowledged cookies! If they're logged in, make an api call
// so we remember their preference.
fetch('...');
});
```
## Cookies used
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.

View file

@ -24,10 +24,13 @@ var cookiesEu = {
},
setCookie: function() {
Cookies.set('cookie_eu_consented', true, { path: '/', expires: 365 });
var isSecure = location.protocol === 'https:';
Cookies.set('cookie_eu_consented', true, { path: '/', expires: 365, secure: isSecure });
var container = document.querySelector('.js-cookies-eu');
container.parentNode.removeChild(container);
document.dispatchEvent(new CustomEvent('cookies-eu-acknowledged'));
}
};

View file

@ -1,11 +1,15 @@
<% if cookies && cookies['cookie_eu_consented'] != 'true' %>
<div class="cookies-eu js-cookies-eu">
<span class="cookies-eu-content-holder"><%= t('cookies_eu.cookies_text') %></span>
<span class="cookies-eu-button-holder">
<button class="cookies-eu-ok js-cookies-eu-ok"> <%= t('cookies_eu.ok') %> </button>
<% if defined?(link).present? %>
<a href="<%= link %>" class="cookies-eu-link" target="<%= defined?(target).present? ? target : '' %>"> <%= t('cookies_eu.learn_more') %> </a>
<% end %>
</span>
</div>
<% if cookies.kind_of? ActionDispatch::Cookies::CookieJar %>
<% if cookies && cookies['cookie_eu_consented'] != 'true' %>
<div class="cookies-eu js-cookies-eu" <%= "dir=rtl" if I18n.exists?('cookies_eu.direction', I18n.locale) && I18n.t("cookies_eu.direction") == "rtl" %>>
<span class="cookies-eu-content-holder"><%= t('cookies_eu.cookies_text') %></span>
<span class="cookies-eu-button-holder">
<button class="cookies-eu-ok js-cookies-eu-ok"> <%= t('cookies_eu.ok') %> </button>
<% if defined?(link).present? %>
<a href="<%= link %>" class="cookies-eu-link" target="<%= defined?(target).present? ? target : '' %>"> <%= t('cookies_eu.learn_more') %> </a>
<% end %>
</span>
</div>
<% end %>
<% else %>
<% raise Exception.new "'cookies' is a reserved Rails class, please rename your method" %>
<% end %>

5
config/locales/bg.yml Normal file
View file

@ -0,0 +1,5 @@
bg:
cookies_eu:
cookies_text: "Курабийките ни помагат да доставяме услугите си. Използвайки нашите услуги, вие се съгласявате с нашето използване на курабийки."
learn_more: "Научи повече"
ok: "ОК"

5
config/locales/ca.yml Normal file
View file

@ -0,0 +1,5 @@
ca:
cookies_eu:
cookies_text: "Les cookies ens ajuden a oferir els nostres serveis. En utilitzar els nostres serveis, acceptes l'ús de cookies."
learn_more: "Més informació"
ok: "OK"

View file

@ -1,5 +1,5 @@
el:
cookies_eu:
cookies_text: "Τα cookies μας βοηθούν να προσφέρουμε τις υπηρεσίες μας. Με την χρησιμοποίηση των υπηρεσιών μας, συμφωνείτε στην χρήση των cookies."
cookies_text: "Τα cookies μας βοηθούν να προσφέρουμε τις υπηρεσίες μας. Με την χρήση των υπηρεσιών μας, συμφωνείτε στην χρήση των cookies."
learn_more: "Μάθετε περισσότερα"
ok: "OK"

5
config/locales/eu.yml Normal file
View file

@ -0,0 +1,5 @@
eu:
cookies_eu:
cookies_text: "Cookieek gure zerbitzuak eskaintzen laguntzen digute. Gure zerbitzuak erabiltzerakoan, cookie-erabilera onartzen duzu."
learn_more: "Informazio gehiago"
ok: "OK"

6
config/locales/he.yml Normal file
View file

@ -0,0 +1,6 @@
he:
cookies_eu:
cookies_text: "העוגיות עוזרות לנו לספק את שירותינו. על ידי השימוש בשירותים שלנו אתה מסכים לשימוש שלנו בעוגיות."
learn_more: "למד/י עוד"
ok: "בסדר"
direction: "rtl"

5
config/locales/lt.yml Normal file
View file

@ -0,0 +1,5 @@
lt:
cookies_eu:
cookies_text: "Sklandžiam svetainės veikimui, jūsų naršymo patirties gerinimui bei rinkodarai naudojame slapukus. Spausdami sutinku ar toliau naršydami svetainėje, Jūs sutinkate su slapukų įrašymu."
learn_more: "Daugiau informacijos"
ok: "OK"

5
config/locales/tr.yml Normal file
View file

@ -0,0 +1,5 @@
tr:
cookies_eu:
cookies_text: "Çerezler, hizmetlerimizi sunmamıza yardımcı oluyor. Hizmetlerimizi kullanarak, çerez kullanımımızı kabul etmiş olursunuz. "
learn_more: "Detayları Göster"
ok: "Tamam"

View file

@ -6,8 +6,8 @@ require 'cookies_eu/version'
Gem::Specification.new do |spec|
spec.name = "cookies_eu"
spec.version = CookiesEu::VERSION
spec.authors = ["Stjepan Hadjic"]
spec.email = ["stjepan.hadjic@infinum.hr"]
spec.authors = ["Stjepan Hadjic", "Gabrijel Skoro"]
spec.email = ["stjepan.hadjic@infinum.hr", "gabrijel.skoro@gmail.com"]
spec.description = %q{Displays a cookie consent}
spec.summary = %q{Displays a cookie consent. If you dont disable cokkies in settings, we assume you are ok with us using cookies}
spec.homepage = "https://github.com/infinum/cookies_eu"

View file

@ -1,3 +1,3 @@
module CookiesEu
VERSION = "1.7.3"
VERSION = "1.7.8"
end