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 . 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 . + +### + + +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 . (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 . }).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 . (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 . }).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 . (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 . }; 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 . }).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 . (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 . }; 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 . }).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 . (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 . }).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 . (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 . }).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 . (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 . 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 . }).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 . 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 . 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 . 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 . 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 . 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 . 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 . }).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 . __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 . 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 . 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 . 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 . 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 . }).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 . (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 . 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 . 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 . 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 . 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 . 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 . 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 . }).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 . 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 . }).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 . 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 . SubscriptionsBl.prototype.isVisible = function() { var visible; + if (this.isActive(0)) { return true; } @@ -1075,8 +1083,7 @@ License along with this library. If not, see . }).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 . (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 . +*/ + + +(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 . }).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 . 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 . 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 . 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 . 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 . 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 . 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 . 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 . 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 . }).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 . 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 . }).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 . 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 . 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 . 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 . 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 . 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 . }).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 . (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 . })(); Folder = (function() { - function Folder(_name) { this._name = _name; this._items = []; @@ -1524,11 +1587,11 @@ License along with this library. If not, see . })(); 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 . 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 . }).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 . (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 . 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 . 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 . Persistence.prototype.getStarredItems = function(onSuccess) { var params; + params = { onSuccess: onSuccess }; @@ -1672,6 +1737,7 @@ License along with this library. If not, see . */ var params; + params = { routeParams: { feedId: feedId, @@ -1687,6 +1753,7 @@ License along with this library. If not, see . */ var params; + params = { routeParams: { feedId: feedId, @@ -1702,6 +1769,7 @@ License along with this library. If not, see . */ var params; + params = { routeParams: { itemId: itemId @@ -1716,6 +1784,7 @@ License along with this library. If not, see . */ var params; + params = { routeParams: { itemId: itemId @@ -1731,6 +1800,7 @@ License along with this library. If not, see . 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 . Persistence.prototype.getActiveFeed = function(onSuccess) { var params; + params = { onSuccess: onSuccess }; @@ -1748,6 +1819,7 @@ License along with this library. If not, see . 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 . Persistence.prototype.deleteFeed = function(feedId) { var params; + params = { routeParams: { feedId: feedId @@ -1783,6 +1856,7 @@ License along with this library. If not, see . */ var params; + params = { routeParams: { feedId: feedId @@ -1800,6 +1874,7 @@ License along with this library. If not, see . */ var params; + params = { routeParams: { feedId: feedId @@ -1817,6 +1892,7 @@ License along with this library. If not, see . */ var params; + params = { routeParams: { feedId: feedId @@ -1832,6 +1908,7 @@ License along with this library. If not, see . Persistence.prototype.getAllFolders = function(callback) { var params; + callback || (callback = function() {}); params = { onSuccess: callback @@ -1845,6 +1922,7 @@ License along with this library. If not, see . */ var params; + params = { routeParams: { folderId: folderId @@ -1859,6 +1937,7 @@ License along with this library. If not, see . */ var params; + params = { routeParams: { folderId: folderId @@ -1869,6 +1948,7 @@ License along with this library. If not, see . Persistence.prototype.createFolder = function(folderName, parentFolderId, onSuccess, onFailure) { var params; + if (parentFolderId == null) { parentFolderId = 0; } @@ -1897,6 +1977,7 @@ License along with this library. If not, see . */ var params; + params = { routeParams: { folderId: folderId @@ -1911,6 +1992,7 @@ License along with this library. If not, see . */ var params; + params = { routeParams: { folderId: folderId @@ -1941,6 +2023,7 @@ License along with this library. If not, see . Persistence.prototype.userSettingsRead = function(callback) { var params; + if (callback == null) { callback = null; } @@ -1961,6 +2044,7 @@ License along with this library. If not, see . */ var data; + data = { onSuccess: callback }; @@ -1973,6 +2057,7 @@ License along with this library. If not, see . */ var data; + data = { onSuccess: callback }; @@ -1991,8 +2076,7 @@ License along with this library. If not, see . }).call(this); -// Generated by CoffeeScript 1.4.0 - +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -2016,7 +2100,6 @@ License along with this library. If not, see . (function() { - angular.module('News').factory('Persistence', [ '_Persistence', 'Request', 'FeedLoading', 'Config', 'ActiveFeed', '$rootScope', function(_Persistence, Request, FeedLoading, Config, ActiveFeed, $rootScope) { return new _Persistence(Request, FeedLoading, Config, ActiveFeed, $rootScope); @@ -2086,6 +2169,7 @@ License along with this library. If not, see . angular.module('News').factory('Publisher', [ '_Publisher', 'ActiveFeed', 'ShowAll', 'StarredCount', 'ItemModel', 'FolderModel', 'FeedModel', function(_Publisher, ActiveFeed, ShowAll, StarredCount, ItemModel, FolderModel, FeedModel) { var publisher; + publisher = new _Publisher(); publisher.subscribeObjectTo(ActiveFeed, 'activeFeed'); publisher.subscribeObjectTo(ShowAll, 'showAll'); @@ -2105,8 +2189,7 @@ License along with this library. If not, see . }).call(this); -// Generated by CoffeeScript 1.4.0 - +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -2130,11 +2213,10 @@ License along with this library. If not, see . (function() { - angular.module('News').factory('_ShowAll', function() { var ShowAll; - ShowAll = (function() { + ShowAll = (function() { function ShowAll() { this._showAll = false; } @@ -2159,8 +2241,7 @@ License along with this library. If not, see . }).call(this); -// Generated by CoffeeScript 1.4.0 - +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -2184,11 +2265,10 @@ License along with this library. If not, see . (function() { - angular.module('News').factory('_StarredCount', function() { var StarredCount; - StarredCount = (function() { + StarredCount = (function() { function StarredCount() { this._count = 0; } @@ -2213,8 +2293,7 @@ License along with this library. If not, see . }).call(this); -// Generated by CoffeeScript 1.4.0 - +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -2238,7 +2317,6 @@ License along with this library. If not, see . (function() { - angular.module('News').factory('StatusFlag', function() { return { UNREAD: 0x02, @@ -2250,8 +2328,7 @@ License along with this library. If not, see . }).call(this); -// Generated by CoffeeScript 1.4.0 - +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -2275,7 +2352,6 @@ License along with this library. If not, see . (function() { - angular.module('News').factory('unreadCountFormatter', function() { return function(unreadCount) { if (unreadCount > 999) { diff --git a/js/tests/services/bl/folderblSpec.coffee b/js/tests/services/bl/folderblSpec.coffee index 251ceeb36..09c7f85ed 100644 --- a/js/tests/services/bl/folderblSpec.coffee +++ b/js/tests/services/bl/folderblSpec.coffee @@ -30,11 +30,12 @@ describe 'FolderBl', -> @persistence = {} beforeEach inject (@FolderBl, @FolderModel, @FeedModel, @ShowAll, - @ActiveFeed, @FeedType) => + @ActiveFeed, @FeedType, @_ExistsError) => @ShowAll.setShowAll(false) @ActiveFeed.handle({type: @FeedType.Feed, id:0}) + it 'should delete folders', => @FolderModel.removeById = jasmine.createSpy('remove') @persistence.deleteFolder = jasmine.createSpy('deletequery') @@ -130,3 +131,8 @@ describe 'FolderBl', -> expect(@FolderBl.getAll()).toContain(item2) + it 'should not create a folder if it already exists', => + item1 = {id: 4, open: true, name: 'john'} + @FolderModel.add(item1) + + expect(@FolderBl.create('johns')).toThrow(new @_ExistsError()) diff --git a/js/tests/services/opmlparserSpec.coffee b/js/tests/services/opmlparserSpec.coffee index ad40fc6dc..fb2560626 100644 --- a/js/tests/services/opmlparserSpec.coffee +++ b/js/tests/services/opmlparserSpec.coffee @@ -17,6 +17,7 @@ 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 . + ### @@ -26,11 +27,139 @@ describe 'OPMLParser', -> beforeEach module 'News' beforeEach inject (@OPMLParser) => + @opml = ' + + + + + NewsBlur Feeds + + + 2013-03-14 16:44:01.356965 + + + 2013-03-14 16:44:01.356965 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ' + @data = @OPMLParser.parseXML(@opml) it 'should return only the root folder when parsing empty OPML', => - @data = @OPMLParser.parseXML('') - expect(@data.getName()).toBe('root') + data = @OPMLParser.parseXML('') + expect(data.getName()).toBe('root') - # TODO: write rest \ No newline at end of file + it 'should parse folders', => + firstLevel = @data.getItems() + expect(firstLevel[2].isFolder()).toBe(true) + expect(firstLevel[2].getName()).toBe('Design') + + + it 'should parse feeds', => + firstLevel = @data.getItems()[0] + expect(firstLevel.isFolder()).toBe(false) + expect(firstLevel.getUrl()).toBe('http://www.reddit.com/r/tldr.rss') + expect(firstLevel.getName()).toBe('test_text') + + + it 'should nest feeds', => + secondLevel = @data.getItems()[2].getItems()[1] + expect(secondLevel.isFolder()).toBe(false) + expect(secondLevel.getUrl()). + toBe('http://feeds.feedburner.com/HbonsHome') + expect(secondLevel.getName()).toBe('Journal - Hylke Bons') + diff --git a/templates/part.listfeed.php b/templates/part.listfeed.php index a9d91718f..0c3a48a19 100644 --- a/templates/part.listfeed.php +++ b/templates/part.listfeed.php @@ -15,9 +15,6 @@ - {{ feedBl.getUnreadCount(feed.id) }} @@ -27,6 +24,10 @@ ng-show="feedBl.getUnreadCount(feed.id) > 0" ng-click="feedBl.markFeedRead(feed.id)" title="t('Mark all read')); ?>"> + + diff --git a/templates/part.listfolder.php b/templates/part.listfolder.php index e932babb8..a7e2e7497 100644 --- a/templates/part.listfolder.php +++ b/templates/part.listfolder.php @@ -1,6 +1,6 @@