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

Compare commits

...

106 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 ()
* 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 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 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 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 from BRONSON77/i18n_basque
add eu.yml locale
2019-01-04 10:57:48 +01:00
Gabrijel Škoro
d6431c065d
Merge pull request 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
Gabrijel Škoro
6466d3461d fix: add .yml extension to albanian language 2018-06-15 16:42:51 +02:00
Gabrijel Škoro
c69c670a6d bump version to 1.7.2 2018-06-15 16:36:03 +02:00
Gabrijel Škoro
8bda73317a
Merge pull request from olsigjeci/patch-1
Create sq_AL - Albanian language
2018-06-15 16:34:31 +02:00
Gabrijel Škoro
4832fc7115
Merge pull request from olsigjeci/patch-2
update readme with Albanian language support
2018-06-15 16:34:15 +02:00
Olsi Gjeci
4f2e722c28
update readme with Albanian language support 2018-06-15 15:15:47 +01:00
Gabrijel Škoro
4004f81eca
Merge pull request from seanfcarroll/patch-1
Describe the cookie used by the gem
2018-06-14 09:57:49 +02:00
Sean
8b2030d6a1
Describe the cookie used by the gem
Add a paragraph to README to describe the cookie used by the gem itself.
2018-06-14 09:52:52 +02:00
Olsi Gjeci
ffc02ac595
Create sq_AL - Albanian language 2018-05-26 00:13:57 +01:00
Gabrijel Škoro
232c92faab add finnish language to the readme, bump version 2018-05-25 09:15:52 +02:00
Gabrijel Škoro
cf8bae9590
Merge pull request from nomenal/fi-translation-added
Support for finnish language
2018-05-25 09:14:47 +02:00
Mikko Ruokojoki
f1fa7215b8 Fixed right language inside file also. 2018-05-25 08:01:44 +03:00
Gabrijel Škoro
a2d74d3378 bump version to 1.7.0 2018-05-24 23:24:09 +02:00
Gabrijel Škoro
46ad3ea706 installing cookie with generator would fail if we had a .scss file 2018-05-24 23:17:31 +02:00
Gabrijel Škoro
af2a6e10b1 update readme, include turbolinks 5+ support 2018-05-24 22:33:39 +02:00
Gabrijel Škoro
ca6a415961
Merge pull request from haffla/master
Make it work with Turbolinks
2018-05-24 21:52:11 +02:00
Mikko Ruokojoki
4d8e3a91f0 Finnish translation added 2018-05-24 20:59:08 +03:00
Jakob Pupke
f497dd7485 support turbolinks 2018-05-08 19:39:11 +02:00
Gabrijel Škoro
26df12c868 bump version 2017-10-08 19:46:07 +02:00
Gabrijel Škoro
52712703ad Merge pull request from Neva-Labs/fix-when-cookies-not-available
Fixed exception where cookies[] was nil in consent banner
2017-10-08 19:43:10 +02:00
Gabrijel Škoro
4487296612 Merge pull request from gemantzu/master
changes locale to el
2017-10-08 19:26:50 +02:00
George Mantzouranis
fb773d5448 changes locale to el 2017-10-07 11:07:34 +03:00
paulmwatson
5e0df30d25 Fixed exception where cookies[] was nil in consent banner 2017-09-21 17:12:04 +02:00
Gabrijel Škoro
8e18bcefcc Update README.md 2017-08-09 12:53:21 +02:00
Gabrijel Škoro
a9252f16f3 Merge pull request from wjdhamilton/patch-1
Integrate with application.scss
2017-08-09 12:51:58 +02:00
James Hamilton
49a657ec68 Integrate with application.scss
Just a small extension to explain how to add the `scss` file when you use `application.scss` rather than `application.css`
2017-07-20 09:52:36 +01:00
Gabrijel Škoro
020fe1c764 Bump new version 2017-04-26 21:21:15 +02:00
Gabrijel Škoro
ff649e1b89 Merge pull request from modreoci/patch-1
Improve slovak locale
2017-04-26 21:17:00 +02:00
Gabrijel Škoro
0107c1ff62 Merge pull request from modreoci/patch-2
Improve czech locale
2017-04-26 21:16:53 +02:00
Gabrijel Škoro
e3772bb6e3 Merge pull request from kiriakosv/master
Master
2017-04-26 21:16:42 +02:00
Radek Hrančík
9f87d4decf Improve czech locale
Too complicated previous translation not fully grammatically and semantically correct.
2017-04-26 20:32:17 +02:00
Radek Hrančík
21eb363e4a Improve slovak locale 2017-04-26 20:23:55 +02:00
Gabrijel Škoro
9d9a76d049 Merge pull request from vilola/patch-1
Slovak translation
2017-03-25 21:06:05 +01:00
vilola
cc328cf70c Slovak translation 2017-03-24 18:30:05 +01:00
Kiriakos Velissariou
045b39eceb Change translation to match the English one 2017-02-24 14:07:38 +02:00
Kiriakos Velissariou
5c7ccc411b Change greek text 2017-02-24 13:50:36 +02:00
Kiriakos Velissariou
4fc6da7f50 Add Greek language support 2017-02-24 13:05:46 +02:00
Gabrijel Škoro
3558c6dd94 Merge pull request from Siansor/master
Added Ukrainian to the list
2017-01-26 09:14:39 +01:00
Siansor
aaaa32409d Added Ukrainian to the list 2017-01-25 23:39:30 +02:00
Gabrijel Škoro
d0a1d5653d jQuery is not needed anymore 2017-01-22 17:22:59 +01:00
Stjepan Hadjic
33cea74dbc Bump version 2016-12-14 09:38:45 +01:00
štef
6e8079089f fix 2016-12-14 09:37:17 +01:00
Gabrijel Škoro
c459efaa25 Update pt.yml
Fix pt.yml locale
2016-11-07 21:40:44 +01:00
anacar
2957a2e1f0 Update README.md 2016-10-24 14:34:17 +02:00
Gabrijel Škoro
af93ce62ca Merge pull request from infinum/feature/add-async-support
Add async and defer support
2016-10-03 22:08:37 +02:00
Gabrijel Škoro
e0f4309b36 Bump version 2016-10-03 22:08:28 +02:00
Gabrijel Škoro
7520dde55d Add async and defer support 2016-10-03 22:06:23 +02:00
Gabrijel Škoro
d84d63663f Merge pull request from infinum/feature/support-older-sass-version
Feature/support older sass version
2016-10-03 21:06:17 +02:00
Gabrijel Škoro
9cb8aa7a6b Bump version 2016-10-03 21:04:23 +02:00
Gabrijel Škoro
f0cb75f1af Support older sass version 2016-10-03 21:02:51 +02:00
Gabrijel Škoro
eefe8405c5 Fix IE<9 container removal bug 2016-09-16 21:36:09 +02:00
Gabrijel Škoro
9efb24a02f Merge pull request from infinum/css-fixes
Style updates
2016-09-15 21:29:50 +02:00
Gabrijel Škoro
ced1817a28 Bump version to 1.5.0 2016-09-15 21:29:38 +02:00
Gabrijel Škoro
263a9ee211 Merge 2016-09-15 21:27:56 +02:00
Gabrijel Škoro
a3bf83a8b2 Merge pull request from infinum/remove-jquery
Remove jQuery and replace jquery-cookie-rails with js-cookie
2016-09-15 21:19:37 +02:00
Gabrijel Škoro
f3bc531403 Small style improvements 2016-09-15 21:01:23 +02:00
Gabrijel Škoro
a037b41fd7 Remove jQuery and replace jquery-cookie-rails with js-cookie 2016-09-15 20:12:17 +02:00
Gabrijel Škoro
92e922eb85 Merge pull request from gnycl/patch-1
Typo fixes
2016-09-05 12:55:55 +02:00
Remy Abdullahi
ddacb78ddd Typo fixes 2016-08-10 12:42:54 -05:00
Stjepan Hadjic
e8ee4ddb8a add version badge 2016-02-16 15:30:03 +01:00
Stjepan Hadjic
f99a0010c1 Update readme, version 2016-02-16 15:28:41 +01:00
štef
52da532b4b Merge pull request from existent-co-uk/patch-1
Update cookies_eu.js
2016-02-16 15:24:20 +01:00
štef
d4177097ad Merge pull request from muskovicsnet/link-target-parameter
Link target parameter
2016-02-16 15:23:55 +01:00
štef
ded657d1d3 Merge pull request from varandasi/pt_i18n
Portuguese i18n
2016-02-16 15:23:27 +01:00
Ilidio Varandas
43afcccee6 Portuguese i18n 2016-02-14 15:05:04 +00:00
Gabrijel Škoro
2b7b386e20 Merge pull request from muskovicsnet/hungarian-translation
Hungarian translation
2016-02-12 23:02:00 +01:00
Gabrijel Škoro
41f750121e Merge pull request from Ebbe/danish-translation
Danish translation
2016-02-12 23:01:34 +01:00
Esben Damgaard
6da96b62bf Fix typo 2016-02-12 09:27:41 +01:00
Esben Damgaard
164f2a7fc7 Added danish in README 2016-02-04 10:04:50 +01:00
Esben Damgaard
8815498e1e Added danish translation. 2016-02-04 10:03:09 +01:00
Ivica Batinić
40c5bccf67 Update README.md 2015-12-10 12:50:51 +01:00
Muskovics Gábor
8499dd4c2e Link target parameter
New parameter for render to open the link in a new tab.
2015-10-17 13:39:58 +02:00
Muskovics Gábor
0e72ddc21d Hungarian translation
New hu.yml file.
2015-10-17 13:34:46 +02:00
Gabrijel Škoro
277664a41f Merge pull request from danielmorosan/master
Romanian language
2015-09-18 09:21:38 +02:00
Daniel Morosan
cb2cff3cbc Added Romanian to the list 2015-09-17 18:46:52 +03:00
Daniel Morosan
443dc0b83f Small typo & word missing 2015-09-17 18:42:42 +03:00
Daniel Morosan
7a72aabdad Romanian language
Added Romanian language
2015-09-17 18:41:01 +03:00
Gabrijel Škoro
b26d00fb3f Merge pull request from paulslaby/master
Add Czech translation
2015-09-16 09:05:45 +02:00
paulslaby
ac03b60cc6 Fix typo 2015-09-16 09:01:33 +02:00
Pavel Slabý
796786f41d Add Czech translation 2015-09-16 07:18:52 +02:00
existent-co-uk
30d75a5f9c Update cookies_eu.js
Do not quote the "true" value when the "cookie_eu_consented" cookie is set.

