diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-05 11:22:38 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-05 11:22:38 +0200 |
commit | f8451ca565c07cfe42d5cf5a9d3d02cba4f2d773 (patch) | |
tree | 18ad7d2e5bb804e28e3e5be122349d0bbbdbebc5 | |
parent | 76b3dcd712b9bce4b94be58a07c8dbe584ee8f2f (diff) |
bring back show all button
-rw-r--r-- | js/app/controllers/controllers.coffee | 7 | ||||
-rw-r--r-- | js/app/controllers/feedcontroller.coffee | 4 | ||||
-rw-r--r-- | js/app/services/bl/feedbl.coffee | 4 | ||||
-rw-r--r-- | js/public/app.js | 14 | ||||
-rw-r--r-- | js/tests/controllers/feedcontrollerSpec.coffee | 11 | ||||
-rw-r--r-- | js/tests/services/bl/feedblSpec.coffee | 7 | ||||
-rw-r--r-- | templates/part.feed.starred.php | 8 | ||||
-rw-r--r-- | templates/part.feed.unread.php | 18 | ||||
-rw-r--r-- | templates/part.listfeed.php | 18 | ||||
-rw-r--r-- | templates/part.listfolder.php | 20 | ||||
-rw-r--r-- | templates/part.showall.php | 8 |
11 files changed, 75 insertions, 44 deletions
diff --git a/js/app/controllers/controllers.coffee b/js/app/controllers/controllers.coffee index 6598ac692..77c178fef 100644 --- a/js/app/controllers/controllers.coffee +++ b/js/app/controllers/controllers.coffee @@ -30,11 +30,12 @@ angular.module('News').controller 'SettingsController', angular.module('News').controller 'FeedController', ['$scope', '_FeedController', 'Persistence', 'FolderBl', 'FeedBl', -'unreadCountFormatter', -($scope, _FeedController, Persistence, FolderBl, FeedBl, unreadCountFormatter)-> +'SubscriptionsBl', 'StarredBl', 'unreadCountFormatter', +($scope, _FeedController, Persistence, FolderBl, FeedBl, SubscriptionsBl, +StarredBl, unreadCountFormatter)-> return new _FeedController($scope, Persistence, FolderBl, FeedBl, - unreadCountFormatter) + SubscriptionsBl, StarredBl, unreadCountFormatter) ] angular.module('News').controller 'ItemController', diff --git a/js/app/controllers/feedcontroller.coffee b/js/app/controllers/feedcontroller.coffee index 1438b4fbb..7785f3de6 100644 --- a/js/app/controllers/feedcontroller.coffee +++ b/js/app/controllers/feedcontroller.coffee @@ -26,7 +26,7 @@ angular.module('News').factory '_FeedController', -> class FeedController constructor: (@$scope, @_persistence, @_folderBl, @_feedBl, - @_unreadCountFormatter) -> + @_subscriptionsBl, @_starredBl, @_unreadCountFormatter) -> @_isAddingFolder = false @_isAddingFeed = false @@ -34,6 +34,8 @@ angular.module('News').factory '_FeedController', -> # bind internal stuff to scope @$scope.folderBl = @_folderBl @$scope.feedBl = @_feedBl + @$scope.subscriptionsBl = @_subscriptionsBl + @$scope.starredBl = @_starredBl @$scope.unreadCountFormatter = @_unreadCountFormatter diff --git a/js/app/services/bl/feedbl.coffee b/js/app/services/bl/feedbl.coffee index ad51fa339..02adb0f15 100644 --- a/js/app/services/bl/feedbl.coffee +++ b/js/app/services/bl/feedbl.coffee @@ -98,6 +98,10 @@ angular.module('News').factory 'FeedBl', @_persistence.userSettingsReadHide() + isShowAll: -> + return @_showAll.getShowAll() + + getAll: -> return @_feedModel.getAll() diff --git a/js/public/app.js b/js/public/app.js index 20d687649..944f99b7f 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -171,8 +171,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ]); angular.module('News').controller('FeedController', [ - '$scope', '_FeedController', 'Persistence', 'FolderBl', 'FeedBl', 'unreadCountFormatter', function($scope, _FeedController, Persistence, FolderBl, FeedBl, unreadCountFormatter) { - return new _FeedController($scope, Persistence, FolderBl, FeedBl, unreadCountFormatter); + '$scope', '_FeedController', 'Persistence', 'FolderBl', 'FeedBl', 'SubscriptionsBl', 'StarredBl', 'unreadCountFormatter', function($scope, _FeedController, Persistence, FolderBl, FeedBl, SubscriptionsBl, StarredBl, unreadCountFormatter) { + return new _FeedController($scope, Persistence, FolderBl, FeedBl, SubscriptionsBl, StarredBl, unreadCountFormatter); } ]); @@ -214,17 +214,21 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. var FeedController; FeedController = (function() { - function FeedController($scope, _persistence, _folderBl, _feedBl, _unreadCountFormatter) { + function FeedController($scope, _persistence, _folderBl, _feedBl, _subscriptionsBl, _starredBl, _unreadCountFormatter) { var _this = this; this.$scope = $scope; this._persistence = _persistence; this._folderBl = _folderBl; this._feedBl = _feedBl; + this._subscriptionsBl = _subscriptionsBl; + this._starredBl = _starredBl; this._unreadCountFormatter = _unreadCountFormatter; this._isAddingFolder = false; this._isAddingFeed = false; this.$scope.folderBl = this._folderBl; this.$scope.feedBl = this._feedBl; + this.$scope.subscriptionsBl = this._subscriptionsBl; + this.$scope.starredBl = this._starredBl; this.$scope.unreadCountFormatter = this._unreadCountFormatter; this.$scope.isAddingFolder = function() { return _this._isAddingFolder; @@ -642,6 +646,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. } }; + FeedBl.prototype.isShowAll = function() { + return this._showAll.getShowAll(); + }; + FeedBl.prototype.getAll = function() { return this._feedModel.getAll(); }; diff --git a/js/tests/controllers/feedcontrollerSpec.coffee b/js/tests/controllers/feedcontrollerSpec.coffee index 755e84440..b5216db60 100644 --- a/js/tests/controllers/feedcontrollerSpec.coffee +++ b/js/tests/controllers/feedcontrollerSpec.coffee @@ -31,11 +31,12 @@ describe '_FeedController', -> beforeEach inject (@_FeedController, @FolderBl, @FeedBl, $rootScope, - @unreadCountFormatter) => + @unreadCountFormatter, @SubscriptionsBl, @StarredBl) => @scope = $rootScope.$new() @controller = new @_FeedController(@scope, @persistence, @FolderBl, - @FeedBl, @unreadCountFormatter) + @FeedBl, @SubscriptionsBl, @StarredBl, + @unreadCountFormatter) @@ -59,6 +60,12 @@ describe '_FeedController', -> expect(@scope.folderBl).toBe(@FolderBl) + it 'should make SubscriptionsBl available', => + expect(@scope.subscriptionsBl).toBe(@SubscriptionsBl) + + it 'should make StarredBl available', => + expect(@scope.starredBl).toBe(@StarredBl) + it 'should not add folders that have no name', => @persistence.createFolder = jasmine.createSpy('create') @scope.addFolder(' ') diff --git a/js/tests/services/bl/feedblSpec.coffee b/js/tests/services/bl/feedblSpec.coffee index 27b681a32..8cd8100a3 100644 --- a/js/tests/services/bl/feedblSpec.coffee +++ b/js/tests/services/bl/feedblSpec.coffee @@ -179,3 +179,10 @@ describe 'FeedBl', -> expect(@FeedBl.getAll()).toContain(item1) expect(@FeedBl.getAll()).toContain(item2) + + it 'should retunr if ShowAll is set', => + @persistence.userSettingsReadShow = jasmine.createSpy('Show All') + expect(@FeedBl.isShowAll()).toBe(false) + @FeedBl.setShowAll(true) + + expect(@FeedBl.isShowAll()).toBe(true)
\ No newline at end of file diff --git a/templates/part.feed.starred.php b/templates/part.feed.starred.php index 4bd0a5fef..3d0adde03 100644 --- a/templates/part.feed.starred.php +++ b/templates/part.feed.starred.php @@ -1,13 +1,13 @@ -<li ng-class="{ active: isFeedActive(feedType.Starred, 0) }" - ng-show="isShown(feedType.Starred, 0)"> +<li ng-class="{ active: starredBl.isActive(0) }" + ng-show="starredBl.isVisible(0)"> <a class="starred-icon" href="#" - ng-click="loadFeed(feedType.Starred, 0)"> + ng-click="starredBl.load(0)"> <?php p($l->t('Starred')) ?> </a> <span class="utils"> <span class="unread-counter"> - {{ getStarredCount() }} + {{ starredBl.getStarredCount() }} </span> </span> </li>
\ No newline at end of file diff --git a/templates/part.feed.unread.php b/templates/part.feed.unread.php index 85f4c8766..67c57e369 100644 --- a/templates/part.feed.unread.php +++ b/templates/part.feed.unread.php @@ -1,26 +1,26 @@ <li ng-class="{ - active: isFeedActive(feedType.Subscriptions, 0), - unread: getUnreadCount(feedType.Subscriptions, 0)!=0 + active: subscriptionsBl.isActive(0), + unread: subscriptionsBl.getUnreadCount(0) > 0 }" - ng-show="isShown(feedType.Subscriptions, 0)"> + ng-show="subscriptionsBl.isVisible(0)"> <a class="rss-icon" href="#" - ui-if="!isShowAll()" - ng-click="loadFeed(feedType.Subscriptions, 0)"> + ui-if="!feedBl.isShowAll()" + ng-click="subscriptionsBl.load(0)"> <?php p($l->t('Unread articles'))?> </a> <a class="rss-icon" href="#" - ui-if="isShowAll()" - ng-click="loadFeed(feedType.Subscriptions, 0)"> + ui-if="feedBl.isShowAll()" + ng-click="subscriptionsBl.load(0)"> <?php p($l->t('All articles'))?> </a> <span class="utils"> <span class="unread-counter"> - {{ getUnreadCount() }} + {{ subscriptionsBl.getUnreadCount() }} </span> <button class="svg action mark-read-icon" - ng-click="feedBl.markAllRead()" + ng-click="subscriptionsBl.markAllRead()" title="<?php p($l->t('Mark all read')) ?>"></button> </span> </li>
\ No newline at end of file diff --git a/templates/part.listfeed.php b/templates/part.listfeed.php index 4db9cd385..84b99ddee 100644 --- a/templates/part.listfeed.php +++ b/templates/part.listfeed.php @@ -1,17 +1,17 @@ <li ng-class="{ - active: isFeedActive(feedType.Feed, feed.id), - unread: feed.unreadCount!=0 + active: feedBl.isActive(feed.id), + unread: feedBl.getUnreadCount(feed.id) != 0 }" ng-repeat="feed in feedBl.getFeedsOfFolder(<?php p($_['folderId']); ?>)" - ng-show="isShown(feedType.Feed, feed.id)" - data-id="{{feed.id}}" + ng-show="feedBl.isShown(feed.id)" + data-id="{{ feed.id }}" class="feed" draggable> - <a ng-style="{backgroundImage: feed.faviconLink}" + <a ng-style="{ backgroundImage: feed.faviconLink }" href="#" class="title" - ng-click="loadFeed(feedType.Feed, feed.id)"> - {{feed.title}} + ng-click="feedBl.load(feed.id)"> + {{ feed.title }} </a> <span class="utils"> @@ -20,11 +20,11 @@ title="<?php p($l->t('Delete feed')); ?>"></button> <span class="unread-counter"> - {{ getFeedUnreadCount(feed.id) }} + {{ feedBl.getUnreadCount(feed.id) }} </span> <button class="svg action mark-read-icon" - ng-show="feed.unreadCount > 0" + ng-show="feedBl.getUnreadCount(feed.id) > 0" ng-click="feedBl.markFeedRead(feed.id)" title="<?php p($l->t('Mark all read')); ?>"></button> diff --git a/templates/part.listfolder.php b/templates/part.listfolder.php index 6d02aea7a..e97de5f9b 100644 --- a/templates/part.listfolder.php +++ b/templates/part.listfolder.php @@ -1,10 +1,11 @@ <li ng-class="{ - active: isFeedActive(feedType.Folder, folder.id), - open: folder.open, - collapsible: folderBl.hasFeeds(folder.id), - unread: getFolderUnreadCount(folder.id) != 0}" + active: folderBl.isActive(folder.id), + open: folder.open, + collapsible: folderBl.hasFeeds(folder.id), + unread: folderBl.getUnreadCount(folder.id) != 0 + }" ng-repeat="folder in folders" - ng-show="isShown(feedType.Folder, folder.id)" + ng-show="folderBl.isVisible(folder.id)" class="folder" data-id="{{folder.id}}" droppable> @@ -13,23 +14,24 @@ ng-click="folderBl.toggleFolder(folder.id)"></button> <a href="#" class="title folder-icon" - ng-click="loadFeed(feedType.Folder, folder.id)"> + ng-click="folderBl.load(folder.id)"> {{folder.name}} </a> <span class="utils"> <button ng-click="folderBl.delete(folder.id)" + ng-hide="folderBl.hasFeeds(folder.id)" class="svg action delete-icon" title="<?php p($l->t('Delete folder')); ?>"></button> <span class="unread-counter"> - {{ getUnreadCount(feedType.Folder, folder.id) }} + {{ folderBl.getUnreadCount(folder.id) }} </span> <button class="svg action mark-read-icon" - ng-show="getUnreadCount(feedType.Feed, feed.id)>0" - ng-click="markAllRead(feedType.Folder, folder.id)" + ng-show="folderBl.getUnreadCount(feedType.Feed, feed.id) > 0" + ng-click="folderBl.markFolderRead(folder.id)" title="<?php p($l->t('Mark all read')); ?>"></button> <!-- <button class="svg action edit-icon" diff --git a/templates/part.showall.php b/templates/part.showall.php index 6555bfa79..a99e821ee 100644 --- a/templates/part.showall.php +++ b/templates/part.showall.php @@ -1,7 +1,7 @@ -<li ui-if="!isShowAll() && isShown(feedType.Subscriptions, 0)" class="show-all"> - <a ng-click="setShowAll(true)" href="#"><?php p($l->t('Show all')); ?></a> +<li ui-if="!feedBl.isShowAll() && subscriptionsBl.isVisible(0)" class="show-all"> + <a ng-click="feedBl.setShowAll(true)" href="#"><?php p($l->t('Show all')); ?></a> </li> -<li ui-if="isShowAll() && isShown(feedType.Subscriptions, 0)" class="show-all"> - <a ng-click="setShowAll(false)" href="#"><?php p($l->t('Show only unread')); ?></a> +<li ui-if="feedBl.isShowAll() && subscriptionsBl.isVisible(0)" class="show-all"> + <a ng-click="feedBl.setShowAll(false)" href="#"><?php p($l->t('Show only unread')); ?></a> </li> |