From ecee282fc4e81a73c4aafeafe8ca9d08d2307def Mon Sep 17 00:00:00 2001 From: farhatahmad <35435341+farhatahmad@users.noreply.github.com> Date: Fri, 1 Feb 2019 12:54:29 -0500 Subject: [PATCH] GRN-19: Add confirmation for accepting cookies from the site (#345) * Added a cookie warning * Cleaned up code to better match application standard --- app/assets/javascripts/cookies.js | 27 +++++++++++++++++++ app/assets/stylesheets/application.scss | 12 ++++----- .../stylesheets/utilities/_variables.scss | 24 +++++++++++++++++ app/views/shared/_footer.html.erb | 2 ++ .../components/_cookie_warning.html.erb | 27 +++++++++++++++++++ config/locales/en.yml | 3 +++ 6 files changed, 89 insertions(+), 6 deletions(-) create mode 100644 app/assets/javascripts/cookies.js create mode 100644 app/assets/stylesheets/utilities/_variables.scss create mode 100644 app/views/shared/components/_cookie_warning.html.erb diff --git a/app/assets/javascripts/cookies.js b/app/assets/javascripts/cookies.js new file mode 100644 index 00000000..d6d7efba --- /dev/null +++ b/app/assets/javascripts/cookies.js @@ -0,0 +1,27 @@ +// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. +// +// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). +// +// This program is free software; you can redistribute it and/or modify it under the +// terms of the GNU Lesser General Public License as published by the Free Software +// Foundation; either version 3.0 of the License, or (at your option) any later +// version. +// +// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License along +// with BigBlueButton; if not, see . + +$(document).ready(function() { + $("#cookies-agree-button").click(function() { + //create a cookie that lasts 1 year + var cookieDate = new Date(); + cookieDate.setFullYear(cookieDate.getFullYear() + 1); //1 year from now + document.cookie = "cookie_consented=true; path=/; expires=" + cookieDate.toUTCString() + ";" + + //hide the banner at the bottom + $(".cookies-banner").attr("style","display:none !important") + }) +}) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index beb87167..b4b5244d 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -34,18 +34,13 @@ @import "bootstrap"; @import "tabler-custom"; +@import "utilities/variables"; @import "main"; @import "rooms"; @import "sessions"; @import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,400,400i,500,500i,600,600i,700,700i&subset=latin-ext); -$background-color: #F5F7FB; -$error-background-color: #EFE6E6; - -$header-height: 65px; -$footer-height: 65px; - html, body { position: relative; width: 100%; @@ -130,3 +125,8 @@ a { [contenteditable]:focus { outline: 0px solid transparent; } + +.cookies-banner { + height: $footer-height; + background-color: $background-color; +} diff --git a/app/assets/stylesheets/utilities/_variables.scss b/app/assets/stylesheets/utilities/_variables.scss new file mode 100644 index 00000000..700d9325 --- /dev/null +++ b/app/assets/stylesheets/utilities/_variables.scss @@ -0,0 +1,24 @@ +/* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. +* +* Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 3.0 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +*/ +// Declare all variables here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ +$background-color: #F5F7FB; +$error-background-color: #EFE6E6; +$button-color-blue: #467FCF; +$header-height: 65px; +$footer-height: 65px; diff --git a/app/views/shared/_footer.html.erb b/app/views/shared/_footer.html.erb index 230ab037..f9867aa1 100755 --- a/app/views/shared/_footer.html.erb +++ b/app/views/shared/_footer.html.erb @@ -16,3 +16,5 @@

<%= t("footer.powered_by", href: link_to(t("greenlight"), "https://bigbluebutton.org/2018/07/09/greenlight-2-0/", target: "_blank")).html_safe %> v <%= Greenlight::Application::VERSION %>

+ +<%= render "shared/components/cookie_warning" %> diff --git a/app/views/shared/components/_cookie_warning.html.erb b/app/views/shared/components/_cookie_warning.html.erb new file mode 100644 index 00000000..ca054c20 --- /dev/null +++ b/app/views/shared/components/_cookie_warning.html.erb @@ -0,0 +1,27 @@ +<% +# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. +# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). +# This program is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free Software +# Foundation; either version 3.0 of the License, or (at your option) any later +# version. +# +# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +# You should have received a copy of the GNU Lesser General Public License along +# with BigBlueButton; if not, see . +%> + + <% if cookies && cookies['cookie_consented'] != 'true' %> +
+
+ + <%= t("cookies.cookie_info") %> + + + + +
+
+ <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 16e581e4..b99b68d3 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -24,6 +24,9 @@ en: bigbluebutton: BigBlueButton bigbluebutton_exception: Oops, there was an error when starting the meeting! cancel: Cancel + cookies: + cookie_info: Cookies help us deliver our services. By using our services, you agree to our use of cookies. + cookie_button: I Agree copy: Copy delete: Delete delivery_error: An error occured during email delivery. Please contact an administrator!