summaryrefslogtreecommitdiffstats
path: root/js/app
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/app
parent460cf8bbd5ea8260c79252d40f35e63b26f4d3a2 (diff)
use generate url, fix #496
Diffstat (limited to 'js/app')
-rw-r--r--js/app/services/request.coffee37
-rw-r--r--js/app/services/router.coffee26
-rw-r--r--js/app/services/services.coffee6
3 files changed, 5 insertions, 64 deletions
diff --git a/js/app/services/request.coffee b/js/app/services/request.coffee
index e0e24bb44..ec8ccf70c 100644
--- a/js/app/services/request.coffee
+++ b/js/app/services/request.coffee
@@ -26,14 +26,7 @@ angular.module('News').factory '_Request', ->
class Request
- constructor: (@_$http, @_publisher, @_router) ->
- @_initialized = false
- @_shelvedRequests = []
-
- @_router.registerLoadedCallback =>
- @_initialized = true
- @_executeShelvedRequests()
- @_shelvedRequests = []
+ constructor: (@_$http, @_publisher, @_utils) ->
request: (route, data={}) ->
@@ -58,12 +51,7 @@ angular.module('News').factory '_Request', ->
angular.extend(defaultData, data)
- # if routes are not ready yet, save the request
- if not @_initialized
- @_shelveRequest(route, defaultData)
- return
-
- url = @_router.generate(route, defaultData.routeParams)
+ url = @_utils.generateUrl(route, defaultData.routeParams)
defaultConfig =
url: url
@@ -126,25 +114,4 @@ angular.module('News').factory '_Request', ->
@request(route, data)
- _shelveRequest: (route, data) ->
- ###
- Saves requests for later if the routes have not been loaded
- ###
- request =
- route: route
- data: data
-
- @_shelvedRequests.push(request)
-
-
- _executeShelvedRequests: ->
- ###
- Run all saved requests that were done before routes were fully
- loaded
- ###
- for r in @_shelvedRequests
- @request(r.route, r.data)
-
-
-
return Request
diff --git a/js/app/services/router.coffee b/js/app/services/router.coffee
deleted file mode 100644
index 49c87c112..000000000
--- a/js/app/services/router.coffee
+++ /dev/null
@@ -1,26 +0,0 @@
-###
-
-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/>.
-
-###
-
-
-# Inject router into angular to make testing easier
-angular.module('News').factory 'Router', ->
- return OC.Router \ No newline at end of file
diff --git a/js/app/services/services.coffee b/js/app/services/services.coffee
index 1a7633d42..bc9c32cd2 100644
--- a/js/app/services/services.coffee
+++ b/js/app/services/services.coffee
@@ -23,9 +23,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
# request related stuff
angular.module('News').factory 'Request',
-['_Request', '$http', 'Publisher', 'Router',
-(_Request, $http, Publisher, Router) ->
- return new _Request($http, Publisher, Router)
+['_Request', '$http', 'Publisher', 'Utils',
+(_Request, $http, Publisher, Utils) ->
+ return new _Request($http, Publisher, Utils)
]