From 330c4374f6e1824c265fb77ec3ae4e34c297bf85 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 8 Apr 2015 12:57:25 +0200 Subject: Remove spaces from URLs (improve slugs) --- js/campus-coords.js | 6 +++++- js/campus.js | 4 ++-- js/sitemap.js | 2 +- pages/campus.html | 12 ++++++------ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/js/campus-coords.js b/js/campus-coords.js index 3654a56..fc0f3cc 100644 --- a/js/campus-coords.js +++ b/js/campus-coords.js @@ -1,6 +1,6 @@ define(function() { 'use strict'; - return [ + var buildings = [ { "name": "Students Sports Centre", "description": "Have you ever heard about bossaball, underwater hockey, canoepolo or kempo jitsu? Besides all educational optionalities on the campus, there’s also the Student Sports Centre (SSC) which offers an extensive variety of sports for you to try out and practice, all in order to keep the TU/e-students wholesome. With 70 kinds of sports, special courses, a broad range of facilities, doors that are open 7 days per week, qualified sports instructors, 38 student sports associations and over 11000 members, the SSC is among the largest student collectives in Eindhoven.", @@ -109,4 +109,8 @@ define(function() { ] } ]; + buildings.forEach(function(building) { + building.id = building.name.toLowerCase().replace(/ /g, '-'); + }); + return buildings; }); diff --git a/js/campus.js b/js/campus.js index 234e1b9..8d6846b 100644 --- a/js/campus.js +++ b/js/campus.js @@ -33,7 +33,7 @@ define(['campus-coords', 'd3'], function(coords, d3) { .enter() .append('a') .attr('xlink:href', function(d) { - return '#/campus/' + d.name; + return '#/campus/' + d.id; }) .append('polygon') .attr('class', 'building') @@ -53,7 +53,7 @@ define(['campus-coords', 'd3'], function(coords, d3) { var citems = document.getElementById('campus-items'); coords.forEach(function(building) { var header = document.createElement('h2'); - header.id = '/campus/' + building.name; + header.id = '/campus/' + building.id; header.textContent = building.name; citems.appendChild(header); diff --git a/js/sitemap.js b/js/sitemap.js index 65b05c8..e4c4e77 100644 --- a/js/sitemap.js +++ b/js/sitemap.js @@ -22,7 +22,7 @@ define(['courses', 'campus-coords'], function(courses, campus_coords) { var campus_links = add(links, 'Campus', 'campus'); campus_coords.forEach(function(building) { - add(campus_links, building.name, 'campus/' + building.name); + add(campus_links, building.name, 'campus/' + building.id); }); add(links, 'Career', 'career'); diff --git a/pages/campus.html b/pages/campus.html index b39d3d7..e319174 100644 --- a/pages/campus.html +++ b/pages/campus.html @@ -6,12 +6,12 @@ require(['campus'], function(main) { main(); });

The successes of the Technical University of Eindhoven are built on its lively heart; meet the TU/e campus. Any location can be reached within five minutes by -bicycle while a shuttle bus travels between various locations on the campus and the -train station in the centre of Eindhoven. There are also enough parking possibilities on the campus. Feel free to -explore the map below to gain knowledge about the multifunctionality of the -campus. +bicycle while a shuttle bus travels between various locations on +the campus and the train station in the centre of Eindhoven. There are also +enough parking possibilities on the campus. Feel +free to explore the map below to gain knowledge about the multifunctionality of +the campus.

-- cgit v1.2.1