fix banner not being render after using cookies as the method name

This commit is contained in:
Gabrijel Škoro 2020-10-02 22:46:02 +02:00
parent 1827842c03
commit cf95a398b7
3 changed files with 17 additions and 12 deletions

View File

@ -23,6 +23,7 @@ Gem to add cookie consent to rails application
* Hebrew
* Hungarian
* Italian
* Lithuanian
* Norwegian
* Polish
* Portuguese

View File

@ -1,11 +1,15 @@
<% 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>
<% 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 %>

View File

@ -1,5 +1,5 @@
en:
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"
ok: "OK"