diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-09 16:38:08 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-09-09 16:38:08 +0200 |
commit | d54475fb0f168845bf14b0d16088da97d473187a (patch) | |
tree | 2af5b80f9265cd098063a459d8bd0b0581001718 /js/build/app/services/businesslayer/itembusinesslayer.js | |
parent | 4a8984a9970b4a6122ea9b31f20380cdbbca39da (diff) |
log
Diffstat (limited to 'js/build/app/services/businesslayer/itembusinesslayer.js')
-rw-r--r-- | js/build/app/services/businesslayer/itembusinesslayer.js | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/js/build/app/services/businesslayer/itembusinesslayer.js b/js/build/app/services/businesslayer/itembusinesslayer.js deleted file mode 100644 index 2c482408a..000000000 --- a/js/build/app/services/businesslayer/itembusinesslayer.js +++ /dev/null @@ -1,144 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -/* - -ownCloud - News - -@author Bernhard Posselt -@copyright 2012 Bernhard Posselt dev@bernhard-posselt.com - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -License as published by the Free Software Foundation; either -version 3 of the License, or any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU AFFERO GENERAL PUBLIC LICENSE for more details. - -You should have received a copy of the GNU Affero General Public -License along with this library. If not, see <http://www.gnu.org/licenses/>. -*/ - - -(function() { - angular.module('News').factory('ItemBusinessLayer', [ - 'ItemModel', 'FeedModel', 'Persistence', 'ActiveFeed', 'FeedType', 'StarredBusinessLayer', 'NewestItem', function(ItemModel, FeedModel, Persistence, ActiveFeed, FeedType, StarredBusinessLayer, NewestItem) { - var ItemBusinessLayer; - ItemBusinessLayer = (function() { - function ItemBusinessLayer(_itemModel, _feedModel, _persistence, _activeFeed, _feedType, _starredBusinessLayer, _newestItem) { - this._itemModel = _itemModel; - this._feedModel = _feedModel; - this._persistence = _persistence; - this._activeFeed = _activeFeed; - this._feedType = _feedType; - this._starredBusinessLayer = _starredBusinessLayer; - this._newestItem = _newestItem; - } - - ItemBusinessLayer.prototype.getAll = function() { - return this._itemModel.getAll(); - }; - - ItemBusinessLayer.prototype.noFeedActive = function() { - return this._activeFeed.getType() !== this._feedType.Feed; - }; - - ItemBusinessLayer.prototype.isKeptUnread = function(itemId) { - var item; - item = this._itemModel.getById(itemId); - if (angular.isDefined(item) && angular.isDefined(item.keptUnread)) { - return item.keptUnread; - } - return false; - }; - - ItemBusinessLayer.prototype.toggleKeepUnread = function(itemId) { - var item; - item = this._itemModel.getById(itemId); - if (angular.isDefined(item) && !item.keptUnread) { - item.keptUnread = true; - if (item.isRead()) { - return this.setUnread(itemId); - } - } else { - return item.keptUnread = false; - } - }; - - ItemBusinessLayer.prototype.toggleStarred = function(itemId) { - var item; - item = this._itemModel.getById(itemId); - if (item.isStarred()) { - item.setUnstarred(); - this._starredBusinessLayer.decreaseCount(); - return this._persistence.unstarItem(item.feedId, item.guidHash); - } else { - item.setStarred(); - this._starredBusinessLayer.increaseCount(); - return this._persistence.starItem(item.feedId, item.guidHash); - } - }; - - ItemBusinessLayer.prototype.setRead = function(itemId) { - var feed, item, keptUnread; - item = this._itemModel.getById(itemId); - if (angular.isDefined(item)) { - keptUnread = angular.isDefined(item.keptUnread) && item.keptUnread; - if (!(item.isRead() || keptUnread)) { - item.setRead(); - this._persistence.readItem(itemId); - feed = this._feedModel.getById(item.feedId); - if (angular.isDefined(feed)) { - return feed.unreadCount -= 1; - } - } - } - }; - - ItemBusinessLayer.prototype.setUnread = function(itemId) { - var feed, item; - item = this._itemModel.getById(itemId); - if (angular.isDefined(item)) { - if (item.isRead()) { - item.setUnread(); - this._persistence.unreadItem(itemId); - feed = this._feedModel.getById(item.feedId); - if (angular.isDefined(feed)) { - return feed.unreadCount += 1; - } - } - } - }; - - ItemBusinessLayer.prototype.getFeedTitle = function(itemId) { - var feed, item; - item = this._itemModel.getById(itemId); - if (angular.isDefined(item)) { - feed = this._feedModel.getById(item.feedId); - if (angular.isDefined(feed)) { - return feed.title; - } - } - }; - - ItemBusinessLayer.prototype.loadNext = function(callback) { - var lowestItemId; - lowestItemId = this._itemModel.getLowestId(); - if (lowestItemId !== 0) { - return this._persistence.getItems(this._activeFeed.getType(), this._activeFeed.getId(), lowestItemId, callback); - } else { - return callback(); - } - }; - - ItemBusinessLayer.prototype.loadNew = function() {}; - - return ItemBusinessLayer; - - })(); - return new ItemBusinessLayer(ItemModel, FeedModel, Persistence, ActiveFeed, FeedType, StarredBusinessLayer, NewestItem); - } - ]); - -}).call(this); |