A Rails solution to the European Cookie Law issue.
This will add a dismissable "cookies bar" and a /cookies-policy
page with the
long cookies policy text.
Add this line to your application's Gemfile:
gem 'eu_cookies', "~> 1.0"
And then execute:
$ bundle
Run the installation generator:
$ bundle exec rails g eu_cookies:install
Then, just add this somewhere on you <body>
:
<%= cookies_bar %>
NOTE: This gem imply that you have JQuery.
On a initializer you can configure things (defaults are shown here):
EuCookies.use_scroll = false # true to treat page scroll as acceptance
EuCookies.display_policy = true # false to remove link, a string to link an external policy
EuCookies.enabled = true # false to disable all the features
To quickly customize position and styles you can override some Sass variables,
take a look to your app/assets/stylesheets/eu_cookies.scss
file.
The short cookies bar message is available in English, German, Spanish, French, Croatian, Italian, Slovenian, Dutch, Estonian, Norwegian, Russian and Swedish.
Not supported, please use jquery.turbolinks gem.
Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
Originally based on https://github.com/infinum/cookies_eu
The gem is available as open source under the terms of the MIT License.