diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-25 17:07:12 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-25 17:07:12 +0100 |
commit | 29b4fc15528cd88ab1b7b77aa7b9b4632042dd0c (patch) | |
tree | 32692d7a0f220d9af34c5f3c30ae5475ea63f028 /js/public | |
parent | fc16477ba35bc36504f1bebcabeca3b67cdbbf50 (diff) |
provide feedcontroller skeleton methods
Diffstat (limited to 'js/public')
-rw-r--r-- | js/public/app.js | 76 |
1 files changed, 71 insertions, 5 deletions
diff --git a/js/public/app.js b/js/public/app.js index f711b637e..12d4dd9aa 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -97,8 +97,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ]); angular.module('News').controller('FeedController', [ - '$scope', '_FeedController', 'FolderModel', 'FeedModel', function($scope, _FeedController, FolderModel, FeedModel) { - return new _FeedController($scope, FolderModel, FeedModel); + '$scope', '_FeedController', 'FolderModel', 'FeedModel', 'ActiveFeed', 'ShowAll', 'FeedType', 'StarredCount', function($scope, _FeedController, FolderModel, FeedModel, ActiveFeed, ShowAll, FeedType, StarredCount) { + return new _FeedController($scope, FolderModel, FeedModel, ActiveFeed, ShowAll, FeedType, StarredCount); } ]); @@ -140,12 +140,78 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. var FeedController; FeedController = (function() { - function FeedController($scope, folderModel, feedModel) { + function FeedController($scope, _folderModel, _feedModel, _active, _showAll, _feedType, _starredCount) { + var _this = this; this.$scope = $scope; - this.folderModel = folderModel; - this.feedModel = feedModel; + this._folderModel = _folderModel; + this._feedModel = _feedModel; + this._active = _active; + this._showAll = _showAll; + this._feedType = _feedType; + this._starredCount = _starredCount; + this.$scope.feeds = this._feedModel.getAll(); + this.$scope.folders = this._folderModel.getAll(); + this.$scope.feedType = this._feedType; + this.$scope.isFeedActive = function(type, id) { + return _this.isFeedActive(type, id); + }; + this.$scope.isShown = function(type, id) { + return _this.isShown(type, id); + }; + this.$scope.getUnreadCount = function(type, id) { + return _this.getUnreadCount(type, id); + }; + this.$scope.isShowAll = function() { + return _this.isShowAll(); + }; + this.$scope.loadFeed = function(type, id) { + return _this.loadFeed(type, id); + }; + this.$scope.hasFeeds = function(folderId) { + return _this.hasFeeds(folderId); + }; + this.$scope["delete"] = function(type, id) { + return _this["delete"](type, id); + }; + this.$scope.markAllRead = function(type, id) { + return _this.markAllRead(type, id); + }; + this.$scope.getFeedsOfFolder = function(folderId) { + return _this.getFeedsOfFolder(folderId); + }; + this.$scope.setShowAll = function(showAll) { + return _this.setShowAll(showAll); + }; } + FeedController.prototype.isFeedActive = function(type, id) { + return type === this._active.getType() && (id = this._active.getId()); + }; + + FeedController.prototype.isShown = function(type, id) { + if (this.isShowAll()) { + return true; + } else { + return this.getUnreadCount(type, id) > 0; + } + }; + + FeedController.prototype.isShowAll = function() { + return this._showAll.getShowAll(); + }; + + FeedController.prototype.getUnreadCount = function(type, id) {}; + + FeedController.prototype.loadFeed = function(type, id) {}; + + FeedController.prototype.hasFeeds = function(folderId) {}; + + FeedController.prototype["delete"] = function(type, id) {}; + + FeedController.prototype.markAllRead = function(type, id) {}; + + FeedController.prototype.getFeedsOfFolder = function(folderId) {}; + return FeedController; })(); |