The quoting breaks the test for the cookie value in the cookie consent partial template. The result is that the partial always renders the banner, even after the user has consented.
2015-09-08 09:24:03 +01:00
25 changed files with 632 additions and 70 deletions

354
.scss-lint.yml Normal file
View file

@ -0,0 +1,354 @@
# Default application configuration that all configurations inherit from.
linters:
BangFormat:
enabled: true
space_before_bang: true
space_after_bang: false
BorderZero:
enabled: true
ColorKeyword:
enabled: true
ColorVariable:
enabled: true
Comment:
enabled: true
DebugStatement:
enabled: true
DeclarationOrder:
enabled: true
DuplicateProperty:
enabled: true
ElsePlacement:
enabled: true
style: same_line # or 'new_line'
EmptyLineBetweenBlocks:
enabled: true
ignore_single_line_blocks: true
EmptyRule:
enabled: true
FinalNewline:
enabled: true
present: true
HexLength:
enabled: true
style: long # 'short' or 'long'
HexNotation:
enabled: true
style: uppercase # 'lowercase' or 'uppercase'
HexValidation:
enabled: true
IdSelector:
enabled: true
ImportantRule:
enabled: true
ImportPath:
enabled: true
leading_underscore: false
filename_extension: false
Indentation:
enabled: true
character: space # or 'tab'
width: 2
LeadingZero:
enabled: true
style: include_zero # exclude_zero or 'include_zero'
MergeableSelector:
enabled: true
force_nesting: true
# NameFormat:
# enabled: false
# convention: BEM # hyphenated_lowercase or 'BEM', or a regex pattern
NestingDepth:
enabled: true
max_depth: 4
PlaceholderInExtend:
enabled: true
PropertySortOrder:
enabled: true
order:
- font
- font-family
- font-size
- font-weight
- font-style
- font-variant
- font-size-adjust
- font-stretch
- font-effect
- font-emphasize
- font-emphasize-position
- font-emphasize-style
- font-smooth
- line-height
- # This empty element signals a visual separation
- position
- z-index
- top
- right
- bottom
- left
-
- display
- visibility
- float
- clear
- overflow
- overflow-x
- overflow-y
- clip
- zoom
- flex-direction
- flex-order
- flex-pack
- flex-align
-
- box-sizing
- width
- min-width
- max-width
- height
- min-height
- max-height
- margin
- margin-top
- margin-right
- margin-bottom
- margin-left
- padding
- padding-top
- padding-right
- padding-bottom
- padding-left
-
- table-layout
- empty-cells
- caption-side
- border-spacing
- border-collapse
- list-style
- list-style-position
- list-style-type
- list-style-image
-
- content
- quotes
- counter-reset
- counter-increment
- resize
- cursor
- user-select
- nav-index
- nav-up
- nav-right
- nav-down
- nav-left
- transition
- transition-delay
- transition-timing-function
- transition-duration
- transition-property
- transform
- transform-origin
- animation
- animation-name
- animation-duration
- animation-play-state
- animation-timing-function
- animation-delay
- animation-iteration-count
- animation-direction
- text-align
- text-align-last
- vertical-align
- white-space
- text-decoration
- text-emphasis
- text-emphasis-color
- text-emphasis-style
- text-emphasis-position
- text-indent
- text-justify
- letter-spacing
- word-spacing
- text-outline
- text-transform
- text-wrap
- text-overflow
- text-overflow-ellipsis
- text-overflow-mode
- word-wrap
- word-break
- tab-size
- hyphens
- pointer-events
-
- opacity
- filter
- color
- border
- border-width
- border-style
- border-color
- border-top
- border-top-width
- border-top-style
- border-top-color
- border-right
- border-right-width
- border-right-style
- border-right-color
- border-bottom
- border-bottom-width
- border-bottom-style
- border-bottom-color
- border-left
- border-left-width
- border-left-style
- border-left-color
- border-radius
- border-top-left-radius
- border-top-right-radius
- border-bottom-right-radius
- border-bottom-left-radius
- border-image
- border-image-source
- border-image-slice
- border-image-width
- border-image-outset
- border-image-repeat
- outline
- outline-width
- outline-style
- outline-color
- outline-offset
- background
- background-color
- background-image
- background-repeat
- background-attachment
- background-position
- background-position-x
- background-position-y
- background-clip
- background-origin
- background-size
- box-decoration-break
- box-shadow
- text-shadow
separate_groups: true
PropertySpelling:
enabled: true
extra_properties: []
QualifyingElement:
enabled: true
allow_element_with_attribute: true
allow_element_with_class: false
allow_element_with_id: false
SelectorDepth:
enabled: true
max_depth: 3
SelectorFormat:
enabled: true
convention: ^([\.\%]?[a-z]*[-]?[a-z0-9\-]*)(\.[a-z0-9\-]*)?(__[a-z0-9]*[-]?[a-z0-9\-]*)?(_[a-z0-9]*[-]?[a-z0-9\-]*)?(\:[a-z]*)*$ # or 'hyphenated_lowercase', or 'snake_case', or 'camel_case', or a regex pattern
Shorthand:
enabled: true
allowed_shorthands: [1, 2]
SingleLinePerProperty:
enabled: true
allow_single_line_rule_sets: true
SingleLinePerSelector:
enabled: true
SpaceAfterComma:
enabled: true
SpaceAfterPropertyColon:
enabled: true
style: one_space # or 'no_space', or 'at_least_one_space', or 'aligned'
SpaceAfterPropertyName:
enabled: true
SpaceAfterVariableName:
enabled: true
SpaceAroundOperator:
enabled: true
SpaceBeforeBrace:
enabled: true
allow_single_line_padding: false
SpaceBetweenParens:
enabled: true
spaces: 0
StringQuotes:
enabled: true
style: single_quotes # or double_quotes
TrailingSemicolon:
enabled: true
TrailingZero:
enabled: true
TransitionAll:
enabled: true
UnnecessaryMantissa:
enabled: true
UnnecessaryParentReference:
enabled: true
UrlFormat:
enabled: true
UrlQuotes:
enabled: true
VariableForProperty:
enabled: true
properties: [color, font, background-color]
VendorPrefix:
enabled: true
ZeroUnit:
enabled: true
Compass::*:
enabled: false

