Skip to content

Commit

Permalink
Added cookies disclaimer
Browse files Browse the repository at this point in the history
  • Loading branch information
ginestra committed Jul 3, 2019
1 parent 5abe2b6 commit 2e49e88
Show file tree
Hide file tree
Showing 17 changed files with 800 additions and 18 deletions.
5 changes: 1 addition & 4 deletions .vagrant_provisioning/zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ZSH_THEME="robbyrussell"
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(command-not-found colorize debian django history-substring-search linux mercurial pip python zsh-syntax-highlighting)
plugins=(command-not-found colorize debian django history-substring-search mercurial pip python)

# User configuration

Expand All @@ -65,9 +65,6 @@ zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down

# zsh syntax highlighting
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)

# Activates the virtual environment
source ~/venv/bin/activate
# and moves to the project directory
Expand Down
12 changes: 6 additions & 6 deletions assets/js/config-built.js

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions assets/js/config.require.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ requirejs.config({
'es6': '../vendor/requirejs-babel/es6',
'babel': '../vendor/requirejs-babel/babel-5.8.34.min',

'jscookie': '../vendor/js-cookie/src/js.cookie',

// Foundation
'foundation': '../vendor/foundation-sites/js/foundation.core',
'foundation.accordionMenu': '../vendor/foundation-sites/js/foundation.accordionMenu',
Expand Down Expand Up @@ -143,11 +145,14 @@ requirejs.config({
'foundation.util.mediaQuery'
],
},
// 'foundation-datepicker': {
// deps: [
// 'foundation',
// ],
// },
'foundation-datepicker': {
deps: [
'foundation',
],
},
'jscookie': {
exports: 'JScookie'
},
'ga': {
exports: '__ga__'
},
Expand Down
26 changes: 26 additions & 0 deletions assets/js/cookie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
define([
'module',
'jquery',
'jscookie'
], function(module, $, cookie) {
'use strict';

$(document).ready(function() {
if (!cookie.get('kdl-cookie')) {
$("#cookie-disclaimer").removeClass('hide');
}
// Set cookie
$('#cookie-disclaimer .closeme').on("click", function() {
cookie.set('kdl-cookie', 'kdl-cookie-set', {
expires: 30
});
});

$('.closeme').bind("click", function () {
$('#cookie-disclaimer').addClass("hide");
return false;
});
});

return module;
});
9 changes: 8 additions & 1 deletion assets/js/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
// Main
require(["requirejs", "jquery", "fn", "foundation-datepicker", "ga"], function(
require([
"requirejs",
"jquery",
"cookie",
"fn",
"foundation-datepicker",
"ga"
], function(
r,
$,
fn,
Expand Down
19 changes: 19 additions & 0 deletions assets/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ cite:before {
color: $dark-blue;
}

// .hide {
// display: none;
// }

.author,
.datetime,
.more,
Expand Down Expand Up @@ -1161,6 +1165,21 @@ footer,
}
}

// Cookies box

.cookies-box {
background: $primary-color;
bottom: 0;
color: white;
left: 0;
margin: 0;
opacity: 0.95;
padding-top: 20px;
position: fixed;
text-align: center;
width: 100%;
}

/** More media queries **/

@include breakpoint(xlarge up) {
Expand Down
29 changes: 29 additions & 0 deletions assets/vendor/js-cookie/.bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "js-cookie",
"license": "MIT",
"main": [
"src/js.cookie.js"
],
"ignore": [
"travis.sh",
"test",
"Gruntfile.js",
"package.json",
".gitignore",
".jshintignore",
".jshintrc",
".tm_properties",
".travis.yml"
],
"homepage": "https://github.com/js-cookie/js-cookie",
"version": "2.2.0",
"_release": "2.2.0",
"_resolution": {
"type": "version",
"tag": "v2.2.0",
"commit": "34f056cd261982828072b84a9bbdcd8c3d9931ad"
},
"_source": "https://github.com/js-cookie/js-cookie.git",
"_target": "*",
"_originalSource": "js-cookie"
}
79 changes: 79 additions & 0 deletions assets/vendor/js-cookie/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
## Issues

- Report issues or feature requests on [GitHub Issues](https://github.com/js-cookie/js-cookie/issues).
- If reporting a bug, please add a [simplified example](http://sscce.org/).

## Pull requests
- Create a new topic branch for every separate change you make.
- Create a test case if you are fixing a bug or implementing an important feature.
- Make sure the build runs successfully.

## Development

### Tools
We use the following tools for development:

- [Qunit](http://qunitjs.com/) for tests.
- [NodeJS](http://nodejs.org/download/) required to run grunt.
- [Grunt](http://gruntjs.com/getting-started) for task management.

### Getting started
Install [NodeJS](http://nodejs.org/).
Install globally grunt-cli using the following command:

$ npm install -g grunt-cli

Browse to the project root directory and install the dev dependencies:

$ npm install -d

To execute the build and tests run the following command in the root of the project:

$ grunt

You should see a green message in the console:

Done, without errors.

### Tests
You can also run the tests in the browser.
Start a test server from the project root:

$ grunt connect:tests

This will automatically open the test suite at http://127.0.0.1:10000 in the default browser, with livereload enabled.

_Note: we recommend cleaning all the browser cookies before running the tests, that can avoid false positive failures._

### Automatic build
You can build automatically after a file change using the following command:

$ grunt watch

## Integration with server-side

js-cookie allows integrating the encoding test suite with solutions written in other server-side languages. To integrate successfully, the server-side solution need to execute the `test/encoding.html` file in it's integration testing routine with a web automation tool, like [Selenium](http://www.seleniumhq.org/). js-cookie test suite exposes an API to make this happen.

### ?integration_baseurl

Specify the base url to pass the cookies into the server through a query string. If `integration_baseurl` query is not present, then js-cookie will assume there's no server.

### window.global_test_results

After the test suite has finished, js-cookie exposes the global `window.global_test_results` property containing an Object Literal that represents the [QUnit's details](http://api.qunitjs.com/QUnit.done/). js-cookie also adds an additional property representing an Array containing the tests data.

### Handling requests

When js-cookie encoding tests are executed, it will request a url in the server through an iframe representing each test being run. js-cookie expects the server to handle the input and return the proper `Set-Cookie` headers in the response. js-cookie will then read the response and verify if the encoding is consistent with js-cookie default encoding mechanism

js-cookie will send some requests to the server from the baseurl in the format `/encoding?name=<cookie>`, where `<cookie>` represents the cookie-name to be read from the request.

The server should handle those requests, internally parsing the cookie from the request and writing it again. It must set an `application/json` content type containing an object literal in the content body with `name` and `value` keys, each representing the cookie-name and cookie-value decoded by the server-side implementation.

If the server fails to respond with this specification in any request, the related QUnit test will fail. This is to make sure the server-side implementation will always be in sync with js-cookie encoding tests for maximum compatibility.

### Projects using it

This hook is being used in the following projects:

* [Java Cookie](https://github.com/js-cookie/java-cookie).
20 changes: 20 additions & 0 deletions assets/vendor/js-cookie/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright 2014 Klaus Hartl

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 2e49e88

Please sign in to comment.