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-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 get(url) } $scope.submit = function() { $scope.fromRel === 'edit-form' ? put() : post() } $scope.destroy = destroy get($scope.rootUrl) // helpers function get(url) { $scope.loading = true $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) } function put() { $scope.loading = true $http.put($scope.collection.href, formData()). success(responseHandler). error(responseHandler) } function formData() { var data = {}; $scope.collection.template.data.forEach(function(f){ data[f.name] = f.value }) return data } function responseHandler(data, status) { $scope.collection = data.collection; $scope.raw = JSON.stringify(data, undefined, 2) $scope.status = status $scope.loading = false } } ApiController.$inject = ['$scope', '$http', '$location']; ;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