From 5b4f3d29e4800f12297092ba6b6813581de77169 Mon Sep 17 00:00:00 2001 From: Cesar Enrique Garcia Dabo Date: Sat, 11 Apr 2020 02:21:56 +0200 Subject: Always show the unread articles. The unread articles folder will always be visible, regardless of the "Show all" setting. If that setting is on, then an additional "All articles" folder will be show as before, but it doesn't substitute the "Uread articles" one. A new URL /apps/news/#/items/unread is also created that jumps to the unread articles. Signed-off-by: Cesar Enrique Garcia Dabo --- js/app/Config.js | 9 ++++++++- js/app/Run.js | 10 +++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/app/Config.js b/js/app/Config.js index 3b808063d..f7c62e7ae 100644 --- a/js/app/Config.js +++ b/js/app/Config.js @@ -16,7 +16,8 @@ app.config(function ($routeProvider, $provide, $httpProvider, $locationProvider) STARRED: 2, SUBSCRIPTIONS: 3, SHARED: 4, - EXPLORE: 5 + EXPLORE: 5, + UNREAD: 6 }; // default hashPrefix changed in angular 1.6 to '!' @@ -190,6 +191,12 @@ app.config(function ($routeProvider, $provide, $httpProvider, $locationProvider) resolve: getItemResolve(feedType.STARRED), type: feedType.STARRED }) + .when('/items/unread', { + controller: 'ContentController as Content', + templateUrl: 'content.html', + resolve: getItemResolve(feedType.UNREAD), + type: feedType.UNREAD + }) .when('/items/feeds/:id', { controller: 'ContentController as Content', templateUrl: 'content.html', diff --git a/js/app/Run.js b/js/app/Run.js index 0500faa35..1a1572864 100644 --- a/js/app/Run.js +++ b/js/app/Run.js @@ -17,7 +17,7 @@ app.run(function ($rootScope, $location, $http, $q, $interval, $route, Loading, // listen to keys in returned queries to automatically distribute the // incoming values to models Publisher.subscribe(ItemResource).toChannels(['items', 'newestItemId', - 'starred']); + 'starred', 'unread']); Publisher.subscribe(FolderResource).toChannels(['folders']); Publisher.subscribe(FeedResource).toChannels(['feeds']); Publisher.subscribe(SettingsResource).toChannels(['settings']); @@ -49,12 +49,16 @@ app.run(function ($rootScope, $location, $http, $q, $interval, $route, Loading, url = '/explore'; break; + case FEED_TYPE.UNREAD: + url = '/items/unread'; + break; + default: url = '/items'; } // only redirect if url is empty or faulty - if (!/^\/items(\/(starred|explore|feeds\/\d+|folders\/\d+))?\/?$/ + if (!/^\/items(\/(starred|unread|explore|feeds\/\d+|folders\/\d+))?\/?$/ .test(path)) { $location.path(url); } @@ -126,4 +130,4 @@ app.run(function ($rootScope, $location, $http, $q, $interval, $route, Loading, $location.path('/items'); }); -}); \ No newline at end of file +}); -- cgit v1.2.3