test/dummy/tmp/cache/assets/D58/C00/sprockets%2F7bd61bb28f7ce577f679872a7cc4a477 in collection-json-browser-0.0.2 vs test/dummy/tmp/cache/assets/D58/C00/sprockets%2F7bd61bb28f7ce577f679872a7cc4a477 in collection-json-browser-0.0.3
- old
+ new
@@ -1,8 +1,8 @@
-o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1373900105.4157598:@value"AA{I"
+o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1374161914.2529879:@value"?B{I"
class:EFI"BundledAsset; FI"logical_path; FI"+collection_json_browser/application.js; TI"
pathname; FI"q/Users/weilu/workspace/collection-json-browser/app/assets/javascripts/collection_json_browser/application.js; TI"content_type; FI"application/javascript; FI"
-mtime; FI"2013-07-15T22:55:04+08:00; FI"length; Fi7?I"digest; F"%22b4f9b22265f088389f87d800fe5449I"source; FI"7?/*
+mtime; FI"2013-07-18T23:37:46+08:00; FI"length; Fi5@I"digest; F"%9e35edc03735c5cf7f315078aaa8b1b2I"source; FI"5@/*
AngularJS v1.0.6
(c) 2010-2012 Google, Inc. http://angularjs.org
License: MIT
*/
@@ -164,18 +164,17 @@
ngCloak:Bd,ngController:Cd,ngForm:ld,ngHide:Ld,ngInclude:Fd,ngInit:Gd,ngNonBindable:Hd,ngPluralize:Id,ngRepeat:Jd,ngShow:Kd,ngSubmit:Ed,ngStyle:Md,ngSwitch:Nd,ngSwitchWhen:Od,ngSwitchDefault:Pd,ngOptions:Td,ngView:Rd,ngTransclude:Qd,ngModel:qd,ngList:sd,ngChange:rd,required:dc,ngRequired:dc,ngValue:ud}).directive(mb).directive(ec);a.provider({$anchorScroll:uc,$browser:wc,$cacheFactory:xc,$controller:Bc,$document:Cc,$exceptionHandler:Dc,$filter:Rb,$interpolate:Ec,$http:Vc,$httpBackend:Wc,$location:Ic,
$log:Jc,$parse:Nc,$route:Qc,$routeParams:Rc,$rootScope:Sc,$q:Oc,$sniffer:Tc,$templateCache:yc,$timeout:$c,$window:Uc})}])})(Za);u(Y).ready(function(){jc(Y,rb)})})(window,document);angular.element(document).find("head").append('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak{display:none;}ng\\:form{display:block;}</style>');
'use strict';
function ApiController($scope, $http, $location) {
- $scope.goTo = function(path) {
+ $scope.goTo = function(path, fromRel) {
+ $scope.fromRel = fromRel
$location.path(path)
}
- $scope.post = function() {
- var formData = {};
- $scope.collection.template.data.forEach(function(f){ formData[f.name] = f.value })
- $http.post($scope.collection.href, formData).success(successHandler)
+ $scope.submit = function() {
+ $scope.fromRel === 'edit-form' ? put() : post()
}
$scope.$watch(function() {
return $location.path()
}, function(path, oldPath) {
@@ -188,10 +187,24 @@
function get(path) {
$http.get(path).success(successHandler)
}
+ function post() {
+ $http.post($scope.collection.href, formData()).success(successHandler)
+ }
+
+ function put() {
+ $http.put($scope.collection.href, formData()).success(successHandler)
+ }
+
+ function formData() {
+ var data = {};
+ $scope.collection.template.data.forEach(function(f){ data[f.name] = f.value })
+ return data
+ }
+
function successHandler(data, status) {
$scope.collection = data.collection;
$scope.raw = JSON.stringify(data, undefined, 2)
$scope.status = status
@@ -217,6 +230,6 @@
//
;
-; FI"required_assets_digest; F"%fa53640d33c88c5a9230328fc765e73eI"
_version; F"%6776f581a4329e299531e1d52aa59832
+; FI"required_assets_digest; F"%57f1276a4d19690939baeee55baead84I"
_version; F"%6776f581a4329e299531e1d52aa59832
\ No newline at end of file