From 971ca889fc072d0605290ef4a5d8665ac3e898e1 Mon Sep 17 00:00:00 2001 From: Senad Uka Date: Sat, 29 Oct 2016 17:01:09 +0200 Subject: [PATCH] fixed router bug --- app/client/app.less | 4 ++++ app/client/no_access.html | 3 +++ app/client/startup.js | 28 +++++++++++++++------------- app/client/tabs.html | 10 +++++----- app/client/tabs.js | 18 ++++++++++-------- 5 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 app/client/no_access.html diff --git a/app/client/app.less b/app/client/app.less index d1708cb..eac6aae 100644 --- a/app/client/app.less +++ b/app/client/app.less @@ -39,3 +39,7 @@ cursor: pointer; } } + +.clickable { + cursor:pointer; +} diff --git a/app/client/no_access.html b/app/client/no_access.html new file mode 100644 index 0000000..231808d --- /dev/null +++ b/app/client/no_access.html @@ -0,0 +1,3 @@ + diff --git a/app/client/startup.js b/app/client/startup.js index 96f74fd..fabfe9b 100644 --- a/app/client/startup.js +++ b/app/client/startup.js @@ -7,18 +7,20 @@ Tracker.autorun(function() { } }); -Router.route('/', function() { - if (Meteor.zoblak.client.accessible('start')) { - Session.set('templateName', 'start'); - } else { - Session.set('templateName', 'no_access') +function safeRoute(route) { + return function () { + console.log('go ', route); + if (Meteor.zoblak.client.accessible(route)) { + Session.set('templateName', route); + } else { + Session.set('templateName', 'no_access') + } } -}); +} -Router.route('/farmalarm', function() { - if (Meteor.zoblak.client.accessible('alarm')) { - Session.set('templateName', 'alarm'); - } else { - Session.set('templateName', 'no_access') - } -}); + +Router.route('/', safeRoute('start')); +Router.route('/alarm', safeRoute('alarm')); +Router.route('/log', safeRoute('log')); +Router.route('/surveillance', safeRoute('surveillance')); +Router.route('/weather', safeRoute('weather')); diff --git a/app/client/tabs.html b/app/client/tabs.html index f313608..002f10b 100644 --- a/app/client/tabs.html +++ b/app/client/tabs.html @@ -2,23 +2,23 @@