diff options
Diffstat (limited to 'js/build/app/services/models/itemmodel.js')
-rw-r--r-- | js/build/app/services/models/itemmodel.js | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/js/build/app/services/models/itemmodel.js b/js/build/app/services/models/itemmodel.js deleted file mode 100644 index 3f2e996a7..000000000 --- a/js/build/app/services/models/itemmodel.js +++ /dev/null @@ -1,133 +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() { - var __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; - - angular.module('News').factory('ItemModel', [ - '_Model', '_MinimumQuery', 'StatusFlag', function(_Model, _MinimumQuery, StatusFlag) { - var ItemModel; - ItemModel = (function(_super) { - __extends(ItemModel, _super); - - function ItemModel() { - this._guidFeedIdHash = {}; - ItemModel.__super__.constructor.call(this); - } - - ItemModel.prototype.clear = function() { - this._guidFeedIdHash = {}; - return ItemModel.__super__.clear.call(this); - }; - - ItemModel.prototype.add = function(data, clearCache) { - var entry, hash; - if (clearCache == null) { - clearCache = true; - } - this._bindMethods(data); - hash = data.feedId + '_' + data.guidHash; - entry = this._guidFeedIdHash[hash]; - if (angular.isDefined(entry)) { - return this.update(data, clearCache); - } else { - this._guidFeedIdHash[hash] = data; - return ItemModel.__super__.add.call(this, data, clearCache); - } - }; - - ItemModel.prototype._bindMethods = function(data) { - data.isRead = function() { - return !((this.status & StatusFlag.UNREAD) === StatusFlag.UNREAD); - }; - data.setRead = function() { - return this.status &= ~StatusFlag.UNREAD; - }; - data.setUnread = function() { - return this.status |= StatusFlag.UNREAD; - }; - data.isStarred = function() { - return (this.status & StatusFlag.STARRED) === StatusFlag.STARRED; - }; - data.setStarred = function() { - return this.status |= StatusFlag.STARRED; - }; - return data.setUnstarred = function() { - return this.status &= ~StatusFlag.STARRED; - }; - }; - - ItemModel.prototype.update = function(data, clearCache) { - var entry, hash, key, value; - if (clearCache == null) { - clearCache = true; - } - hash = data.feedId + '_' + data.guidHash; - entry = this._guidFeedIdHash[hash]; - delete this._dataMap[entry.id]; - this._dataMap[data.id] = entry; - for (key in data) { - value = data[key]; - if (key === 'feedId' || key === 'guidHash') { - continue; - } else { - entry[key] = value; - } - } - return ItemModel.__super__.update.call(this, entry, clearCache); - }; - - ItemModel.prototype.getByGuidHashAndFeedId = function(guidHash, feedId) { - var hash; - hash = feedId + '_' + guidHash; - return this._guidFeedIdHash[hash]; - }; - - ItemModel.prototype.removeById = function(id) { - var hash, item; - item = this.getById(id); - hash = item.feedId + '_' + item.guidHash; - delete this._guidFeedIdHash[hash]; - return ItemModel.__super__.removeById.call(this, id); - }; - - ItemModel.prototype.getLowestId = function() { - var lowestId, query; - query = new _MinimumQuery('id'); - lowestId = this.get(query); - if (angular.isDefined(lowestId)) { - return lowestId.id; - } else { - return 0; - } - }; - - return ItemModel; - - })(_Model); - return new ItemModel(); - } - ]); - -}).call(this); |