Skip to content

Commit

Permalink
added load and save of json data in hawtSpot behaviour for #213
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Mar 25, 2013
1 parent cafa890 commit 0ab6a56
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/wiki/html/formEdit.html
@@ -1 +1 @@
<div simple-form name="formEditor" data='formDefinition' ng-submit="submitForm()"></div>
<div simple-form name="formEditor" entity='formEntity' data='formDefinition'></div>
13 changes: 12 additions & 1 deletion hawtio-web/src/main/webapp/app/wiki/js/edit.ts
Expand Up @@ -37,6 +37,16 @@ module Wiki {
saveTo(path);
};

$scope.onSubmit = (json, form) => {
$scope.source = JSON.stringify(json);
$scope.save();
};

$scope.onCancel = (form) => {
notification("success", "Clicked cancel!");
};


updateView();

function isCreate() {
Expand Down Expand Up @@ -67,7 +77,7 @@ module Wiki {
$scope.fileName = "" + Core.getUUID() + ".json";
}
}
// now lets try load the form JSON so we can then render the form
// now lets try load the form defintion JSON so we can then render the form
$scope.sourceView = null;
$scope.git = wikiRepository.getPage(form, $scope.objectId, onFormData);
} else {
Expand All @@ -78,6 +88,7 @@ module Wiki {
function onFormData(details) {
var text = details.text;
$scope.formDefinition = JSON.parse(text);
$scope.formEntity = JSON.parse($scope.source);
$scope.sourceView = "app/wiki/html/formEdit.html";
Core.$apply($scope);
}
Expand Down
2 changes: 1 addition & 1 deletion hawtio-web/src/main/webapp/app/wiki/js/view.ts
Expand Up @@ -88,7 +88,7 @@ module Wiki {

$scope.onCancel = (form) => {
notification("success", "Clicked cancel!");
}
};

updateView();

Expand Down

0 comments on commit 0ab6a56

Please sign in to comment.