View file

@ -1,26 +1,43 @@
[![Gem Version](https://badge.fury.io/rb/cookies_eu.svg)](https://badge.fury.io/rb/cookies_eu)
# CookiesEu
Gem to add cookie consent to rails application
## Supported languages
* Albanian
* Basque
* Bulgarian
* Catalan
* Croatian
* Czech
* Danish
* Dutch
* English
* Estonian
* Finnish
* French
* German
* Greek
* Hebrew
* Hungarian
* Italian
* Lithuanian
* Norwegian
* Polish
* Portuguese
* Romanian
* Russian
* Slovenian
* Spanish
* Swedish
* Turkish
* Ukrainian
## Prerequisites
## Screenshot
jquery needs to be present in your application.js
![Cookies eu screenshot](https://user-images.githubusercontent.com/2737390/86209657-5a5e8b00-bb73-11ea-91fc-e5ff36af148f.png)
## Installation
@ -46,6 +63,12 @@ And in application.css:
*= require cookies_eu
Or, if you have application.scss:
@import "cookies_eu";
Remember to restart your server!
## Usage
In your view add
@ -60,18 +83,44 @@ You can add a link parameter to link to your cookies explanation page (you have
= render 'cookies_eu/consent_banner', link: '/cookies'
```
You can add a target parameter to the link to open in a new tab
If you whish to customize the style of the div the classes are:
```javascript
.cookies_eu // main div
.cookies_eu_ok // button
.cookies_eu_link // link
```ruby
= render 'cookies_eu/consent_banner', link: '/cookies', target: '_blank'
```
## Turbolinks NOT supported
If you wish to customize the style of the div the classes are:
Please use [jquery.turbolinks gem](https://github.com/kossnocorp/jquery.turbolinks)
```css
.cookies-eu /* main div */
.cookies-eu-content-holder /* content holder */
.cookies-eu-button-holder /* button holder */
.cookies-eu-ok /* button */
.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.
## Turbolinks 5+
Is supported out of the box, just require it before cookies_eu
//= require turbolinks
//= require cookies_eu
## Sample of cookie info (in [haml form](/app/views/cookies_eu/cookies_info.html.haml))
@ -123,7 +172,7 @@ To enable cookies on our website, follow the steps below.
1. Click "Tools" at the top of your browser and select "Settings".
2. Click "Show advanced settings", scroll down to the section "Privacy" and click "Content Settings."
3. Select "Allow local data to be set". To only acept first-party cookies, check the box next to "Block all third-party cookies without exception"
3. Select "Allow local data to be set". To only accept first-party cookies, check the box next to "Block all third-party cookies without exception"
##### Microsoft Internet Explorer 6.0, 7.0, 8.0, 9.0
@ -178,3 +227,10 @@ To enable cookies on our website, follow the steps below.
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## Credits
Maintained and sponsored by
[Infinum](http://www.infinum.co).
<img src="https://infinum.co/infinum.png" width="264">

View file

@ -1,9 +1,65 @@
//= require jquery.cookie
//= require js.cookie
'use strict';
$(document).ready( function(){
$('.cookies-eu-ok').click(function(e){
e.preventDefault();
$.cookie('cookie_eu_consented', 'true', { path: '/', expires: 365 });
$('.cookies-eu').remove();
});
});
var windowIsTurbolinked = 'Turbolinks' in window;
var cookiesEu = {
init: function() {
var cookiesEuOKButton = document.querySelector('.js-cookies-eu-ok');
if (cookiesEuOKButton) {
this.addListener(cookiesEuOKButton);
// clear turbolinks cache so cookie banner does not reappear
windowIsTurbolinked && window.Turbolinks.clearCache();
}
},
addListener: function(target) {
// Support for IE < 9
if (target.attachEvent) {
target.attachEvent('onclick', this.setCookie);
} else {
target.addEventListener('click', this.setCookie, false);
}
},
setCookie: function() {
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'));
}
};
(function() {
function eventName(fallback) {
return windowIsTurbolinked ? 'turbolinks:load' : fallback
}
var isCalled = false;
function isReady() {
// return early when cookiesEu.init has been called AND Turbolinks is NOT included
// when Turbolinks is included cookiesEu.init has to be called on every page load
if (isCalled && !windowIsTurbolinked) {
return
}
isCalled = true;
cookiesEu.init();
}
if (document.addEventListener) {
return document.addEventListener(eventName('DOMContentLoaded'), isReady, false);
}
// Old browsers IE < 9
if (window.addEventListener) {
window.addEventListener(eventName('load'), isReady, false);
} else if (window.attachEvent) {
window.attachEvent(eventName('onload'), isReady);
}
})();

View file

@ -1,57 +1,59 @@
$cookies-eu-background-color: #F2F2F2;
$cookies-eu-border-color: #E4E4E4;
$cookies-eu-button-background-color: #4D90FE;
$cookies-eu-button-color: #FFFFFF;
$cookies-eu-mobile: 'max-width: 767px';
.cookies-eu {
line-height: 40px;
position: fixed;
z-index: 999;
right: 0;
bottom: 0;
left: 0;
line-height: 40px;
background: #f2f2f2;
border-top: 1px solid #e4e4e4;
width: 100%;
z-index: 999;
padding: 0 20px;
text-align: center;
border-top: 1px solid $cookies-eu-border-color;
background: $cookies-eu-background-color;
@media ($cookies-eu-mobile) {
font-size: 12px;
line-height: 30px;
position: initial;
}
.cookies-eu-content-holder {
display: inline-block;
padding: 0 20px;
line-height: 26px;
}
.cookies-eu-button-holder {
display: inline-block;
padding-right: 20px;
.cookies-eu-ok {
background-color: #4d90fe;
background-image: -webkit-linear-gradient(top,#4d90fe,#4787ed);
border: 1px solid #3079ed;
border-radius: 2px;
color: #fff;
cursor: default;
display: inline-block;
font-size: 11px;
font-weight: bold;
height: 24px;
line-height: 20px;
margin-right: 0px;
min-width: 26px;
outline: 0;
padding: 0 11px;
margin-right: 5px;
padding: 2px 11px;
cursor: pointer;
text-align: center;
white-space: nowrap;
margin: 0 5px;
}
}
}
@media (max-width: 767px){
.cookies-eu{
position: static;
font-size: 12px;
line-height: 20px;
.cookies-eu-content-holder{
line-height: 16px;
padding: 5px 20px;
}
.cookies-eu-button-holder{
padding-bottom: 5px;
color: $cookies-eu-button-color;
border: 0;
outline: none;
background-color: $cookies-eu-button-background-color;
}
}
}

View file

@ -1,11 +1,15 @@
<% if cookies['cookie_eu_consented'] != 'true' %>
<div class="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"> <%= t('cookies_eu.ok') %> </button>
<% if defined?(link).present? %>
<a href="<%= link %>" class="cookies-eu-link"> <%= 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"

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

@ -0,0 +1,5 @@
cs:
cookies_eu:
cookies_text: "Cookies nám pomáhají poskytovat Vám naše služby. Využíváním těchto služeb souhlasíte s jejich použitím."
learn_more: "Dozvědět se více"
ok: "OK"

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

@ -0,0 +1,5 @@
da:
cookies_eu:
cookies_text: "Cookies hjælper os til at give dig den bedste oplevelse. Ved at bruge vores ydelse, accepterer du vores cookies."
learn_more: "Lær mere"
ok: "OK"

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

@ -0,0 +1,5 @@
el:
cookies_eu:
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"

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

@ -0,0 +1,5 @@
fi:
cookies_eu:
cookies_text: "Evästeet auttavat meitä tarjoamaan palveluitamme. Käyttämällä palveluitamme sitoudut käyttämään evästeitä."
learn_more: "Lue lisää"
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/hu.yml Normal file
View file

@ -0,0 +1,5 @@
hu:
cookies_eu:
cookies_text: "A weboldalon sütiket használunk, hogy kényelmesebb legyen a böngészés."
learn_more: "További információ"
ok: "OK"

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/pt.yml Normal file
View file

@ -0,0 +1,5 @@
pt:
cookies_eu:
cookies_text: "As cookies ajudam-nos a oferecer os nossos serviços. Ao utilizar os nossos serviços, aceita o uso de cookies."
learn_more: "Mais informações"
ok: "OK"

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

@ -0,0 +1,5 @@
ro:
cookies_eu:
cookies_text: "Cookies ne ajuta la livrarea serviciului. Folosind serviciul nostru, consemnati la utilizarea cookies-urilor."
learn_more: "Mai multe"
ok: "OK"

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

@ -0,0 +1,5 @@
sk:
cookies_eu:
cookies_text: "Cookies nám pomáhajú poskytovať Vám naše služby. Využívaním týchto služieb súhlasíte s ich použitím."
learn_more: "Oboznámiť sa podrobnejšie"
ok: "OK"

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

@ -0,0 +1,5 @@
sq:
cookies_eu:
cookies_text: "Cookies na ndihmojnë t'ju sigurojmë shërbimet tona. Duke përdorur shërbimet tona, ju pranoni përdorimin tonë të cookies."
learn_more: "Mëso më shumë"
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"

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

@ -0,0 +1,5 @@
ua:
cookies_eu:
cookies_text: "Cookies допомагають нам надавати наші послуги. Використовуючи наші послуги, ви погоджуєтеся з використанням наших cookies."
learn_more: "Детальніше"
ok: "OK"

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"
@ -18,8 +18,7 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.add_dependency "jquery-rails"
spec.add_dependency "jquery-cookie-rails"
spec.add_dependency "js_cookie_rails", "~> 2.2.0"
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
end

View file

@ -1,7 +1,6 @@
require "cookies_eu/version"
require "cookies_eu/engine"
require 'jquery-rails'
require 'jquery-cookie-rails'
require "js_cookie_rails"
module CookiesEu
end

View file

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

View file

@ -6,7 +6,18 @@ module CookiesEu
end
def add_stylesheets
inject_into_file 'app/assets/stylesheets/application.css', "*= require cookies_eu\n", before: /\*\//, verbose: true
file = 'app/assets/stylesheets/application'
css_file = "#{file}.css"
scss_file = "#{file}.scss"
css_scss_file = "#{file}.css.scss"
if File.exists?(css_file)
inject_into_file css_file, "*= require cookies_eu\n", before: /\*\//, verbose: true
elsif File.exists?(scss_file)
append_file scss_file, "@import 'cookies_eu';\n"
else
append_file css_scss_file, "@import 'cookies_eu';\n"
end
end
end
end