From 320304c909dc12c14b53335a7f32550809c06178 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 29 May 2014 23:10:55 +0200 Subject: dont mark read on scroll --- js/build/app.js | 8 ++++++++ js/controller/ContentController.js | 10 ++++++++++ js/tests/unit/controller/ContentControllerSpec.js | 24 +++++++++++++++++++++++ templates/main.php | 7 ++++++- 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/js/build/app.js b/js/build/app.js index 3e0e5624e..eb16bafb3 100644 --- a/js/build/app.js +++ b/js/build/app.js @@ -183,6 +183,8 @@ var $__build_47_app__ = function () { 'data', function (Publisher, FeedResource, ItemResource, SettingsResource, data) { 'use strict'; + var $__0 = this; + this.isAutoPagingEnabled = true; ItemResource.clear(); Publisher.publishAll(data); this.getItems = function () { @@ -226,6 +228,12 @@ var $__build_47_app__ = function () { this.scrollRead = function (itemIds) { console.log(itemIds); }; + this.autoPagingEnabled = function () { + return $__0.isAutoPagingEnabled; + }; + this.markReadEnabled = function () { + return !SettingsResource.get('preventReadOnScroll'); + }; } ]); app.controller('NavigationController', [ diff --git a/js/controller/ContentController.js b/js/controller/ContentController.js index 164fa8662..804c898e5 100644 --- a/js/controller/ContentController.js +++ b/js/controller/ContentController.js @@ -11,6 +11,8 @@ app.controller('ContentController', function (Publisher, FeedResource, ItemResource, SettingsResource, data) { 'use strict'; + this.isAutoPagingEnabled = true; + ItemResource.clear(); // distribute data to models based on key @@ -70,4 +72,12 @@ function (Publisher, FeedResource, ItemResource, SettingsResource, data) { console.log(itemIds); }; + this.autoPagingEnabled = () => { + return this.isAutoPagingEnabled; + }; + + this.markReadEnabled = () => { + return !SettingsResource.get('preventReadOnScroll'); + }; + }); \ No newline at end of file diff --git a/js/tests/unit/controller/ContentControllerSpec.js b/js/tests/unit/controller/ContentControllerSpec.js index 658ae9252..8757cb5c5 100644 --- a/js/tests/unit/controller/ContentControllerSpec.js +++ b/js/tests/unit/controller/ContentControllerSpec.js @@ -185,4 +185,28 @@ describe('ContentController', () => { expect(ctrl.isCompactView()).toBe(true); })); + + + it('should publish markread', inject(($controller, SettingsResource) => { + + SettingsResource.set('preventReadOnScroll', true); + + let ctrl = $controller('ContentController', { + SettingsResource: SettingsResource, + data: {}, + }); + + expect(ctrl.markReadEnabled()).toBe(false); + })); + + + it('should publish autopaging', inject(($controller) => { + let ctrl = $controller('ContentController', { + data: {}, + }); + + expect(ctrl.autoPagingEnabled()).toBe(true); + })); + + }); diff --git a/templates/main.php b/templates/main.php index ffbdb1a9a..1656dab25 100644 --- a/templates/main.php +++ b/templates/main.php @@ -45,6 +45,11 @@ ng-class="{'icon-loading': App.loading.isLoading('content')}" ng-hide="App.loading.isLoading('global')" ng-view - tabindex="-1"> + tabindex="-1" + news-scroll + news-scroll-enabled-auto-page="Content.isAutoPaging()" + news-scroll-enabled-mark-read="Content.isMarkRead()" + news-scroll-auto-page="Content.autoPage()" + news-scroll-mark-read="Content.markRead($itemIds)"> -- cgit v1.2.3