This commit is contained in:
Joseph Schorr 2015-01-04 14:38:41 -05:00
parent 77278f0391
commit 1bf25f25c1
14 changed files with 942 additions and 336 deletions

View file

@ -78,10 +78,11 @@ angular.module("core-config-setup", ['angularFileUpload'])
$transclude(function(clone, scope) {
$scope.childScope = scope;
$scope.childScope['fields'] = {};
$element.append(clone);
});
$scope.childScope.$watch(function(value) {
$scope.childScope.$watch('fields', function(value) {
// Note: We need the timeout here because Angular starts the digest of the
// parent scope AFTER the child scope, which means it can end up one action
// behind. The timeout ensures that the parent scope will be fully digest-ed
@ -89,13 +90,13 @@ angular.module("core-config-setup", ['angularFileUpload'])
$timeout(function() {
$scope.binding = $scope.serializer({'fields': value});
});
});
}, true);
$scope.$watch('binding', function(value) {
var parsed = $scope.parser({'value': value});
for (var key in parsed) {
if (parsed.hasOwnProperty(key)) {
$scope.childScope[key] = parsed[key];
$scope.childScope['fields'][key] = parsed[key];
}
}
});
@ -240,7 +241,7 @@ angular.module("core-config-setup", ['angularFileUpload'])
$scope.uploadProgress = 0;
$scope.upload = $upload.upload({
url: '/api/v1/configfile',
url: '/api/v1/superuser/config/file',
method: 'POST',
data: { filename: $scope.filename },
file: files[0],
@ -257,7 +258,7 @@ angular.module("core-config-setup", ['angularFileUpload'])
};
var loadStatus = function(filename) {
Restangular.one('configfile/' + filename).get().then(function(resp) {
Restangular.one('superuser/config/file/' + filename).get().then(function(resp) {
$scope.hasFile = resp['exists'];
});
};