From bced4d05cd9c37dbe7cc9ed04149faed1f6b974b Mon Sep 17 00:00:00 2001 From: Mathis Neumann <mathis@simpletechs.net> Date: Thu, 23 Jun 2016 18:37:20 +0200 Subject: [PATCH] add 404 page and better templates --- app/router.js | 2 ++ app/routes/not-found.js | 9 +++++++++ app/templates/deployments/index.hbs | 15 ++++++++------- app/templates/home.hbs | 3 +++ app/templates/not-found.hbs | 6 ++++++ 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 app/routes/not-found.js create mode 100644 app/templates/home.hbs create mode 100644 app/templates/not-found.hbs diff --git a/app/router.js b/app/router.js index 2d1a97b..b5ef635 100644 --- a/app/router.js +++ b/app/router.js @@ -12,6 +12,8 @@ Router.map(function() { this.route('details', {path: '/:entityType/:entityId'}); // use model properties for automatic matching }); }); + + this.route('not-found', { path: '*path' }); }); export default Router; diff --git a/app/routes/not-found.js b/app/routes/not-found.js new file mode 100644 index 0000000..985ada3 --- /dev/null +++ b/app/routes/not-found.js @@ -0,0 +1,9 @@ +import Ember from 'ember'; +export default Ember.Route.extend({ + redirect: function () { + var url = this.router.location.formatURL('/not-found'); + if (window.location.pathname !== url) { + this.replaceWith('/not-found'); + } + } +}); \ No newline at end of file diff --git a/app/templates/deployments/index.hbs b/app/templates/deployments/index.hbs index 9cfa810..2274e31 100644 --- a/app/templates/deployments/index.hbs +++ b/app/templates/deployments/index.hbs @@ -1,9 +1,10 @@ -{{model.length}} - -<ul> -{{#each model as |system| }} - <li>{{#link-to 'deployments.single' system.id}}{{system.name}}{{/link-to}}</li> -{{/each}} -</ul> +<div class="container"> + <h3>Available Deployments</h3> + <ul> + {{#each model as |system| }} + <li>{{#link-to 'deployments.single' system.id}}{{system.name}}{{/link-to}}</li> + {{/each}} + </ul> +</div> {{outlet}} \ No newline at end of file diff --git a/app/templates/home.hbs b/app/templates/home.hbs new file mode 100644 index 0000000..3c350cf --- /dev/null +++ b/app/templates/home.hbs @@ -0,0 +1,3 @@ +<div class="container"> + This app currently only supports {{link-to 'deployments' 'deployments'}}. +</div> \ No newline at end of file diff --git a/app/templates/not-found.hbs b/app/templates/not-found.hbs new file mode 100644 index 0000000..bc1cff2 --- /dev/null +++ b/app/templates/not-found.hbs @@ -0,0 +1,6 @@ +<div class="container"> + <h1>404 Not Found</h1> + <p> + This url does not exist. Maybe a link has changed, try the {{link-to 'home page' 'home'}} + </p> +</div> \ No newline at end of file -- GitLab