From 1a54c2abec7e05c60d7bf6eda7259b8e08a92dde Mon Sep 17 00:00:00 2001 From: nachoparker Date: Sat, 11 May 2019 08:08:14 +0000 Subject: [PATCH] add "mark read" floating button mobile. Fixes #469 (#505) Signed-off-by: nachoparker --- css/app.css | 9 ++++++++- css/mobile.css | 3 +++ js/controller/NavigationController.js | 13 +++++++++++++ lib/Controller/FeedController.php | 2 +- templates/part.content.php | 4 ++++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/css/app.css b/css/app.css index ffaf63617..86a367e0d 100644 --- a/css/app.css +++ b/css/app.css @@ -44,7 +44,14 @@ display: block !important; } +#mark-all-read-button { + position: fixed; + z-index: 1; + bottom: 0.5em; + right: 0.5em; +} + /* Override hidden before angular is loaded */ [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak, .ng-hide:not(.ng-hide-animate) { display: none !important; -} \ No newline at end of file +} diff --git a/css/mobile.css b/css/mobile.css index cf34507fc..83e228b2f 100644 --- a/css/mobile.css +++ b/css/mobile.css @@ -11,6 +11,9 @@ width: 100%; } + #mark-all-read-button { + display: block; + } } @media only screen and (max-width: 600px) { diff --git a/js/controller/NavigationController.js b/js/controller/NavigationController.js index e79202574..e4306c9a8 100644 --- a/js/controller/NavigationController.js +++ b/js/controller/NavigationController.js @@ -36,6 +36,19 @@ app.controller('NavigationController', function ($route, FEED_TYPE, FeedResource return FolderResource.getAll(); }; + this.markCurrentRead = function () { + var id = getRouteId(); + var type = $route.current.$$route.type; + + if(isNaN(id)) { + this.markRead(); + } else if(type === FEED_TYPE.FOLDER) { + this.markFolderRead(id); + } else if(type === FEED_TYPE.FEED) { + this.markFeedRead(id); + } + }; + this.markFolderRead = function (folderId) { FeedResource.markFolderRead(folderId); diff --git a/lib/Controller/FeedController.php b/lib/Controller/FeedController.php index dbb36bb02..32e9bd232 100644 --- a/lib/Controller/FeedController.php +++ b/lib/Controller/FeedController.php @@ -207,7 +207,7 @@ class FeedController extends Controller return [ 'feeds' => [ - // only pass unread count to not accidentally readd + // only pass unread count to not accidentally read // the feed again [ 'id' => $feed->getId(), diff --git a/templates/part.content.php b/templates/part.content.php index c240053ca..6b57af338 100644 --- a/templates/part.content.php +++ b/templates/part.content.php @@ -12,6 +12,10 @@

t('No articles available')) ?>

t('No unread articles available')) ?>

+ +