test/dummy/tmp/cache/assets/D01/390/sprockets%2F152365a6c64bdbf13d80c22762c0f48b in collection-json-browser-0.0.5 vs test/dummy/tmp/cache/assets/D01/390/sprockets%2F152365a6c64bdbf13d80c22762c0f48b in collection-json-browser-0.0.6

- old
+ new

@@ -1,38 +1,42 @@ -o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1374682063.094389: @value"À {I" +o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1374996223.526995: @value"m {I" class:EFI"ProcessedAsset;FI"logical_path;FI"Bcollection_json_browser/angular/controllers/api_controller.js;TI" pathname;FI"ƒ/Users/weilu/workspace/collection-json-browser/app/assets/javascripts/collection_json_browser/angular/controllers/api_controller.js;TI"content_type;FI"application/javascript;FI" -mtime;FI"2013-07-25T00:07:40+08:00;FI" length;FiÞI" digest;F"%07882d2db3c0fb086fee0e408dd29bbbI" source;FI"Þ'use strict'; +mtime;FI"2013-07-28T15:23:11+08:00;FI" length;Fi‹I" digest;F"%e6a84a11414f84e9a422138a596ea078I" source;FI"‹'use strict'; function ApiController($scope, $http, $location) { $scope.rootUrl = '/api' $scope.goTo = function(url, fromRel) { $scope.fromRel = fromRel - $location.url(url) + get(url) } $scope.submit = function() { $scope.fromRel === 'edit-form' ? put() : post() } - $scope.$watch(function() { - return $location.url() - }, function(url, oldUrl) { - if(url !== oldUrl) { - get(url) - } - }) + $scope.destroy = destroy get($scope.rootUrl) // helpers function get(url) { $scope.loading = true - $http.get(url).success(responseHandler).error(function(){ $scope.loading = false }) + $http.get(url).success(function(data, status){ + responseHandler(data, status) + $location.url(url) + }).error(function(){ $scope.loading = false }) } + function destroy(url) { + $scope.loading = true + $http.delete(url). + success(responseHandler). + error(responseHandler) + } + function post() { $scope.loading = true $http.post($scope.collection.href, formData()). success(responseHandler). error(responseHandler) @@ -54,17 +58,11 @@ function responseHandler(data, status) { $scope.collection = data.collection; $scope.raw = JSON.stringify(data, undefined, 2) $scope.status = status $scope.loading = false - - var collectionHref = $scope.collection.href - if(collectionHref !== $location.path() && collectionHref.match(/^http/) === null) { - $location.url(collectionHref) - } } } - ApiController.$inject = ['$scope', '$http', '$location']; -;FI"dependency_digest;F"%467e10bd389a015183fcb2c646a5bb7fI"required_paths;F[I"ƒ/Users/weilu/workspace/collection-json-browser/app/assets/javascripts/collection_json_browser/angular/controllers/api_controller.js;TI"dependency_paths;F[{I" path;FI"ƒ/Users/weilu/workspace/collection-json-browser/app/assets/javascripts/collection_json_browser/angular/controllers/api_controller.js;TI" -mtime;FI"2013-07-25T00:07:40+08:00;FI" digest;F"%07882d2db3c0fb086fee0e408dd29bbbI" _version;F"%6776f581a4329e299531e1d52aa59832 +;FI"dependency_digest;F"%b83f49b2f2033d566397a6a01b8273c8I"required_paths;F[I"ƒ/Users/weilu/workspace/collection-json-browser/app/assets/javascripts/collection_json_browser/angular/controllers/api_controller.js;TI"dependency_paths;F[{I" path;FI"ƒ/Users/weilu/workspace/collection-json-browser/app/assets/javascripts/collection_json_browser/angular/controllers/api_controller.js;TI" +mtime;FI"2013-07-28T15:23:11+08:00;FI" digest;F"%e6a84a11414f84e9a422138a596ea078I" _version;F"%6776f581a4329e299531e1d52aa59832 \ No newline at end of file