summaryrefslogtreecommitdiffstats
path: root/js/public/app.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-04-08 22:29:12 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-04-08 22:29:12 +0200
commita3c78541d7dd72c143e7997a9e5978a7ff6ce10e (patch)
treeb9b0ed0fc3a2d85f993800f4b3519ac361f0e296 /js/public/app.js
parent460cf8bbd5ea8260c79252d40f35e63b26f4d3a2 (diff)
use generate url, fix #496
Diffstat (limited to 'js/public/app.js')
-rw-r--r--js/public/app.js145
1 files changed, 37 insertions, 108 deletions
diff --git a/js/public/app.js b/js/public/app.js
index 1c45a5394..7b80f1efd 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -3452,7 +3452,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
onFailure: failureCallbackWrapper
};
if (!this._preventUselessAutoPageRequest) {
- return this._request.get('news_items', params);
+ return this._request.get('/apps/news/items', params);
} else {
onSuccess();
return loading.decrease();
@@ -3471,7 +3471,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
onSuccess: onSuccess,
onFailure: onSuccess
};
- return this._request.get('news_items_new', params);
+ return this._request.get('/apps/news/items/new', params);
};
Persistence.prototype.starItem = function(feedId, guidHash) {
@@ -3486,7 +3486,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
guidHash: guidHash
}
};
- return this._request.post('news_items_star', params);
+ return this._request.post('/apps/news/items/{feedId}/{guidHash}/star', params);
};
Persistence.prototype.unstarItem = function(feedId, guidHash) {
@@ -3501,7 +3501,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
guidHash: guidHash
}
};
- return this._request.post('news_items_unstar', params);
+ return this._request.post('/apps/news/items/{feedId}/{guidHash}/unstar', params);
};
Persistence.prototype.readItem = function(itemId) {
@@ -3515,7 +3515,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
itemId: itemId
}
};
- return this._request.post('news_items_read', params);
+ return this._request.post('/apps/news/items/{itemId}/read', params);
};
Persistence.prototype.unreadItem = function(itemId) {
@@ -3529,7 +3529,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
itemId: itemId
}
};
- return this._request.post('news_items_unread', params);
+ return this._request.post('/apps/news/items/{itemId}/unread', params);
};
Persistence.prototype.setAllRead = function(highestItemId) {
@@ -3543,7 +3543,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
highestItemId: highestItemId
}
};
- return this._request.post('news_items_all_read', params);
+ return this._request.post('/apps/news/items/read', params);
};
/*
@@ -3577,7 +3577,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
onSuccess: successCallbackWrapper,
onFailure: failureCallbackWrapper
};
- return this._request.get('news_feeds', params);
+ return this._request.get('/apps/news/feeds', params);
};
Persistence.prototype.getActiveFeed = function(onSuccess) {
@@ -3595,7 +3595,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
onSuccess: successCallbackWrapper,
onFailure: failureCallbackWrapper
};
- return this._request.get('news_feeds_active', params);
+ return this._request.get('/apps/news/feeds/active', params);
};
Persistence.prototype.createFeed = function(url, parentFolderId, onSuccess, onFailure) {
@@ -3616,7 +3616,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
onSuccess: onSuccess,
onFailure: onFailure
};
- return this._request.post('news_feeds_create', params);
+ return this._request.post('/apps/news/feeds', params);
};
Persistence.prototype.deleteFeed = function(feedId) {
@@ -3626,7 +3626,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
feedId: feedId
}
};
- return this._request["delete"]('news_feeds_delete', params);
+ return this._request["delete"]('/apps/news/feeds/{feedId}', params);
};
Persistence.prototype.restoreFeed = function(feedId, onSuccess) {
@@ -3641,7 +3641,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
feedId: feedId
}
};
- return this._request.post('news_feeds_restore', params);
+ return this._request.post('/apps/news/feeds/{feedId}/restore', params);
};
Persistence.prototype.moveFeed = function(feedId, folderId) {
@@ -3658,7 +3658,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
parentFolderId: folderId
}
};
- return this._request.post('news_feeds_move', params);
+ return this._request.post('/apps/news/feeds/{feedId}/move', params);
};
Persistence.prototype.renameFeed = function(feedId, feedTitle) {
@@ -3675,7 +3675,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
feedTitle: feedTitle
}
};
- return this._request.post('news_feeds_rename', params);
+ return this._request.post('/apps/news/feeds/{feedId}/rename', params);
};
Persistence.prototype.setFeedRead = function(feedId, highestItemId) {
@@ -3692,7 +3692,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
highestItemId: highestItemId
}
};
- return this._request.post('news_feeds_read', params);
+ return this._request.post('/apps/news/feeds/{feedId}/read', params);
};
Persistence.prototype.updateFeed = function(feedId) {
@@ -3706,7 +3706,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
feedId: feedId
}
};
- return this._request.post('news_feeds_update', params);
+ return this._request.post('/apps/news/feeds/{feedId}/update', params);
};
Persistence.prototype.importArticles = function(json, onSuccess) {
@@ -3721,7 +3721,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
return onSuccess();
}
};
- return this._request.post('news_feeds_import_articles', params);
+ return this._request.post('/apps/news/feeds/import/articles', params);
};
/*
@@ -3755,7 +3755,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
onSuccess: successCallbackWrapper,
onFailure: failureCallbackWrapper
};
- return this._request.get('news_folders', params);
+ return this._request.get('/apps/news/folders', params);
};
Persistence.prototype.openFolder = function(folderId) {
@@ -3769,7 +3769,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
folderId: folderId
}
};
- return this._request.post('news_folders_open', params);
+ return this._request.post('/apps/news/folders/{folderId}/open', params);
};
Persistence.prototype.collapseFolder = function(folderId) {
@@ -3783,7 +3783,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
folderId: folderId
}
};
- return this._request.post('news_folders_collapse', params);
+ return this._request.post('/apps/news/folders/{folderId}/collapse', params);
};
Persistence.prototype.createFolder = function(folderName, parentFolderId, onSuccess, onFailure) {
@@ -3807,7 +3807,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
onSuccess: onSuccess,
onFailure: onFailure
};
- return this._request.post('news_folders_create', params);
+ return this._request.post('/apps/news/folders/create', params);
};
Persistence.prototype.deleteFolder = function(folderId) {
@@ -3821,7 +3821,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
folderId: folderId
}
};
- return this._request["delete"]('news_folders_delete', params);
+ return this._request["delete"]('/apps/news/folders/{folderId}', params);
};
Persistence.prototype.restoreFolder = function(folderId, onSuccess) {
@@ -3836,7 +3836,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
folderId: folderId
}
};
- return this._request.post('news_folders_restore', params);
+ return this._request.post('/apps/news/folders/{folderId}/restore', params);
};
Persistence.prototype.renameFolder = function(folderId, folderName) {
@@ -3853,7 +3853,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
folderName: folderName
}
};
- return this._request.post('news_folders_rename', params);
+ return this._request.post('/apps/news/folders/{folderId}/rename', params);
};
Persistence.prototype.setFolderRead = function(folderId, highestItemId) {
@@ -3870,7 +3870,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
highestItemId: highestItemId
}
};
- return this._request.post('news_folders_read', params);
+ return this._request.post('/apps/news/folders/{folderId}/read', params);
};
/*
@@ -3883,7 +3883,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
Prompts for an OPML download
*/
- return this._request.get('news_export_opml');
+ return this._request.get('/apps/news/export/opml');
};
/*
@@ -3914,7 +3914,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
onSuccess: successCallbackWrapper,
onFailure: failureCallbackWrapper
};
- return this._request.get('news_usersettings_read', params);
+ return this._request.get('/apps/news/usersettings/read', params);
};
Persistence.prototype.userSettingsReadShow = function(callback) {
@@ -3926,7 +3926,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
data = {
onSuccess: callback
};
- return this._request.post('news_usersettings_read_show', data);
+ return this._request.post('/apps/news/usersettings/read/show', data);
};
Persistence.prototype.userSettingsReadHide = function(callback) {
@@ -3938,7 +3938,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
data = {
onSuccess: callback
};
- return this._request.post('news_usersettings_read_hide', data);
+ return this._request.post('/apps/news/usersettings/read/hide', data);
};
Persistence.prototype.userSettingsLanguage = function(onSuccess) {
@@ -3960,11 +3960,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
onSuccess: successCallbackWrapper,
onFailure: failureCallbackWrapper
};
- return this._request.get('news_usersettings_language', data);
+ return this._request.get('/apps/news/usersettings/language', data);
};
Persistence.prototype.userSettingsIsCompact = function() {
- return this._request.get('news_usersettings_iscompact');
+ return this._request.get('/apps/news/usersettings/compact');
};
Persistence.prototype.userSettingsSetCompact = function(isCompact) {
@@ -3978,7 +3978,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
compact: isCompact
}
};
- return this._request.post('news_usersettings_setcompact', params);
+ return this._request.post('/apps/news/usersettings/compact', params);
};
Persistence.prototype._triggerHideRead = function() {
@@ -4791,18 +4791,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').factory('_Request', function() {
var Request;
Request = (function() {
- function Request(_$http, _publisher, _router) {
- var _this = this;
+ function Request(_$http, _publisher, _utils) {
this._$http = _$http;
this._publisher = _publisher;
- this._router = _router;
- this._initialized = false;
- this._shelvedRequests = [];
- this._router.registerLoadedCallback(function() {
- _this._initialized = true;
- _this._executeShelvedRequests();
- return _this._shelvedRequests = [];
- });
+ this._utils = _utils;
}
Request.prototype.request = function(route, data) {
@@ -4832,11 +4824,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
config: {}
};
angular.extend(defaultData, data);
- if (!this._initialized) {
- this._shelveRequest(route, defaultData);
- return;
- }
- url = this._router.generate(route, defaultData.routeParams);
+ url = this._utils.generateUrl(route, defaultData.routeParams);
defaultConfig = {
url: url,
data: defaultData.data
@@ -4909,35 +4897,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
return this.request(route, data);
};
- Request.prototype._shelveRequest = function(route, data) {
- /*
- Saves requests for later if the routes have not been loaded
- */
-
- var request;
- request = {
- route: route,
- data: data
- };
- return this._shelvedRequests.push(request);
- };
-
- Request.prototype._executeShelvedRequests = function() {
- /*
- Run all saved requests that were done before routes were fully
- loaded
- */
-
- var r, _i, _len, _ref, _results;
- _ref = this._shelvedRequests;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- r = _ref[_i];
- _results.push(this.request(r.route, r.data));
- }
- return _results;
- };
-
return Request;
})();
@@ -4970,39 +4929,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
(function() {
- angular.module('News').factory('Router', function() {
- return OC.Router;
- });
-
-}).call(this);
-
-// 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('Request', [
- '_Request', '$http', 'Publisher', 'Router', function(_Request, $http, Publisher, Router) {
- return new _Request($http, Publisher, Router);
+ '_Request', '$http', 'Publisher', 'Utils', function(_Request, $http, Publisher, Utils) {
+ return new _Request($http, Publisher, Utils);
}
]);