[New Edit Mode] Fixed failing tests, and added new test in CreateWizard

[New Edit Mode] #480 fixed JSLint errors

[New Edit Mode] #480 do not show locator for sub objects

[New Edit Mode] Modified persistence in SaveAction

Removed redundant variable

Fixed Failing Test

Fixed JSLint errors

Improved some documentation
This commit is contained in:
Henry
2016-01-20 20:52:26 -08:00
parent c65096f166
commit cd2b19eb1e
9 changed files with 75 additions and 28 deletions

View File

@ -22,7 +22,7 @@
/*global define,Promise*/
/**
* Module defining CreateAction. Created by vwoeltje on 11/10/14.
* Module defining AddAction. Created by ahenry on 01/21/16.
*/
define(
[
@ -66,9 +66,14 @@ define(
this.dialogService = dialogService;
this.policyService = policyService;
}
/**
*
* Create a new object of the given type.
* This will prompt for user input first.
*
* @returns {Promise} that will be resolved with the object that the
* action was originally invoked on (ie. the 'parent')
*/
AddAction.prototype.perform = function () {
var newModel = this.type.getInitialModel(),
@ -106,10 +111,10 @@ define(
}
return this.dialogService
.getUserInput(wizard.getFormStructure(), wizard.getInitialFormValue())
.getUserInput(wizard.getFormStructure(false), wizard.getInitialFormValue())
.then(populateObjectFromInput)
.then(save)
.then(addToParent)
.then(addToParent);
};

View File

@ -22,7 +22,7 @@
/*global define,Promise*/
/**
* Module defining CreateActionProvider.js. Created by vwoeltje on 11/10/14.
* Module defining AddActionProvider.js. Created by ahenry on 01/21/16.
*/
define(
["./AddAction"],

View File

@ -49,11 +49,14 @@ define(
* Get the form model for this wizard; this is a description
* that will be rendered to an HTML form. See the
* platform/forms bundle
*
* @param {boolean} includeLocation if true, a 'location' section
* will be included that will allow the user to select the location
* of the newly created object, otherwise the .location property of
* the model will be used.
* @return {FormModel} formModel the form model to
* show in the create dialog
*/
CreateWizard.prototype.getFormStructure = function () {
CreateWizard.prototype.getFormStructure = function (includeLocation) {
var sections = [],
type = this.type,
policyService = this.policyService;
@ -87,12 +90,16 @@ define(
});
// Ensure there is always a "save in" section
sections.push({ name: 'Location', rows: [{
name: "Save In",
control: "locator",
validate: validateLocation,
key: "createParent"
}]});
if (includeLocation) {
sections.push({
name: 'Location', rows: [{
name: "Save In",
control: "locator",
validate: validateLocation,
key: "createParent"
}]
});
}
return {
sections: sections,
@ -115,7 +122,7 @@ define(
return formModel;
});
return this.domainObject;
}
};
/**
* Get the initial value for the form being described.