From b1348661a7557a382ddcd5239b02c3d353015979 Mon Sep 17 00:00:00 2001 From: alexrodba Date: Thu, 6 Apr 2017 12:06:22 +0200 Subject: [PATCH] included cookie alert + new page with fixed box to test it + linked header logo to homepage --- data/cookies.yml | 4 + source/images/cookies-icon.svg | 1 + source/index.html.erb | 1 + source/javascripts/cookies.js | 15 +++ source/layouts/layout.erb | 3 + source/partials/_cookies.html.erb | 19 ++++ source/partials/_header.html.erb | 2 +- source/stylesheets/application.css.scss | 1 + source/stylesheets/blocks/_cookies.scss | 117 ++++++++++++++++++++++++ source/whole-page-cookies.html.erb | 45 +++++++++ 10 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 data/cookies.yml create mode 100644 source/images/cookies-icon.svg create mode 100644 source/javascripts/cookies.js create mode 100644 source/partials/_cookies.html.erb create mode 100644 source/stylesheets/blocks/_cookies.scss create mode 100644 source/whole-page-cookies.html.erb diff --git a/data/cookies.yml b/data/cookies.yml new file mode 100644 index 0000000..e4013c5 --- /dev/null +++ b/data/cookies.yml @@ -0,0 +1,4 @@ +message_es: Este sitio web utiliza cookies para ofrecerte la experiencia más relevante. El uso de este sitio web significa que estás de acuerdo con esto. Puede cambiar las cookies que se establecen en cualquier momento y obtener más información al respecto siguiendo este enlace +message_en: This website uses cookies to give you the most relevant experience. Using this website means you agree with this. You can change which cookies are set at any time and find out more about them by following this link. +button_es: Entendido +button_en: Understood \ No newline at end of file diff --git a/source/images/cookies-icon.svg b/source/images/cookies-icon.svg new file mode 100644 index 0000000..4cd6e08 --- /dev/null +++ b/source/images/cookies-icon.svg @@ -0,0 +1 @@ +cookies-icon \ No newline at end of file diff --git a/source/index.html.erb b/source/index.html.erb index d917cb0..4d28ae3 100644 --- a/source/index.html.erb +++ b/source/index.html.erb @@ -27,6 +27,7 @@ body: home
  • Toolkit
  • 404
  • Maintenance
  • +
  • Cookie box
  • diff --git a/source/javascripts/cookies.js b/source/javascripts/cookies.js new file mode 100644 index 0000000..7600644 --- /dev/null +++ b/source/javascripts/cookies.js @@ -0,0 +1,15 @@ +(function () { + 'use strict'; + + $(document).ready(function(){ + if (!Cookies.get('mb_cookies_accepted')){ + $('body').addClass('cookies-show'); + } + + $('#acceptCookies').click(function(){ + Cookies.set('mb_cookies_accepted', 'true', { expires: 365 }); + $('body').removeClass('cookies-show'); + }) + }); + +})(); diff --git a/source/layouts/layout.erb b/source/layouts/layout.erb index 2e99c04..571c2f4 100644 --- a/source/layouts/layout.erb +++ b/source/layouts/layout.erb @@ -16,5 +16,8 @@ <%= partial "partials/shapes" %> <%= yield %> <%= javascript_include_tag :body %> + + <%= partial "partials/cookies" %> + diff --git a/source/partials/_cookies.html.erb b/source/partials/_cookies.html.erb new file mode 100644 index 0000000..1e42b69 --- /dev/null +++ b/source/partials/_cookies.html.erb @@ -0,0 +1,19 @@ +
    +
    +
    +
    +
    + <%= image_tag 'cookies-icon.svg', alt: 'Cookies icon', title: 'Cookies icon', class: 'center-block' %> +
    +
    +

    <%= data.cookies.message_en %>

    +
    + +
    +
    +
    diff --git a/source/partials/_header.html.erb b/source/partials/_header.html.erb index cd4523e..e4e0d1f 100644 --- a/source/partials/_header.html.erb +++ b/source/partials/_header.html.erb @@ -4,7 +4,7 @@ menu