summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-08 17:56:53 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-08 17:56:53 +0200
commitca0864dbcd2b01a31a997c1db28aa241512dcb5f (patch)
treeb6881722220ae3f47bb3d502091d3d0dc736975a /js
parente6d926de620a470a487010f02b47e3932512db93 (diff)
prework for adding folders
Diffstat (limited to 'js')
-rw-r--r--js/app/services/bl/folderbl.coffee10
-rw-r--r--js/app/services/existserror.coffee32
-rw-r--r--js/package.json2
-rw-r--r--js/public/app.js242
-rw-r--r--js/tests/services/bl/folderblSpec.coffee8
-rw-r--r--js/tests/services/opmlparserSpec.coffee135
6 files changed, 339 insertions, 90 deletions
diff --git a/js/app/services/bl/folderbl.coffee b/js/app/services/bl/folderbl.coffee
index 6085ca50e..68031371a 100644
--- a/js/app/services/bl/folderbl.coffee
+++ b/js/app/services/bl/folderbl.coffee
@@ -23,9 +23,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory 'FolderBl',
['_Bl', 'FolderModel', 'FeedBl', 'Persistence', 'FeedType', 'ActiveFeed',
-'ItemModel', 'ShowAll',
+'ItemModel', 'ShowAll', '_ExistsError',
(_Bl, FolderModel, FeedBl, Persistence, FeedType, ActiveFeed,
-ItemModel, ShowAll)->
+ItemModel, ShowAll, _ExistsError)->
class FolderBl extends _Bl
@@ -81,6 +81,12 @@ ItemModel, ShowAll)->
return @_folderModel.getAll()
+ create: (folderName) ->
+ if @_folderModel.nameExists(folderName)
+ throw new _ExistsError()
+
+
+
return new FolderBl(FolderModel, FeedBl, ShowAll, ActiveFeed, Persistence,
FeedType, ItemModel)
diff --git a/js/app/services/existserror.coffee b/js/app/services/existserror.coffee
new file mode 100644
index 000000000..cb9fab54e
--- /dev/null
+++ b/js/app/services/existserror.coffee
@@ -0,0 +1,32 @@
+###
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.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/>.
+
+###
+
+
+angular.module('News').factory '_ExistsError', ->
+
+ class ExistsError extends Error
+
+ constructor: (message='') ->
+ super(message)
+
+
+ return ExistsError \ No newline at end of file
diff --git a/js/package.json b/js/package.json
index b60d585dc..9a1cf930a 100644
--- a/js/package.json
+++ b/js/package.json
@@ -18,7 +18,7 @@
"devDependencies": {
"grunt": "~0.4.0",
"grunt-cli": "~0.1.6",
- "coffee-script": "~1.4.0",
+ "coffee-script": "~1.6",
"grunt-contrib-concat": "~0.1.2",
"grunt-contrib-watch": "~0.2.0",
"grunt-coffeelint": "0.0.6",
diff --git a/js/public/app.js b/js/public/app.js
index f62a0c645..6dab910e0 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -11,8 +11,7 @@
*/
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -36,9 +35,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
-
angular.module('News', ['OC', 'ui']).config(function($provide) {
var config;
+
return $provide.value('Config', config = {
markReadTimeout: 500,
scrollTimeout: 500,
@@ -138,8 +137,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -163,7 +161,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
-
angular.module('News').controller('SettingsController', [
'$scope', '_SettingsController', function($scope, _SettingsController) {
return new _SettingsController($scope);
@@ -184,8 +181,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -209,13 +205,13 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
-
angular.module('News').factory('_FeedController', function() {
var FeedController;
- FeedController = (function() {
+ FeedController = (function() {
function FeedController($scope, _persistence, _folderBl, _feedBl, _subscriptionsBl, _starredBl, _unreadCountFormatter) {
var _this = this;
+
this.$scope = $scope;
this._persistence = _persistence;
this._folderBl = _folderBl;
@@ -238,6 +234,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
this.$scope.addFeed = function(feedUrl, parentFolderId) {
var onError, onSuccess;
+
if (parentFolderId == null) {
parentFolderId = 0;
}
@@ -293,8 +290,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -318,13 +314,13 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
-
angular.module('News').factory('_ItemController', function() {
var ItemController;
- ItemController = (function() {
+ ItemController = (function() {
function ItemController(_$scope, _itemBl, _feedModel, _feedLoading, _feedBl) {
var _this = this;
+
this._$scope = _$scope;
this._itemBl = _itemBl;
this._feedModel = _feedModel;
@@ -337,6 +333,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
};
this._$scope.getFeedTitle = function(feedId) {
var feed;
+
feed = _this._feedModel.getById(feedId);
if (angular.isDefined(feed)) {
return feed.title;
@@ -354,8 +351,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -379,13 +375,13 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
-
angular.module('News').factory('_SettingsController', function() {
var SettingsController;
- SettingsController = (function() {
+ SettingsController = (function() {
function SettingsController($scope) {
var _this = this;
+
this.$scope = $scope;
this.$scope["import"] = function(fileContent) {
console.log('hi');
@@ -401,8 +397,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -426,11 +421,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
-
angular.module('News').factory('_ActiveFeed', function() {
var ActiveFeed;
- ActiveFeed = (function() {
+ ActiveFeed = (function() {
function ActiveFeed() {
/*
Default value is all feeds
@@ -460,8 +454,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -485,11 +478,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
-
angular.module('News').factory('_Bl', function() {
var Bl;
- Bl = (function() {
+ Bl = (function() {
function Bl(_activeFeed, _persistence, _itemModel, _type) {
this._activeFeed = _activeFeed;
this._persistence = _persistence;
@@ -499,6 +491,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Bl.prototype.load = function(id) {
var lastModified;
+
if (this._type !== this._activeFeed.getType() || id !== this._activeFeed.getId()) {
this._itemModel.clear();
this._persistence.getItems(this._type, id, 0);
@@ -524,8 +517,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -555,8 +547,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('FeedBl', [
'_Bl', 'ShowAll', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', 'FeedModel', 'NewLoading', function(_Bl, ShowAll, Persistence, ActiveFeed, FeedType, ItemModel, FeedModel, NewLoading) {
var FeedBl;
- FeedBl = (function(_super) {
+ FeedBl = (function(_super) {
__extends(FeedBl, _super);
function FeedBl(_showAll, _feedModel, persistence, activeFeed, feedType, itemModel, _newLoading) {
@@ -589,6 +581,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBl.prototype.markFeedRead = function(feedId) {
var feed, highestItemId, item, _i, _len, _ref, _results;
+
feed = this._feedModel.getById(feedId);
if (angular.isDefined(feed)) {
feed.unreadCount = 0;
@@ -606,6 +599,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBl.prototype.markAllRead = function() {
var feed, _i, _len, _ref, _results;
+
_ref = this._feedModel.getAll();
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -629,6 +623,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBl.prototype.move = function(feedId, folderId) {
var feed;
+
feed = this._feedModel.getById(feedId);
if (angular.isDefined(feed) && feed.folderId !== folderId) {
this._feedModel.update({
@@ -643,6 +638,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBl.prototype.setShowAll = function(showAll) {
var callback,
_this = this;
+
this._showAll.setShowAll(showAll);
callback = function() {
_this._itemModel.clear();
@@ -668,6 +664,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedBl.prototype.getFeedLink = function(feedId) {
var feed;
+
feed = this._feedModel.getById(feedId);
if (angular.isDefined(feed)) {
return feed.link;
@@ -683,8 +680,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -712,10 +708,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
__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('FolderBl', [
- '_Bl', 'FolderModel', 'FeedBl', 'Persistence', 'FeedType', 'ActiveFeed', 'ItemModel', 'ShowAll', function(_Bl, FolderModel, FeedBl, Persistence, FeedType, ActiveFeed, ItemModel, ShowAll) {
+ '_Bl', 'FolderModel', 'FeedBl', 'Persistence', 'FeedType', 'ActiveFeed', 'ItemModel', 'ShowAll', '_ExistsError', function(_Bl, FolderModel, FeedBl, Persistence, FeedType, ActiveFeed, ItemModel, ShowAll, _ExistsError) {
var FolderBl;
- FolderBl = (function(_super) {
+ FolderBl = (function(_super) {
__extends(FolderBl, _super);
function FolderBl(_folderModel, _feedBl, _showAll, activeFeed, persistence, _feedType, itemModel) {
@@ -737,6 +733,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderBl.prototype.toggleFolder = function(folderId) {
var folder;
+
folder = this._folderModel.getById(folderId);
if (angular.isDefined(folder)) {
folder.opened = !folder.opened;
@@ -750,6 +747,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderBl.prototype.markFolderRead = function(folderId) {
var feed, _i, _len, _ref, _results;
+
_ref = this._feedBl.getFeedsOfFolder(folderId);
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -765,6 +763,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FolderBl.prototype.isVisible = function(folderId) {
var feed, _i, _len, _ref;
+
if (this._showAll.getShowAll()) {
return true;
} else {
@@ -788,6 +787,12 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
return this._folderModel.getAll();
};
+ FolderBl.prototype.create = function(folderName) {
+ if (this._folderModel.nameExists(folderName)) {
+ throw new _ExistsError();
+ }
+ };
+
return FolderBl;
})(_Bl);
@@ -797,8 +802,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -822,12 +826,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
-
angular.module('News').factory('ItemBl', [
'ItemModel', 'FeedModel', 'Persistence', 'ActiveFeed', 'FeedType', 'StarredBl', function(ItemModel, FeedModel, Persistence, ActiveFeed, FeedType, StarredBl) {
var ItemBl;
- ItemBl = (function() {
+ ItemBl = (function() {
function ItemBl(_itemModel, _feedModel, _persistence, _activeFeed, _feedType, _starredBl) {
this._itemModel = _itemModel;
this._feedModel = _feedModel;
@@ -847,6 +850,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBl.prototype.isKeptUnread = function(itemId) {
var item;
+
item = this._itemModel.getById(itemId);
if (angular.isDefined(item) && angular.isDefined(item.keptUnread)) {
return item.keptUnread;
@@ -856,6 +860,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBl.prototype.toggleKeepUnread = function(itemId) {
var item;
+
item = this._itemModel.getById(itemId);
if (angular.isDefined(item) && !item.keptUnread) {
item.keptUnread = true;
@@ -869,6 +874,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBl.prototype.toggleStarred = function(itemId) {
var item;
+
item = this._itemModel.getById(itemId);
if (item.isStarred()) {
item.setUnstarred();
@@ -883,6 +889,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBl.prototype.setRead = function(itemId) {
var feed, item;
+
item = this._itemModel.getById(itemId);
if (angular.isDefined(item)) {
if (!item.isRead()) {
@@ -898,6 +905,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBl.prototype.setUnread = function(itemId) {
var feed, item;
+
item = this._itemModel.getById(itemId);
if (angular.isDefined(item)) {
if (item.isRead()) {
@@ -913,6 +921,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemBl.prototype.getFeedTitle = function(itemId) {
var feed, item;
+
item = this._itemModel.getById(itemId);
if (angular.isDefined(item)) {
feed = this._feedModel.getById(item.feedId);
@@ -935,8 +944,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -966,8 +974,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('StarredBl', [
'_Bl', 'StarredCount', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', function(_Bl, StarredCount, Persistence, ActiveFeed, FeedType, ItemModel) {
var StarredBl;
- StarredBl = (function(_super) {
+ StarredBl = (function(_super) {
__extends(StarredBl, _super);
function StarredBl(_starredCount, feedType, persistence, activeFeed, itemModel) {
@@ -1004,8 +1012,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1035,8 +1042,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('SubscriptionsBl', [
'_Bl', 'FeedBl', 'Persistence', 'ShowAll', 'ActiveFeed', 'FeedType', 'ItemModel', function(_Bl, FeedBl, Persistence, ShowAll, ActiveFeed, FeedType, ItemModel) {
var SubscriptionsBl;
- SubscriptionsBl = (function(_super) {
+ SubscriptionsBl = (function(_super) {
__extends(SubscriptionsBl, _super);
function SubscriptionsBl(_feedBl, _showAll, feedType, persistence, activeFeed, itemModel) {
@@ -1047,6 +1054,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
SubscriptionsBl.prototype.isVisible = function() {
var visible;
+
if (this.isActive(0)) {
return true;
}
@@ -1075,8 +1083,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1100,9 +1107,57 @@ 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('_ExistsError', function() {
+ var ExistsError;
+
+ ExistsError = (function(_super) {
+ __extends(ExistsError, _super);
+
+ function ExistsError(message) {
+ if (message == null) {
+ message = '';
+ }
+ ExistsError.__super__.constructor.call(this, message);
+ }
+
+ return ExistsError;
+ })(Error);
+ return ExistsError;
+ });
+
+}).call(this);
+
+// Generated by CoffeeScript 1.6.2
+/*
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.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('FeedType', function() {
var feedType;
+
return feedType = {
Feed: 0,
Folder: 1,
@@ -1114,8 +1169,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1145,8 +1199,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('_FeedModel', [
'_Model', '_EqualQuery', function(_Model, _EqualQuery) {
var FeedModel;
- FeedModel = (function(_super) {
+ FeedModel = (function(_super) {
__extends(FeedModel, _super);
function FeedModel(_utils) {
@@ -1162,6 +1216,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.add = function(item, clearCache) {
var entry;
+
if (clearCache == null) {
clearCache = true;
}
@@ -1179,6 +1234,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.update = function(item, clearCache) {
var entry, key, value, _results;
+
if (clearCache == null) {
clearCache = true;
}
@@ -1199,6 +1255,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.removeById = function(id) {
var item;
+
item = this.getById(id);
delete this._urlHash[item.urlHash];
return FeedModel.__super__.removeById.call(this, id);
@@ -1210,6 +1267,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.getUnreadCount = function() {
var count, feed, _i, _len, _ref;
+
count = 0;
_ref = this.getAll();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -1221,6 +1279,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.getFeedUnreadCount = function(feedId) {
var count, feed;
+
feed = this.getById(feedId);
count = 0;
if (angular.isDefined(feed)) {
@@ -1232,6 +1291,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.getFolderUnreadCount = function(folderId) {
var count, feed, query, _i, _len, _ref;
+
query = new _EqualQuery('folderId', folderId);
count = 0;
_ref = this.get(query);
@@ -1244,6 +1304,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
FeedModel.prototype.getAllOfFolder = function(folderId) {
var query;
+
query = new _EqualQuery('folderId', folderId);
return this.get(query);
};
@@ -1257,8 +1318,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1287,17 +1347,19 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('_FolderModel', [
'_Model', '_EqualQuery', function(_Model, _EqualQuery) {
- var FolderModel;
- FolderModel = (function(_super) {
+ var FolderModel, _ref;
+ FolderModel = (function(_super) {
__extends(FolderModel, _super);
function FolderModel() {
- return FolderModel.__super__.constructor.apply(this, arguments);
+ _ref = FolderModel.__super__.constructor.apply(this, arguments);
+ return _ref;
}
FolderModel.prototype.nameExists = function(folderName) {
var query;
+
query = new _EqualQuery('name', folderName.trim(), true);
return this.get(query).length > 0;
};
@@ -1311,8 +1373,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1342,8 +1403,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('_ItemModel', [
'_Model', '_MaximumQuery', '_MinimumQuery', 'StatusFlag', function(_Model, _MaximumQuery, _MinimumQuery, StatusFlag) {
var ItemModel;
- ItemModel = (function(_super) {
+ ItemModel = (function(_super) {
__extends(ItemModel, _super);
function ItemModel() {
@@ -1358,6 +1419,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemModel.prototype.add = function(data, clearCache) {
var entry, hash;
+
if (clearCache == null) {
clearCache = true;
}
@@ -1395,6 +1457,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
ItemModel.prototype.update = function(data, clearCache) {
var entry, hash, key, value;
+
if (clearCache == null) {
clearCache = true;
}
@@ -1415,12 +1478,14 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
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];
@@ -1429,6 +1494,7 @@ 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)) {
@@ -1447,8 +1513,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1472,11 +1537,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
-
angular.module('News').factory('_OPMLParser', function() {
var Feed, Folder, OPMLParser;
- Feed = (function() {
+ Feed = (function() {
function Feed(_name, _url) {
this._name = _name;
this._url = _url;
@@ -1498,7 +1562,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
})();
Folder = (function() {
-
function Folder(_name) {
this._name = _name;
this._items = [];
@@ -1524,11 +1587,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
})();
OPMLParser = (function() {
-
function OPMLParser() {}
OPMLParser.prototype.parseXML = function(xml) {
var $root, $xml, structure;
+
$xml = $($.parseXML(xml));
$root = $xml.find('body');
structure = new Folder('root');
@@ -1538,6 +1601,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
OPMLParser.prototype._recursivelyParse = function($xml, structure) {
var $outline, feed, folder, outline, _i, _len, _ref, _results;
+
_ref = $xml.children('outline');
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -1563,8 +1627,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}).call(this);
-// Generated by CoffeeScript 1.4.0
-
+// Generated by CoffeeScript 1.6.2
/*
ownCloud - News
@@ -1588,11 +1651,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
-
angular.module('News').factory('_Persistence', function() {
var Persistence;
- Persistence = (function() {
+ Persistence = (function() {
function Persistence(_request, _loading, _config, _activeFeed, _$rootScope) {
this._request = _request;
this._loading = _loading;
@@ -1608,6 +1670,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
var triggerHideRead,
_this = this;
+
this._loading.increase();
this.getActiveFeed(function() {
return _this.getItems(_this._activeFeed.getType(), _this._activeFeed.getId(), 0, function() {
@@ -1630,6 +1693,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.getItems = function(type, id, offset, onSuccess, updatedSince) {
var data, params;
+
if (onSuccess == null) {
onSuccess = null;
}
@@ -1660,6 +1724,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.getStarredItems = function(onSuccess) {
var params;
+
params = {
onSuccess: onSuccess
};
@@ -1672,6 +1737,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
feedId: feedId,
@@ -1687,6 +1753,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
feedId: feedId,
@@ -1702,6 +1769,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
itemId: itemId
@@ -1716,6 +1784,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
itemId: itemId
@@ -1731,6 +1800,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.getAllFeeds = function(callback) {
var params;
+
callback || (callback = function() {});
params = {
onSuccess: callback
@@ -1740,6 +1810,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.getActiveFeed = function(onSuccess) {
var params;
+
params = {
onSuccess: onSuccess
};
@@ -1748,6 +1819,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.createFeed = function(url, parentFolderId, onSuccess, onFailure) {
var params;
+
if (onSuccess == null) {
onSuccess = null;
}
@@ -1769,6 +1841,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.deleteFeed = function(feedId) {
var params;
+
params = {
routeParams: {
feedId: feedId
@@ -1783,6 +1856,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
feedId: feedId
@@ -1800,6 +1874,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
feedId: feedId
@@ -1817,6 +1892,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
var params;
+
params = {
routeParams: {
feedId: feedId
@@ -1832,6 +1908,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Persistence.prototype.getAll