Permalink
Browse files

Create info pages

  • Loading branch information...
1 parent 0a19f48 commit aa3d9b8fe2ab87454599024718ec7b266d35f4e9 @evdb evdb committed Apr 24, 2012
@@ -213,6 +213,9 @@ exports.route = function (app) {
});
+
+ require('./info').route(app);
+
// Throw a 404 error
app.all('/*', function(req, res, next) {
next(new Error404());
View
@@ -0,0 +1,20 @@
+var path = require('path'),
+ Error404 = require('../../lib/errors').Error404;
+
+exports.route = function (app) {
+ app.get('/info/:page', function(req, res, next){
+
+ var template_file = req.app.set('views') + '/info/' + req.param('page') + '.jade';
+
+ path.exists(template_file, function (exists) {
+ if (exists) {
+ res.render( 'info/' + req.param('page') );
+ } else {
+ next(new Error404());
+ }
+ });
+
+ });
+};
+
+
@@ -0,0 +1,3 @@
+extends ../layout
+
+// info page specific layout changes can go here
@@ -0,0 +1,8 @@
+extend layout
+
+block title
+ | Privacy
+
+block content
+ h1 Privacy
+ p FIXME: privacy text goes here
@@ -71,7 +71,7 @@ body#popit-united_kingdom.brand_page
li
a(href='/FIXME') Self Hosting
li
- a(href='/FIXME') Terms & Privacy Policy
+ a(href='/info/privacy') Terms & Privacy Policy
#about-mysociety
p
| PopIt is a project from mySociety, a charitable project which builds websites that give people simple, tangible benefits in the civic and community, and teaches through demonstration, how to use the internet most efficiently to improve lives.
@@ -0,0 +1,46 @@
+// switch to testing mode
+process.env.NODE_ENV = 'testing';
+
+var utils = require('../lib/utils'),
+ selenium_helpers = require('../lib/testing/selenium'),
+ config = require('config'),
+ async = require('async');
+
+
+
+module.exports = {
+
+ setUp: function (setUp_done) {
+
+ utils.delete_all_testing_databases( function () {
+ selenium_helpers.start_servers( function () {
+ setUp_done();
+ });
+ });
+ },
+
+ tearDown: function (tearDown_done) {
+ selenium_helpers.stop_servers(tearDown_done);
+ },
+
+ "Check info pages": function (test) {
+
+ var browser = selenium_helpers.new_hosting_browser();
+
+ test.expect(2);
+
+ browser
+ .open('/info/does_not_exist')
+ .assertTextPresent('Page not found')
+ .open('/info/privacy')
+ .assertTextPresent('privacy text goes here')
+ .testComplete()
+ .end(function (err) {
+ test.ifError(err);
+ test.ok(true, "end of tests");
+ test.done();
+ });
+ },
+
+};
+

0 comments on commit aa3d9b8

Please sign in to comment.