From df5d72d42941eedf487a483b5945552724fd9d4f Mon Sep 17 00:00:00 2001 From: rr- <rr-@sakuya.pl> Date: Sat, 21 May 2016 12:03:31 +0200 Subject: [PATCH] client/general: show correct URL in 404 page --- client/html/not_found.tpl | 2 +- client/js/controllers/home_controller.js | 6 +++--- client/js/views/not_found_view.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/html/not_found.tpl b/client/html/not_found.tpl index 7804fda..ac963d4 100644 --- a/client/html/not_found.tpl +++ b/client/html/not_found.tpl @@ -1,5 +1,5 @@ <div class='not-found'> <img src='/404.png' alt='404 Not found'/> - <p><%= window.location.pathname %> is not a valid URL.</p> + <p><%= ctx.path %> is not a valid URL.</p> <p><a href='/'>Back to main page</a></p> </div> diff --git a/client/js/controllers/home_controller.js b/client/js/controllers/home_controller.js index a4c2f7f..234c04a 100644 --- a/client/js/controllers/home_controller.js +++ b/client/js/controllers/home_controller.js @@ -13,7 +13,7 @@ class HomeController { registerRoutes() { page('/', (ctx, next) => { this._indexRoute(); }); - page('*', (ctx, next) => { this._notFoundRoute(); }); + page('*', (ctx, next) => { this._notFoundRoute(ctx); }); } _indexRoute() { @@ -21,9 +21,9 @@ class HomeController { this._homeView.render({}); } - _notFoundRoute() { + _notFoundRoute(ctx) { topNavController.activate(''); - this._notFoundView.render({}); + this._notFoundView.render({path: ctx.canonicalPath}); } } diff --git a/client/js/views/not_found_view.js b/client/js/views/not_found_view.js index f4ce884..507174c 100644 --- a/client/js/views/not_found_view.js +++ b/client/js/views/not_found_view.js @@ -10,7 +10,7 @@ class NotFoundView { render(ctx) { const target = document.getElementById('content-holder'); - const source = this._template({}); + const source = this._template(ctx); views.showView(target, source); } }