diff options
Diffstat (limited to 'js/app/controllers')
-rw-r--r-- | js/app/controllers/controllers.coffee | 9 | ||||
-rw-r--r-- | js/app/controllers/feedcontroller.coffee | 72 |
2 files changed, 77 insertions, 4 deletions
diff --git a/js/app/controllers/controllers.coffee b/js/app/controllers/controllers.coffee index 27603ef52..59f2db39e 100644 --- a/js/app/controllers/controllers.coffee +++ b/js/app/controllers/controllers.coffee @@ -29,10 +29,13 @@ angular.module('News').controller 'SettingsController', angular.module('News').controller 'FeedController', -['$scope', '_FeedController', 'FolderModel', 'FeedModel', -($scope, _FeedController, FolderModel, FeedModel)-> +['$scope', '_FeedController', 'FolderModel', 'FeedModel', 'ActiveFeed', +'ShowAll', 'FeedType', 'StarredCount', +($scope, _FeedController, FolderModel, FeedModel, ActiveFeed, +ShowAll, FeedType, StarredCount)-> - return new _FeedController($scope, FolderModel, FeedModel) + return new _FeedController($scope, FolderModel, FeedModel, ActiveFeed, + ShowAll, FeedType, StarredCount) ] angular.module('News').controller 'ItemController', diff --git a/js/app/controllers/feedcontroller.coffee b/js/app/controllers/feedcontroller.coffee index a641a8a9c..535ed00ac 100644 --- a/js/app/controllers/feedcontroller.coffee +++ b/js/app/controllers/feedcontroller.coffee @@ -25,7 +25,77 @@ angular.module('News').factory '_FeedController', -> class FeedController - constructor: (@$scope, @folderModel, @feedModel) -> + constructor: (@$scope, @_folderModel, @_feedModel, @_active, + @_showAll, @_feedType, @_starredCount) -> + + # bind internal stuff to scope + @$scope.feeds = @_feedModel.getAll() + @$scope.folders = @_folderModel.getAll() + @$scope.feedType = @_feedType + + @$scope.isFeedActive = (type, id) => + return @isFeedActive(type, id) + + @$scope.isShown = (type, id) => + return @isShown(type, id) + + @$scope.getUnreadCount = (type, id) => + return @getUnreadCount(type, id) + + @$scope.isShowAll = => + return @isShowAll() + + @$scope.loadFeed = (type, id) => + @loadFeed(type, id) + + @$scope.hasFeeds = (folderId) => + return @hasFeeds(folderId) + + @$scope.delete = (type, id) => + @delete(type, id) + + @$scope.markAllRead = (type, id) => + @markAllRead(type, id) + + @$scope.getFeedsOfFolder = (folderId) => + return @getFeedsOfFolder(folderId) + + @$scope.setShowAll = (showAll) => + @setShowAll(showAll) + + + isFeedActive: (type, id) -> + return type == @_active.getType() and id = @_active.getId() + + + isShown: (type, id) -> + if @isShowAll() + return true + else + return @getUnreadCount(type, id) > 0 + + + isShowAll: -> + return @_showAll.getShowAll() + + + getUnreadCount: (type, id) -> + + + loadFeed: (type, id) -> + + + hasFeeds: (folderId) -> + + + delete: (type, id) -> + + + markAllRead: (type, id) -> + + + getFeedsOfFolder: (folderId) -> + return FeedController
\ No newline at end of file |