Skip to content

Commit

Permalink
Merge pull request #261 from alphagov/fix-default-text-for-global-coo…
Browse files Browse the repository at this point in the history
…kie-message

Fix default text for global cookie message
  • Loading branch information
joelanman authored Jun 20, 2016
2 parents b99472b + 6844902 commit 611eed1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Use this file to change prototype configuration.

// Note: this config can be overridden using environment variables (eg on heroku)

module.exports = {

// Cookie warning
cookieText: 'GOV.UK uses cookies to make the site simpler. <a href="https://www.gov.uk/help/cookies" title="Find out more about cookies">Find out more about cookies</a>'

};
4 changes: 4 additions & 0 deletions app/views/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
{% include "includes/snippets_scripts.html" %}
{% endblock %}

{% block cookie_message %}
<p>{{cookieText | safe }}</p>
{% endblock %}

{% block proposition_header %}
{% include "includes/service_manual_navigation.html" %}
{% endblock %}
Expand Down
4 changes: 4 additions & 0 deletions app/views/layout_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
{% include "includes/elements_tracking.html" %}
{% endblock %}

{% block cookie_message %}
<p>{{cookieText | safe }}</p>
{% endblock %}

{% block proposition_header %}
{% include "includes/service_manual_navigation.html" %}
{% endblock %}
Expand Down
7 changes: 7 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var bodyParser = require('body-parser'),
config = require(__dirname + '/app/config.js'),
express = require('express'),
nunjucks = require('express-nunjucks'),
path = require('path'),
Expand Down Expand Up @@ -34,6 +35,12 @@ app.use(function (req, res, next) {
next();
});

// Add variables that are available in all views
app.use(function (req, res, next) {
res.locals.cookieText=config.cookieText;
next();
});

// routes (found in routes.js)

routes.bind(app, '/public/');
Expand Down

0 comments on commit 611eed1

Please sign in to comment.