diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-10-06 14:50:39 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-10-06 14:50:39 +0200 |
commit | 0ae9051e7fd6fa740c9defc628303e33a62fea58 (patch) | |
tree | 50d3b6e511016dcbe3915dee1fe13da30a293b30 /js/controller/NavigationController.js | |
parent | bb60778a9be458e4bb3ea60639e9091686d40ba3 (diff) |
only get route id if route with an id is present
Diffstat (limited to 'js/controller/NavigationController.js')
-rw-r--r-- | js/controller/NavigationController.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/js/controller/NavigationController.js b/js/controller/NavigationController.js index 217422a7a..9a103df0b 100644 --- a/js/controller/NavigationController.js +++ b/js/controller/NavigationController.js @@ -15,6 +15,10 @@ function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, this.feedError = ''; this.folderError = ''; + var getRouteId = function () { + return parseInt($route.current.params.id, 10); + }; + this.getFeeds = function () { return FeedResource.getAll(); }; @@ -82,7 +86,7 @@ function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, var type = $route.current.$$route.type; if (type === FEED_TYPE.FEED) { - var feed = FeedResource.getById($route.current.params.id); + var feed = FeedResource.getById(getRouteId()); if (feed !== undefined && feed.folderId === folderId) { return true; @@ -103,17 +107,15 @@ function ($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, }; this.isFolderActive = function (folderId) { - var currentId = parseInt($route.current.params.id, 10); return $route.current && $route.current.$$route.type === FEED_TYPE.FOLDER && - currentId === folderId; + getRouteId() === folderId; }; this.isFeedActive = function (feedId) { - var currentId = parseInt($route.current.params.id, 10); return $route.current && $route.current.$$route.type === FEED_TYPE.FEED && - currentId === feedId; + getRouteId() === feedId; }; this.folderNameExists = function (folderName) { |