mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 13:36:02 -03:30
Added prompt-for checkboxes to certain fields on the job template forms
This commit is contained in:
@@ -896,10 +896,6 @@ select.field-mini-height {
|
|||||||
font-size: 10.5px;
|
font-size: 10.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ask-checkbox {
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-padding {
|
.no-padding {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
@@ -455,6 +455,12 @@ input[type='radio']:checked:before {
|
|||||||
padding-right: 0px;
|
padding-right: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.Form-subCheckbox {
|
||||||
|
margin-top: 5px;
|
||||||
|
font-size: small;
|
||||||
|
color: @default-interface-txt;
|
||||||
|
}
|
||||||
|
|
||||||
@media only screen and (max-width: 650px) {
|
@media only screen and (max-width: 650px) {
|
||||||
.Form-formGroup {
|
.Form-formGroup {
|
||||||
flex: 1 0 auto;
|
flex: 1 0 auto;
|
||||||
|
|||||||
@@ -119,7 +119,10 @@ export default
|
|||||||
init: false
|
init: false
|
||||||
},
|
},
|
||||||
autocomplete: false,
|
autocomplete: false,
|
||||||
ask: false,
|
subCheckbox: {
|
||||||
|
variable: 'secret_key_ask',
|
||||||
|
text: 'Ask at runtime?'
|
||||||
|
},
|
||||||
clear: false,
|
clear: false,
|
||||||
hasShowInputButton: true,
|
hasShowInputButton: true,
|
||||||
apiField: 'password',
|
apiField: 'password',
|
||||||
@@ -207,7 +210,6 @@ export default
|
|||||||
init: false
|
init: false
|
||||||
},
|
},
|
||||||
autocomplete: false,
|
autocomplete: false,
|
||||||
ask: false,
|
|
||||||
hasShowInputButton: true,
|
hasShowInputButton: true,
|
||||||
clear: false,
|
clear: false,
|
||||||
subForm: 'credentialSubForm'
|
subForm: 'credentialSubForm'
|
||||||
@@ -216,7 +218,6 @@ export default
|
|||||||
labelBind: 'passwordLabel',
|
labelBind: 'passwordLabel',
|
||||||
type: 'sensitive',
|
type: 'sensitive',
|
||||||
ngShow: "kind.value == 'scm' || kind.value == 'vmware' || kind.value == 'openstack'|| kind.value == 'foreman'|| kind.value == 'cloudforms'|| kind.value == 'net' || kind.value == 'azure_rm'",
|
ngShow: "kind.value == 'scm' || kind.value == 'vmware' || kind.value == 'openstack'|| kind.value == 'foreman'|| kind.value == 'cloudforms'|| kind.value == 'net' || kind.value == 'azure_rm'",
|
||||||
ask: false,
|
|
||||||
clear: false,
|
clear: false,
|
||||||
autocomplete: false,
|
autocomplete: false,
|
||||||
hasShowInputButton: true,
|
hasShowInputButton: true,
|
||||||
@@ -232,7 +233,10 @@ export default
|
|||||||
ngShow: "kind.value == 'ssh'",
|
ngShow: "kind.value == 'ssh'",
|
||||||
addRequired: false,
|
addRequired: false,
|
||||||
editRequired: false,
|
editRequired: false,
|
||||||
ask: true,
|
subCheckbox: {
|
||||||
|
variable: 'ssh_password_ask',
|
||||||
|
text: 'Ask at runtime?'
|
||||||
|
},
|
||||||
hasShowInputButton: true,
|
hasShowInputButton: true,
|
||||||
autocomplete: false,
|
autocomplete: false,
|
||||||
subForm: 'credentialSubForm'
|
subForm: 'credentialSubForm'
|
||||||
@@ -266,9 +270,12 @@ export default
|
|||||||
addRequired: false,
|
addRequired: false,
|
||||||
editRequired: false,
|
editRequired: false,
|
||||||
ngDisabled: "keyEntered === false",
|
ngDisabled: "keyEntered === false",
|
||||||
ask: true,
|
subCheckbox: {
|
||||||
|
variable: 'ssh_key_unlock_ask',
|
||||||
|
ngShow: "kind.value == 'ssh'",
|
||||||
|
text: 'Ask at runtime?'
|
||||||
|
},
|
||||||
hasShowInputButton: true,
|
hasShowInputButton: true,
|
||||||
askShow: "kind.value == 'ssh'", // Only allow ask for machine credentials
|
|
||||||
subForm: 'credentialSubForm'
|
subForm: 'credentialSubForm'
|
||||||
},
|
},
|
||||||
"become_method": {
|
"become_method": {
|
||||||
@@ -300,7 +307,10 @@ export default
|
|||||||
ngShow: "(kind.value == 'ssh' && (become_method && become_method.value)) ",
|
ngShow: "(kind.value == 'ssh' && (become_method && become_method.value)) ",
|
||||||
addRequired: false,
|
addRequired: false,
|
||||||
editRequired: false,
|
editRequired: false,
|
||||||
ask: true,
|
subCheckbox: {
|
||||||
|
variable: 'become_password_ask',
|
||||||
|
text: 'Ask at runtime?'
|
||||||
|
},
|
||||||
hasShowInputButton: true,
|
hasShowInputButton: true,
|
||||||
autocomplete: false,
|
autocomplete: false,
|
||||||
subForm: 'credentialSubForm'
|
subForm: 'credentialSubForm'
|
||||||
@@ -391,7 +401,10 @@ export default
|
|||||||
ngShow: "kind.value == 'ssh'",
|
ngShow: "kind.value == 'ssh'",
|
||||||
addRequired: false,
|
addRequired: false,
|
||||||
editRequired: false,
|
editRequired: false,
|
||||||
ask: true,
|
subCheckbox: {
|
||||||
|
variable: 'vault_password_ask',
|
||||||
|
text: 'Ask at runtime?'
|
||||||
|
},
|
||||||
hasShowInputButton: true,
|
hasShowInputButton: true,
|
||||||
autocomplete: false,
|
autocomplete: false,
|
||||||
subForm: 'credentialSubForm'
|
subForm: 'credentialSubForm'
|
||||||
|
|||||||
@@ -50,7 +50,12 @@ export default
|
|||||||
" syntax, test environment setup and report problems.</p>",
|
" syntax, test environment setup and report problems.</p>",
|
||||||
dataTitle: 'Job Type',
|
dataTitle: 'Job Type',
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
dataContainer: "body"
|
dataContainer: "body",
|
||||||
|
subCheckbox: {
|
||||||
|
variable: 'ask_job_type_on_launch',
|
||||||
|
ngShow: "!job_type.value || job_type.value !== 'scan'",
|
||||||
|
text: 'Prompt on launch'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
inventory: {
|
inventory: {
|
||||||
label: 'Inventory',
|
label: 'Inventory',
|
||||||
@@ -59,14 +64,20 @@ export default
|
|||||||
sourceField: 'name',
|
sourceField: 'name',
|
||||||
ngClick: 'lookUpInventory()',
|
ngClick: 'lookUpInventory()',
|
||||||
awRequiredWhen: {
|
awRequiredWhen: {
|
||||||
reqExpression: "inventoryrequired",
|
reqExpression: '!ask_inventory_on_launch',
|
||||||
init: "true"
|
alwaysShowAsterisk: true
|
||||||
},
|
},
|
||||||
|
requiredErrorMsg: "Please select an Inventory or check the Prompt on launch option.",
|
||||||
column: 1,
|
column: 1,
|
||||||
awPopOver: "<p>Select the inventory containing the hosts you want this job to manage.</p>",
|
awPopOver: "<p>Select the inventory containing the hosts you want this job to manage.</p>",
|
||||||
dataTitle: 'Inventory',
|
dataTitle: 'Inventory',
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
dataContainer: "body"
|
dataContainer: "body",
|
||||||
|
subCheckbox: {
|
||||||
|
variable: 'ask_inventory_on_launch',
|
||||||
|
ngShow: "!job_type.value || job_type.value !== 'scan'",
|
||||||
|
text: 'Prompt on launch'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
project: {
|
project: {
|
||||||
label: 'Project',
|
label: 'Project',
|
||||||
@@ -90,7 +101,7 @@ export default
|
|||||||
ngOptions: 'book for book in playbook_options track by book',
|
ngOptions: 'book for book in playbook_options track by book',
|
||||||
id: 'playbook-select',
|
id: 'playbook-select',
|
||||||
awRequiredWhen: {
|
awRequiredWhen: {
|
||||||
reqExpression: "playbookrequired",
|
reqExpression: "playbookrequired",
|
||||||
init: "true"
|
init: "true"
|
||||||
},
|
},
|
||||||
column: 1,
|
column: 1,
|
||||||
@@ -111,14 +122,21 @@ export default
|
|||||||
sourceModel: 'credential',
|
sourceModel: 'credential',
|
||||||
sourceField: 'name',
|
sourceField: 'name',
|
||||||
ngClick: 'lookUpCredential()',
|
ngClick: 'lookUpCredential()',
|
||||||
addRequired: false,
|
awRequiredWhen: {
|
||||||
editRequired: false,
|
reqExpression: '!ask_credential_on_launch',
|
||||||
|
alwaysShowAsterisk: true
|
||||||
|
},
|
||||||
|
requiredErrorMsg: "Please select a Machine Credential or check the Prompt on launch option.",
|
||||||
column: 1,
|
column: 1,
|
||||||
awPopOver: "<p>Select the credential you want the job to use when accessing the remote hosts. Choose the credential containing " +
|
awPopOver: "<p>Select the credential you want the job to use when accessing the remote hosts. Choose the credential containing " +
|
||||||
" the username and SSH key or password that Ansible will need to log into the remote hosts.</p>",
|
" the username and SSH key or password that Ansible will need to log into the remote hosts.</p>",
|
||||||
dataTitle: 'Credential',
|
dataTitle: 'Credential',
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
dataContainer: "body"
|
dataContainer: "body",
|
||||||
|
subCheckbox: {
|
||||||
|
variable: 'ask_credential_on_launch',
|
||||||
|
text: 'Prompt on launch'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
cloud_credential: {
|
cloud_credential: {
|
||||||
label: 'Cloud Credential',
|
label: 'Cloud Credential',
|
||||||
@@ -165,7 +183,11 @@ export default
|
|||||||
"<a href=\"http://docs.ansible.com/intro_patterns.html\" target=\"_blank\">the Patterns topic at docs.ansible.com</a>.</p>",
|
"<a href=\"http://docs.ansible.com/intro_patterns.html\" target=\"_blank\">the Patterns topic at docs.ansible.com</a>.</p>",
|
||||||
dataTitle: 'Limit',
|
dataTitle: 'Limit',
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
dataContainer: "body"
|
dataContainer: "body",
|
||||||
|
subCheckbox: {
|
||||||
|
variable: 'ask_limit_on_launch',
|
||||||
|
text: 'Prompt on launch'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
verbosity: {
|
verbosity: {
|
||||||
label: 'Verbosity',
|
label: 'Verbosity',
|
||||||
@@ -196,7 +218,11 @@ export default
|
|||||||
"in the Job Tags field:</p>\n<blockquote>configuration,packages</blockquote>\n",
|
"in the Job Tags field:</p>\n<blockquote>configuration,packages</blockquote>\n",
|
||||||
dataTitle: "Job Tags",
|
dataTitle: "Job Tags",
|
||||||
dataPlacement: "right",
|
dataPlacement: "right",
|
||||||
dataContainer: "body"
|
dataContainer: "body",
|
||||||
|
subCheckbox: {
|
||||||
|
variable: 'ask_tags_on_launch',
|
||||||
|
text: 'Prompt on launch'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
labels: {
|
labels: {
|
||||||
label: 'Labels',
|
label: 'Labels',
|
||||||
@@ -227,20 +253,11 @@ export default
|
|||||||
"<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n",
|
"<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n",
|
||||||
dataTitle: 'Extra Variables',
|
dataTitle: 'Extra Variables',
|
||||||
dataPlacement: 'right',
|
dataPlacement: 'right',
|
||||||
dataContainer: "body"
|
dataContainer: "body",
|
||||||
},
|
subCheckbox: {
|
||||||
ask_variables_on_launch: {
|
variable: 'ask_variables_on_launch',
|
||||||
label: 'Prompt for Extra Variables',
|
text: 'Prompt on launch'
|
||||||
type: 'checkbox',
|
}
|
||||||
addRequired: false,
|
|
||||||
editRequird: false,
|
|
||||||
trueValue: 'true',
|
|
||||||
falseValue: 'false',
|
|
||||||
column: 2,
|
|
||||||
awPopOver: "<p>If checked, user will be prompted at job launch with a dialog allowing override of the extra variables setting.</p>",
|
|
||||||
dataPlacement: 'right',
|
|
||||||
dataTitle: 'Prompt for Extra Variables',
|
|
||||||
dataContainer: "body"
|
|
||||||
},
|
},
|
||||||
become_enabled: {
|
become_enabled: {
|
||||||
label: 'Enable Privilege Escalation',
|
label: 'Enable Privilege Escalation',
|
||||||
|
|||||||
@@ -115,9 +115,24 @@ angular.module('JobTemplatesHelper', ['Utilities'])
|
|||||||
|
|
||||||
scope.survey_enabled = data.survey_enabled;
|
scope.survey_enabled = data.survey_enabled;
|
||||||
|
|
||||||
scope.ask_variables_on_launch = (data.ask_variables_on_launch) ? 'true' : 'false';
|
scope.ask_variables_on_launch = (data.ask_variables_on_launch) ? true : false;
|
||||||
master.ask_variables_on_launch = scope.ask_variables_on_launch;
|
master.ask_variables_on_launch = scope.ask_variables_on_launch;
|
||||||
|
|
||||||
|
scope.ask_limit_on_launch = (data.ask_limit_on_launch) ? true : false;
|
||||||
|
master.ask_limit_on_launch = scope.ask_limit_on_launch;
|
||||||
|
|
||||||
|
scope.ask_tags_on_launch = (data.ask_tags_on_launch) ? true : false;
|
||||||
|
master.ask_tags_on_launch = scope.ask_tags_on_launch;
|
||||||
|
|
||||||
|
scope.ask_job_type_on_launch = (data.ask_job_type_on_launch) ? true : false;
|
||||||
|
master.ask_job_type_on_launch = scope.ask_job_type_on_launch;
|
||||||
|
|
||||||
|
scope.ask_inventory_on_launch = (data.ask_inventory_on_launch) ? true : false;
|
||||||
|
master.ask_inventory_on_launch = scope.ask_inventory_on_launch;
|
||||||
|
|
||||||
|
scope.ask_credential_on_launch = (data.ask_credential_on_launch) ? true : false;
|
||||||
|
master.ask_credential_on_launch = scope.ask_credential_on_launch;
|
||||||
|
|
||||||
relatedSets = form.relatedSets(data.related);
|
relatedSets = form.relatedSets(data.related);
|
||||||
|
|
||||||
if (data.host_config_key) {
|
if (data.host_config_key) {
|
||||||
|
|||||||
@@ -230,6 +230,10 @@
|
|||||||
$scope.jobTypeChange = function(){
|
$scope.jobTypeChange = function(){
|
||||||
if($scope.job_type){
|
if($scope.job_type){
|
||||||
if($scope.job_type.value === 'scan'){
|
if($scope.job_type.value === 'scan'){
|
||||||
|
// If the job_type is 'scan' then we don't want the user to be
|
||||||
|
// able to prompt for job type or inventory
|
||||||
|
$scope.ask_job_type_on_launch = false;
|
||||||
|
$scope.ask_inventory_on_launch = false;
|
||||||
$scope.toggleScanInfo();
|
$scope.toggleScanInfo();
|
||||||
}
|
}
|
||||||
else if($scope.project_name === "Default"){
|
else if($scope.project_name === "Default"){
|
||||||
@@ -478,6 +482,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.ask_tags_on_launch = $scope.ask_tags_on_launch ? $scope.ask_tags_on_launch : false;
|
||||||
|
data.ask_limit_on_launch = $scope.ask_limit_on_launch ? $scope.ask_limit_on_launch : false;
|
||||||
|
data.ask_job_type_on_launch = $scope.ask_job_type_on_launch ? $scope.ask_job_type_on_launch : false;
|
||||||
|
data.ask_inventory_on_launch = $scope.ask_inventory_on_launch ? $scope.ask_inventory_on_launch : false;
|
||||||
|
data.ask_variables_on_launch = $scope.ask_variables_on_launch ? $scope.ask_variables_on_launch : false;
|
||||||
|
data.ask_credential_on_launch = $scope.ask_credential_on_launch ? $scope.ask_credential_on_launch : false;
|
||||||
|
|
||||||
data.extra_vars = ToJSON($scope.parseType,
|
data.extra_vars = ToJSON($scope.parseType,
|
||||||
$scope.variables, true);
|
$scope.variables, true);
|
||||||
if(data.job_type === 'scan' &&
|
if(data.job_type === 'scan' &&
|
||||||
|
|||||||
@@ -117,6 +117,10 @@ export default
|
|||||||
$scope.jobTypeChange = function(){
|
$scope.jobTypeChange = function(){
|
||||||
if($scope.job_type){
|
if($scope.job_type){
|
||||||
if($scope.job_type.value === 'scan'){
|
if($scope.job_type.value === 'scan'){
|
||||||
|
// If the job_type is 'scan' then we don't want the user to be
|
||||||
|
// able to prompt for job type or inventory
|
||||||
|
$scope.ask_job_type_on_launch = false;
|
||||||
|
$scope.ask_inventory_on_launch = false;
|
||||||
$scope.toggleScanInfo();
|
$scope.toggleScanInfo();
|
||||||
}
|
}
|
||||||
else if($scope.project_name === "Default"){
|
else if($scope.project_name === "Default"){
|
||||||
@@ -549,6 +553,14 @@ export default
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.ask_tags_on_launch = $scope.ask_tags_on_launch ? $scope.ask_tags_on_launch : false;
|
||||||
|
data.ask_limit_on_launch = $scope.ask_limit_on_launch ? $scope.ask_limit_on_launch : false;
|
||||||
|
data.ask_job_type_on_launch = $scope.ask_job_type_on_launch ? $scope.ask_job_type_on_launch : false;
|
||||||
|
data.ask_inventory_on_launch = $scope.ask_inventory_on_launch ? $scope.ask_inventory_on_launch : false;
|
||||||
|
data.ask_variables_on_launch = $scope.ask_variables_on_launch ? $scope.ask_variables_on_launch : false;
|
||||||
|
data.ask_credential_on_launch = $scope.ask_credential_on_launch ? $scope.ask_credential_on_launch : false;
|
||||||
|
|
||||||
data.extra_vars = ToJSON($scope.parseType,
|
data.extra_vars = ToJSON($scope.parseType,
|
||||||
$scope.variables, true);
|
$scope.variables, true);
|
||||||
if(data.job_type === 'scan' &&
|
if(data.job_type === 'scan' &&
|
||||||
|
|||||||
@@ -343,13 +343,16 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'JobsHelper'])
|
|||||||
|
|
||||||
var viewValue = elm.val(), label, validity = true;
|
var viewValue = elm.val(), label, validity = true;
|
||||||
label = $(elm).closest('.form-group').find('label').first();
|
label = $(elm).closest('.form-group').find('label').first();
|
||||||
|
|
||||||
if ( isRequired && (elm.attr('required') === null || elm.attr('required') === undefined) ) {
|
if ( isRequired && (elm.attr('required') === null || elm.attr('required') === undefined) ) {
|
||||||
$(elm).attr('required','required');
|
$(elm).attr('required','required');
|
||||||
$(label).addClass('prepend-asterisk');
|
$(label).removeClass('prepend-asterisk').addClass('prepend-asterisk');
|
||||||
}
|
}
|
||||||
else if (!isRequired) {
|
else if (!isRequired) {
|
||||||
elm.removeAttr('required');
|
elm.removeAttr('required');
|
||||||
$(label).removeClass('prepend-asterisk');
|
if(!attrs.awrequiredAlwaysShowAsterisk) {
|
||||||
|
$(label).removeClass('prepend-asterisk');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isRequired && (viewValue === undefined || viewValue === null || viewValue === '')) {
|
if (isRequired && (viewValue === undefined || viewValue === null || viewValue === '')) {
|
||||||
validity = false;
|
validity = false;
|
||||||
|
|||||||
@@ -438,8 +438,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
if (f.awPassMatch && scope[form.name + '_form'][fld]) {
|
if (f.awPassMatch && scope[form.name + '_form'][fld]) {
|
||||||
scope[form.name + '_form'][fld].$setValidity('awpassmatch', true);
|
scope[form.name + '_form'][fld].$setValidity('awpassmatch', true);
|
||||||
}
|
}
|
||||||
if (f.ask) {
|
if (f.subCheckbox) {
|
||||||
scope[fld + '_ask'] = false;
|
scope[f.subCheckbox.variable] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -786,14 +786,15 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += (field.awPassMatch) ? "awpassmatch=\"" + field.associated + "\" " : "";
|
html += (field.awPassMatch) ? "awpassmatch=\"" + field.associated + "\" " : "";
|
||||||
html += (field.capitalize) ? "capitalize " : "";
|
html += (field.capitalize) ? "capitalize " : "";
|
||||||
html += (field.awSurveyQuestion) ? "aw-survey-question" : "" ;
|
html += (field.awSurveyQuestion) ? "aw-survey-question" : "" ;
|
||||||
html += (field.ask) ? "ng-disabled=\"" + fld + "_ask\" " : "";
|
html += (field.subCheckbox) ? "ng-disabled=\"" + field.subCheckbox.variable + "\" " : "";
|
||||||
html += (field.autocomplete !== undefined) ? this.attr(field, 'autocomplete') : "";
|
html += (field.autocomplete !== undefined) ? this.attr(field, 'autocomplete') : "";
|
||||||
if(field.awRequiredWhen) {
|
if(field.awRequiredWhen) {
|
||||||
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
||||||
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
||||||
|
html += field.awRequiredWhen.alwaysShowAsterisk ? "data-awrequired-always-show-asterisk=true " : "";
|
||||||
}
|
}
|
||||||
html += (field.awValidUrl) ? "aw-valid-url " : "";
|
html += (field.awValidUrl) ? "aw-valid-url " : "";
|
||||||
html += (field.associated && this.form.fields[field.associated].ask) ? "ng-disabled=\"" + field.associated + "_ask\" " : "";
|
html += (field.associated && this.form.fields[field.associated].subCheckbox) ? "ng-disabled=\"" + this.form.fields[field.associated].subCheckbox.variable + "\" " : "";
|
||||||
html += ">\n";
|
html += ">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,18 +803,9 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += "id=\"" + this.form.name + "_" + fld + "_clear_btn\" ";
|
html += "id=\"" + this.form.name + "_" + fld + "_clear_btn\" ";
|
||||||
html += "class=\"btn btn-default\" ng-click=\"clear('" + fld + "','" + field.associated + "')\" " +
|
html += "class=\"btn btn-default\" ng-click=\"clear('" + fld + "','" + field.associated + "')\" " +
|
||||||
"aw-tool-tip=\"Clear " + field.label + "\" id=\"" + fld + "-clear-btn\" ";
|
"aw-tool-tip=\"Clear " + field.label + "\" id=\"" + fld + "-clear-btn\" ";
|
||||||
html += (field.ask) ? "ng-disabled=\"" + fld + "_ask\" " : "";
|
html += (field.subCheckbox) ? "ng-disabled=\"" + field.subCheckbox.variable + "\" " : "";
|
||||||
html += " ><i class=\"fa fa-undo\"></i></button>\n";
|
html += " ><i class=\"fa fa-undo\"></i></button>\n";
|
||||||
html += "</span>\n</div>\n";
|
html += "</span>\n</div>\n";
|
||||||
if (field.ask) {
|
|
||||||
html += "<label class=\"checkbox-inline ask-checkbox\" ";
|
|
||||||
html += (field.askShow) ? "ng-show=\"" + field.askShow + "\" " : "";
|
|
||||||
html += ">";
|
|
||||||
html += "<input type=\"checkbox\" ng-model=\"" +
|
|
||||||
fld + "_ask\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
|
||||||
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
|
||||||
html += "> Ask at runtime?</label>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field.genMD5) {
|
if (field.genMD5) {
|
||||||
@@ -822,11 +814,23 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
"<i class=\"fa fa-magic\"></i></button></span>\n</div>\n";
|
"<i class=\"fa fa-magic\"></i></button></span>\n</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (field.subCheckbox) {
|
||||||
|
html += "<label class=\"checkbox-inline Form-subCheckbox\" ";
|
||||||
|
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||||
|
html += ">";
|
||||||
|
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||||
|
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||||
|
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||||
|
html += ">";
|
||||||
|
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||||
|
html += "</label>";
|
||||||
|
}
|
||||||
|
|
||||||
// Add error messages
|
// Add error messages
|
||||||
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) ||
|
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) ||
|
||||||
field.awRequiredWhen) {
|
field.awRequiredWhen) {
|
||||||
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-required-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-required-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
||||||
this.form.name + '_form.' + fld + ".$error.required\">Please enter a value.</div>\n";
|
this.form.name + '_form.' + fld + ".$error.required\">" + (field.requiredErrorMsg ? field.requiredErrorMsg : "Please enter a value.") + "</div>\n";
|
||||||
}
|
}
|
||||||
if (field.type === "email") {
|
if (field.type === "email") {
|
||||||
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-email-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-email-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
||||||
@@ -877,16 +881,16 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += buildId(field, fld + "_show_input_button", this.form);
|
html += buildId(field, fld + "_show_input_button", this.form);
|
||||||
html += "aw-tool-tip='Toggle the display of plaintext.' aw-tip-placement='top' ";
|
html += "aw-tool-tip='Toggle the display of plaintext.' aw-tip-placement='top' ";
|
||||||
html += "ng-click='" + fld + "_field.toggleInput(\"#" + this.form.name + "_" + fld + "\")'";
|
html += "ng-click='" + fld + "_field.toggleInput(\"#" + this.form.name + "_" + fld + "\")'";
|
||||||
if (field.ngDisabled || field.ask) {
|
if (field.ngDisabled || field.subCheckbox) {
|
||||||
var disabled = "";
|
var disabled = "";
|
||||||
if (field.ngDisabled) {
|
if (field.ngDisabled) {
|
||||||
disabled += field.ngDisabled;
|
disabled += field.ngDisabled;
|
||||||
}
|
}
|
||||||
if (field.ngDisabled && field.ask) {
|
if (field.ngDisabled && field.subCheckbox) {
|
||||||
disabled += " || ";
|
disabled += " || ";
|
||||||
}
|
}
|
||||||
if (field.ask) {
|
if (field.subCheckbox) {
|
||||||
disabled += fld + "_ask";
|
disabled += field.subCheckbox.variable;
|
||||||
}
|
}
|
||||||
html += "ng-disabled='" + disabled + "'";
|
html += "ng-disabled='" + disabled + "'";
|
||||||
}
|
}
|
||||||
@@ -924,16 +928,16 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += (field.capitalize) ? "capitalize " : "";
|
html += (field.capitalize) ? "capitalize " : "";
|
||||||
html += (field.awSurveyQuestion) ? "aw-survey-question" : "";
|
html += (field.awSurveyQuestion) ? "aw-survey-question" : "";
|
||||||
|
|
||||||
if (field.ngDisabled || field.ask) {
|
if (field.ngDisabled || field.subCheckbox) {
|
||||||
var _disabled = "";
|
var _disabled = "";
|
||||||
if (field.ngDisabled) {
|
if (field.ngDisabled) {
|
||||||
_disabled += field.ngDisabled;
|
_disabled += field.ngDisabled;
|
||||||
}
|
}
|
||||||
if (field.ngDisabled && field.ask) {
|
if (field.ngDisabled && field.subCheckbox) {
|
||||||
_disabled += " || ";
|
_disabled += " || ";
|
||||||
}
|
}
|
||||||
if (field.ask) {
|
if (field.subCheckbox) {
|
||||||
_disabled += fld + "_ask";
|
_disabled += field.subCheckbox.variable;
|
||||||
}
|
}
|
||||||
html += "ng-disabled='" + _disabled + "'";
|
html += "ng-disabled='" + _disabled + "'";
|
||||||
}
|
}
|
||||||
@@ -941,6 +945,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
if(field.awRequiredWhen) {
|
if(field.awRequiredWhen) {
|
||||||
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
||||||
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
||||||
|
html += field.awRequiredWhen.alwaysShowAsterisk ? "data-awrequired-always-show-asterisk=true " : "";
|
||||||
}
|
}
|
||||||
html += (field.awValidUrl) ? "aw-valid-url " : "";
|
html += (field.awValidUrl) ? "aw-valid-url " : "";
|
||||||
html += (field.associated && this.form.fields[field.associated].ask) ? "ng-disabled='" + field.associated + "_foo' " : "";
|
html += (field.associated && this.form.fields[field.associated].ask) ? "ng-disabled='" + field.associated + "_foo' " : "";
|
||||||
@@ -949,41 +954,26 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
|
|
||||||
html += "</div>\n";
|
html += "</div>\n";
|
||||||
|
|
||||||
// if (field.clear) {
|
if (field.subCheckbox) {
|
||||||
// html += "<span class=\"input-group-btn\"><button type=\"button\" ";
|
html += "<label class=\"checkbox-inline Form-subCheckbox\" ";
|
||||||
// html += "id=\"" + this.form.name + "_" + fld + "_clear_btn\" ";
|
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||||
// html += "class=\"btn btn-default\" ng-click=\"clear('" + fld + "','" + field.associated + "')\" " +
|
|
||||||
// "aw-tool-tip=\"Clear " + field.label + "\" id=\"" + fld + "-clear-btn\" ";
|
|
||||||
// html += (field.ask) ? "ng-disabled=\"" + fld + "_ask\" " : "";
|
|
||||||
// html += " ><i class=\"fa fa-undo\"></i></button>\n";
|
|
||||||
// html += "</span>\n</div>\n";
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (field.ask) {
|
|
||||||
html += "<label class=\"checkbox-inline ask-checkbox\" ";
|
|
||||||
html += (field.askShow) ? "ng-show=\"" + field.askShow + "\" " : "";
|
|
||||||
html += ">";
|
html += ">";
|
||||||
html += "<input type=\"checkbox\" ng-model=\"" +
|
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||||
fld + "_ask\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||||
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||||
if (field.ngDisabled) {
|
if (field.ngDisabled) {
|
||||||
html += "ng-disabled='" + field.ngDisabled + "'";
|
html += "ng-disabled='" + field.ngDisabled + "'";
|
||||||
}
|
}
|
||||||
html += "> Ask at runtime?</label>";
|
html += ">";
|
||||||
|
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||||
|
html += "</label>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (field.genMD5) {
|
|
||||||
// html += "<span class=\"input-group-btn\"><button type=\"button\" class=\"btn btn-default\" ng-click=\"genMD5('" + fld + "')\" " +
|
|
||||||
// "aw-tool-tip=\"Generate " + field.label + "\" data-placement=\"top\" id=\"" + this.form.name + "_" + fld + "_gen_btn\">" +
|
|
||||||
// "<i class=\"fa fa-magic\"></i></button></span>\n</div>\n";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Add error messages
|
// Add error messages
|
||||||
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) ||
|
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) ||
|
||||||
field.awRequiredWhen) {
|
field.awRequiredWhen) {
|
||||||
html += "<div class='error' id='" + this.form.name + "-" + fld + "-required-error' ng-show='" + this.form.name + "_form." + fld + ".$dirty && " +
|
html += "<div class='error' id='" + this.form.name + "-" + fld + "-required-error' ng-show='" + this.form.name + "_form." + fld + ".$dirty && " +
|
||||||
this.form.name + "_form." + fld + ".$error.required'>\nPlease enter a value.\n</div>\n";
|
this.form.name + "_form." + fld + ".$error.required'>\n" + (field.requiredErrorMsg ? field.requiredErrorMsg : "Please enter a value.") + "\n</div>\n";
|
||||||
}
|
}
|
||||||
if (field.type === "email") {
|
if (field.type === "email") {
|
||||||
html += "<div class='error' id='" + this.form.name + "-" + fld + "-email-error' ng-show='" + this.form.name + "_form." + fld + ".$dirty && " +
|
html += "<div class='error' id='" + this.form.name + "-" + fld + "-email-error' ng-show='" + this.form.name + "_form." + fld + ".$dirty && " +
|
||||||
@@ -1054,14 +1044,26 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
if(field.awRequiredWhen) {
|
if(field.awRequiredWhen) {
|
||||||
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
||||||
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
||||||
|
html += field.awRequiredWhen.alwaysShowAsterisk ? "data-awrequired-always-show-asterisk=true " : "";
|
||||||
}
|
}
|
||||||
html += "aw-watch ></textarea>\n";
|
html += "aw-watch ></textarea>\n";
|
||||||
|
|
||||||
|
if (field.subCheckbox) {
|
||||||
|
html += "<label class=\"checkbox-inline Form-subCheckbox\" ";
|
||||||
|
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||||
|
html += ">";
|
||||||
|
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||||
|
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||||
|
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||||
|
html += ">";
|
||||||
|
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||||
|
html += "</label>";
|
||||||
|
}
|
||||||
|
|
||||||
// Add error messages
|
// Add error messages
|
||||||
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired)) {
|
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired)) {
|
||||||
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-required-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-required-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
||||||
this.form.name + '_form.' + fld + ".$error.required\">Please enter a value.</div>\n";
|
this.form.name + '_form.' + fld + ".$error.required\">" + (field.requiredErrorMsg ? field.requiredErrorMsg : "Please enter a value.") + "</div>\n";
|
||||||
}
|
}
|
||||||
html += "<div class=\"error api-error\" id=\"" + this.form.name + "-" + fld + "-api-error\" ng-bind=\"" + fld + "_api_error\"></div>\n";
|
html += "<div class=\"error api-error\" id=\"" + this.form.name + "-" + fld + "-api-error\" ng-bind=\"" + fld + "_api_error\"></div>\n";
|
||||||
html += "</div>\n";
|
html += "</div>\n";
|
||||||
@@ -1095,6 +1097,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
if(field.awRequiredWhen) {
|
if(field.awRequiredWhen) {
|
||||||
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
||||||
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
||||||
|
html += field.awRequiredWhen.alwaysShowAsterisk ? "data-awrequired-always-show-asterisk=true " : "";
|
||||||
}
|
}
|
||||||
html += ">\n";
|
html += ">\n";
|
||||||
if(!field.multiSelect){
|
if(!field.multiSelect){
|
||||||
@@ -1107,11 +1110,23 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += "</select>\n";
|
html += "</select>\n";
|
||||||
html += "</div>\n";
|
html += "</div>\n";
|
||||||
|
|
||||||
|
if (field.subCheckbox) {
|
||||||
|
html += "<label class=\"checkbox-inline Form-subCheckbox\" ";
|
||||||
|
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||||
|
html += ">";
|
||||||
|
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||||
|
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||||
|
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||||
|
html += ">";
|
||||||
|
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||||
|
html += "</label>";
|
||||||
|
}
|
||||||
|
|
||||||
// Add error messages
|
// Add error messages
|
||||||
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) ||
|
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) ||
|
||||||
field.awRequiredWhen) {
|
field.awRequiredWhen) {
|
||||||
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-required-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-required-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
||||||
this.form.name + '_form.' + fld + ".$error.required\">Please select a value.</div>\n";
|
this.form.name + '_form.' + fld + ".$error.required\">" + (field.requiredErrorMsg ? field.requiredErrorMsg : "Please select a value.") + "</div>\n";
|
||||||
}
|
}
|
||||||
html += "<div class=\"error api-error\" id=\"" + this.form.name + "-" + fld + "-api-error\" ng-bind=\"" + fld + "_api_error\"></div>\n";
|
html += "<div class=\"error api-error\" id=\"" + this.form.name + "-" + fld + "-api-error\" ng-bind=\"" + fld + "_api_error\"></div>\n";
|
||||||
|
|
||||||
@@ -1155,12 +1170,26 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
if(field.awRequiredWhen) {
|
if(field.awRequiredWhen) {
|
||||||
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
||||||
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
||||||
|
html += field.awRequiredWhen.alwaysShowAsterisk ? "data-awrequired-always-show-asterisk=true " : "";
|
||||||
}
|
}
|
||||||
html += " >\n";
|
html += " >\n";
|
||||||
|
|
||||||
|
if (field.subCheckbox) {
|
||||||
|
html += "<label class=\"checkbox-inline Form-subCheckbox\" ";
|
||||||
|
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||||
|
html += ">";
|
||||||
|
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||||
|
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||||
|
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||||
|
html += ">";
|
||||||
|
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||||
|
html += "</label>";
|
||||||
|
}
|
||||||
|
|
||||||
// Add error messages
|
// Add error messages
|
||||||
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired)) {
|
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired)) {
|
||||||
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-required-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-required-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
||||||
this.form.name + '_form.' + fld + ".$error.required\">Please enter a value.</div>\n";
|
this.form.name + '_form.' + fld + ".$error.required\">" + (field.requiredErrorMsg ? field.requiredErrorMsg : "Please select a value.") + "</div>\n";
|
||||||
}
|
}
|
||||||
if (field.integer) {
|
if (field.integer) {
|
||||||
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-integer-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$error.integer\">Please enter a number.</div>\n";
|
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-integer-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$error.integer\">Please enter a number.</div>\n";
|
||||||
@@ -1193,7 +1222,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
// Add error messages
|
// Add error messages
|
||||||
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired)) {
|
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired)) {
|
||||||
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-required-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-required-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$dirty && " +
|
||||||
this.form.name + '_form.' + fld + ".$error.required\">Please select at least one value.</div>\n";
|
this.form.name + '_form.' + fld + ".$error.required\">" + (field.requiredErrorMsg ? field.requiredErrorMsg : "Please select at least one value.") + "</div>\n";
|
||||||
}
|
}
|
||||||
if (field.integer) {
|
if (field.integer) {
|
||||||
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-integer-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$error.integer\">Please select a number.</div>\n";
|
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-integer-error\" ng-show=\"" + this.form.name + '_form.' + fld + ".$error.integer\">Please select a number.</div>\n";
|
||||||
@@ -1342,9 +1371,23 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
if(field.awRequiredWhen) {
|
if(field.awRequiredWhen) {
|
||||||
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
|
||||||
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
|
||||||
|
html += field.awRequiredWhen.alwaysShowAsterisk ? "data-awrequired-always-show-asterisk=true " : "";
|
||||||
}
|
}
|
||||||
html += " awlookup >\n";
|
html += " awlookup >\n";
|
||||||
html += "</div>\n";
|
html += "</div>\n";
|
||||||
|
|
||||||
|
if (field.subCheckbox) {
|
||||||
|
html += "<label class=\"checkbox-inline Form-subCheckbox\" ";
|
||||||
|
html += (field.subCheckbox.ngShow) ? "ng-show=\"" + field.subCheckbox.ngShow + "\" " : "";
|
||||||
|
html += ">";
|
||||||
|
html += "<input type=\"checkbox\" ng-model=\"" +
|
||||||
|
field.subCheckbox.variable + "\" ng-change=\"ask('" + fld + "','" + field.associated + "')\" ";
|
||||||
|
html += "id=\"" + this.form.name + "_" + fld + "_ask_chbox\" ";
|
||||||
|
html += ">";
|
||||||
|
html += field.subCheckbox.text ? field.subCheckbox.text : "";
|
||||||
|
html += "</label>";
|
||||||
|
}
|
||||||
|
|
||||||
// Add error messages
|
// Add error messages
|
||||||
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) ||
|
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) ||
|
||||||
field.awRequiredWhen) {
|
field.awRequiredWhen) {
|
||||||
@@ -1352,7 +1395,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
this.form.name + '_form.' +
|
this.form.name + '_form.' +
|
||||||
field.sourceModel + '_' + field.sourceField + ".$dirty && " +
|
field.sourceModel + '_' + field.sourceField + ".$dirty && " +
|
||||||
this.form.name + '_form.' + field.sourceModel + '_' + field.sourceField +
|
this.form.name + '_form.' + field.sourceModel + '_' + field.sourceField +
|
||||||
".$error.required\">Please select a value.</div>\n";
|
".$error.required\">" + (field.requiredErrorMsg ? field.requiredErrorMsg : "Please select a value.") + "</div>\n";
|
||||||
}
|
}
|
||||||
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-notfound-error\" ng-show=\"" +
|
html += "<div class=\"error\" id=\"" + this.form.name + "-" + fld + "-notfound-error\" ng-show=\"" +
|
||||||
this.form.name + '_form.' +
|
this.form.name + '_form.' +
|
||||||
|
|||||||
Reference in New Issue
Block a user