summaryrefslogtreecommitdiffstats
path: root/js/build/app/services/models/foldermodel.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/build/app/services/models/foldermodel.js')
-rw-r--r--js/build/app/services/models/foldermodel.js159
1 files changed, 0 insertions, 159 deletions
diff --git a/js/build/app/services/models/foldermodel.js b/js/build/app/services/models/foldermodel.js
deleted file mode 100644
index 762c008d6..000000000
--- a/js/build/app/services/models/foldermodel.js
+++ /dev/null
@@ -1,159 +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('FolderModel', [
- '_Model', '_EqualQuery', function(_Model, _EqualQuery) {
- var FolderModel;
- FolderModel = (function(_super) {
- __extends(FolderModel, _super);
-
- function FolderModel() {
- this._nameCache = {};
- FolderModel.__super__.constructor.call(this);
- }
-
- FolderModel.prototype.add = function(data, clearCache) {
- var item, updateById, updateByName;
- if (clearCache == null) {
- clearCache = true;
- }
- /*
- We want to add a folder on the client side before
- we have an id from the server. Once the server returns
- an id, we have to update the existing item without id
- */
-
- data.name = this._transformName(data.name);
- item = this._nameCache[data.name];
- updateById = angular.isDefined(data.id) && angular.isDefined(this.getById(data.id));
- updateByName = angular.isDefined(item) && angular.isUndefined(item.id);
- if (updateById || updateByName) {
- return this.update(data, clearCache);
- } else {
- this._nameCache[data.name] = data;
- if (angular.isDefined(data.id)) {
- return FolderModel.__super__.add.call(this, data, clearCache);
- } else {
- this._data.push(data);
- if (clearCache) {
- return this._invalidateCache();
- }
- }
- }
- };
-
- FolderModel.prototype.update = function(data, clearCache) {
- var item, itemWithId;
- if (clearCache == null) {
- clearCache = true;
- }
- data.name = this._transformName(data.name);
- item = this._nameCache[data.name];
- if (angular.isUndefined(data.id) && angular.isDefined(item)) {
- return angular.extend(item, data);
- } else {
- if (angular.isDefined(data.id) && angular.isDefined(item) && angular.isUndefined(item.id)) {
- item.id = data.id;
- this._dataMap[data.id] = item;
- }
- itemWithId = this.getById(data.id);
- if (angular.isDefined(itemWithId) && itemWithId.name !== data.name) {
- delete this._nameCache[itemWithId.name];
- this._nameCache[data.name] = itemWithId;
- }
- return FolderModel.__super__.update.call(this, data, clearCache);
- }
- };
-
- FolderModel.prototype.getByName = function(folderName) {
- folderName = this._transformName(folderName);
- return this._nameCache[folderName];
- };
-
- FolderModel.prototype.clear = function() {
- this._nameCache = {};
- return FolderModel.__super__.clear.call(this);
- };
-
- FolderModel.prototype.removeById = function(id, clearCache) {
- var item;
- if (clearCache == null) {
- clearCache = true;
- }
- item = this.getById(id);
- delete this._nameCache[this._transformName(item.name)];
- return FolderModel.__super__.removeById.call(this, id, clearCache);
- };
-
- FolderModel.prototype._transformName = function(folderName) {
- return folderName.trim().toLowerCase();
- };
-
- FolderModel.prototype.removeByName = function(name, clearCache) {
- var counter, entry, key, value, _i, _len, _ref, _ref1, _results;
- if (clearCache == null) {
- clearCache = true;
- }
- /*
- Remove an entry by id
- */
-
- name = name.toLowerCase();
- _ref = this._dataMap;
- for (key in _ref) {
- value = _ref[key];
- if (this._dataMap[key].name === name) {
- delete this._dataMap[key];
- break;
- }
- }
- _ref1 = this._data;
- _results = [];
- for (counter = _i = 0, _len = _ref1.length; _i < _len; counter = ++_i) {
- entry = _ref1[counter];
- if (entry.name === name) {
- this._data.splice(counter, 1);
- delete this._nameCache[name];
- if (clearCache) {
- this._invalidateCache();
- }
- break;
- } else {
- _results.push(void 0);
- }
- }
- return _results;
- };
-
- return FolderModel;
-
- })(_Model);
- return new FolderModel();
- }
- ]);
-
-}).call(this);