summaryrefslogtreecommitdiffstats
path: root/js/public/app.js
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-03-25 21:50:49 +0100
committerBernhard Posselt <nukeawhale@gmail.com>2013-03-25 21:50:49 +0100
commit0430a6ca38545463d7eea070204d77bddb447437 (patch)
tree8a0b9dcbc54aab0b327f7b794d2d74861c26d019 /js/public/app.js
parent7ade1165ddd0aa2d650ea28ae2f38a412375f9cc (diff)
added more feedcontroller methods
Diffstat (limited to 'js/public/app.js')
-rw-r--r--js/public/app.js54
1 files changed, 52 insertions, 2 deletions
diff --git a/js/public/app.js b/js/public/app.js
index 51f6dcad8..d8303f06f 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -242,9 +242,48 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
return this._feedModel.getAllOfFolder(folderId).length;
};
- FeedController.prototype["delete"] = function(type, id) {};
+ FeedController.prototype["delete"] = function(type, id) {
+ var count;
+ switch (type) {
+ case this._feedType.Feed:
+ count = this._feedModel.removeById(id);
+ return this._persistence.deleteFeed(id);
+ case this._feedType.Folder:
+ count = this._folderModel.removeById(id);
+ return this._persistence.deleteFolder(id);
+ }
+ };
- FeedController.prototype.markAllRead = function(type, id) {};
+ FeedController.prototype.markAllRead = function(type, id) {
+ var feed, highestItemId, _i, _j, _len, _len1, _ref, _ref1, _results, _results1;
+ switch (type) {
+ case this._feedType.Subscriptions:
+ _ref = this._feedModel.getAll();
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ feed = _ref[_i];
+ _results.push(this.markAllRead(this._feedType.Feed, feed.id));
+ }
+ return _results;
+ break;
+ case this._feedType.Feed:
+ feed = this._feedModel.getById(id);
+ if (angular.isDefined(feed)) {
+ feed.unreadCount = 0;
+ highestItemId = this._itemModel.getHighestId();
+ return this._persistence.setFeedRead(id, highestItemId);
+ }
+ break;
+ case this._feedType.Folder:
+ _ref1 = this._feedModel.getAllOfFolder(id);
+ _results1 = [];
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
+ feed = _ref1[_j];
+ _results1.push(this.markAllRead(this._feedType.Feed, feed.id));
+ }
+ return _results1;
+ }
+ };
FeedController.prototype.getFeedsOfFolder = function(folderId) {
return this._feedModel.getAllOfFolder(folderId);
@@ -648,6 +687,17 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}
};
+ ItemModel.prototype.getHighestId = function() {
+ var highestId, query;
+ query = new _MaximumQuery('id');
+ highestId = this.get(query);
+ if (angular.isDefined(highestId)) {
+ return highestId.id;
+ } else {
+ return 0;
+ }
+ };
+
return ItemModel;
})(_Model);