mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 20:51:21 -03:30
adding directives to integer min/max and integer default answer fields
this was supposed to be included in the last commit
This commit is contained in:
parent
1b8ebc57e4
commit
25ecd6326d
@ -15,22 +15,12 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
.value('SurveyQuestionForm', {
|
||||
|
||||
addTitle: 'Add Question',
|
||||
// editTitle: '{{ survey_name }}',
|
||||
editTitle: 'Edit Question',
|
||||
base: 'survey_question',
|
||||
name: 'survey_question',
|
||||
well: true,
|
||||
twoColumns: true,
|
||||
|
||||
// actions: {
|
||||
// stream: {
|
||||
// 'class': "btn-primary btn-xs activity-btn",
|
||||
// ngClick: "showActivity()",
|
||||
// awToolTip: "View Activity Stream",
|
||||
// dataPlacement: "top",
|
||||
// icon: "icon-comments-alt",
|
||||
// mode: 'edit',
|
||||
// iconSize: 'large'
|
||||
// }
|
||||
// },
|
||||
breadcrumbs: false,
|
||||
|
||||
fields: {
|
||||
question_name: {
|
||||
@ -57,13 +47,6 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
column: 1
|
||||
// sourceModel: 'organization',
|
||||
// sourceField: 'name',
|
||||
// ngClick: 'lookUpOrganization()',
|
||||
// awRequiredWhen: {
|
||||
// variable: "organizationrequired",
|
||||
// init: "true"
|
||||
// }
|
||||
},
|
||||
type: {
|
||||
realName: 'answer_type',
|
||||
@ -75,15 +58,6 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
column: 2
|
||||
|
||||
},
|
||||
// answer_options_text: {
|
||||
// realName: 'answer_options',
|
||||
// label: 'Answer Options',
|
||||
// type: 'text',
|
||||
// addRequired: true,
|
||||
// editRequired: true,
|
||||
// ngHide: 'answer_type.type!=="text" ',
|
||||
// column: 1
|
||||
// },
|
||||
choices: {
|
||||
realName: 'answer_options',
|
||||
label: 'Multiple Choice Options',
|
||||
@ -91,41 +65,52 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
rows: 3,
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
ngShow: 'type.type==="multiselect" || type.type==="multiplechoice" ',
|
||||
ngRequired: "type.type=== 'multiselect' || type.type=== 'multiplechoice' " ,
|
||||
ngShow: 'type.type=== "multiselect" || type.type=== "multiplechoice" ',
|
||||
awPopOver: '<p>Type an option on each line.</p>'+
|
||||
'<p>For example the following input:<br><br>Apple<br>\n Banana<br>\n Cherry<br><br>would be displayed as:</p>\n'+
|
||||
'<ol><li>Apple</li><li>Banana</li><li>Cherry</li><ol>',
|
||||
'<ol><li>Apple</li><li>Banana</li><li>Cherry</li></ol>',
|
||||
dataTitle: 'Multiple Choice Options',
|
||||
dataPlacement: 'right',
|
||||
dataContainer: "body",
|
||||
column: 2
|
||||
},
|
||||
answer_options_number: {
|
||||
int_options: {
|
||||
realName: 'answer_options',
|
||||
// label: 'Answer Options',
|
||||
type: 'custom',
|
||||
control: '<div class="row">'+
|
||||
'<div class="col-xs-6"><label for="minimum"><span class="label-text">Minimum</span></label><input id="answer_min" type="number" class="form-control"></div>'+
|
||||
'<div class="col-xs-6"><label for="minimum"><span class="label-text">Maximum</span></label><input id="answer_max" type="number" class="form-control"></div></div>',
|
||||
ngShow: 'type.type==="integer" || type.type==="float" ',
|
||||
control:'<div class="row">'+
|
||||
'<div class="col-xs-6">'+
|
||||
'<label for="minimum"><span class="label-text">Minimum</span></label><input id="int_min" type="number" name="int_min" ng-model="int_min" class="form-control" integer >'+
|
||||
'<div class="error" ng-show="survey_question_form.int_min.$invalid">This is not valid integer!</div>'+
|
||||
'</div>'+
|
||||
'<div class="col-xs-6">'+
|
||||
'<label for="minimum"><span class="label-text">Maximum</span></label><input id="int_max" type="number" name="int_max" ng-model="int_max" class="form-control" integer >'+
|
||||
'<div class="error" ng-show="survey_question_form.int_max.$invalid">This is not valid integer!</div>'+
|
||||
'</div>'+
|
||||
'</div>',
|
||||
ngShow: 'type.type==="integer" ',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
column: 2
|
||||
},
|
||||
float_options: {
|
||||
realName: 'answer_options',
|
||||
type: 'custom',
|
||||
control: '<div class="row">'+
|
||||
'<div class="col-xs-6">'+
|
||||
'<label for="minimum"><span class="label-text">Minimum</span></label><input id="float_min" type="number" ng-model="float_min" class="form-control" integer >'+
|
||||
'<div class="error" ng-show="survey_question_form.default_int.$invalid">This is not valid integer!</div>'+
|
||||
'</div>'+
|
||||
'<div class="col-xs-6">'+
|
||||
'<label for="minimum"><span class="label-text">Maximum</span></label><input id="float_max" type="number" ng-model="float_max" class="form-control" integer >'+
|
||||
'<div class="error" ng-show="survey_question_form.float.$invalid">This is not valid integer!</div>'+
|
||||
'</div>'+
|
||||
'</div>',
|
||||
ngShow: 'type.type==="float" ',
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
column: 2
|
||||
},
|
||||
// answer_options_json: {
|
||||
// realName: 'answer_options',
|
||||
// label: 'Answer Options',
|
||||
// type: 'textarea',
|
||||
// rows: 3,
|
||||
// ngShow: 'type.type==="json" ',
|
||||
// addRequired: true,
|
||||
// editRequired: true,
|
||||
// awPopOver: '<p>Insert some good JSON!</p>',
|
||||
// dataTitle: 'Answer Options',
|
||||
// dataPlacement: 'right',
|
||||
// dataContainer: "body",
|
||||
// column: 1
|
||||
// },
|
||||
default: {
|
||||
realName: 'default_answer',
|
||||
label: 'Default Answer',
|
||||
@ -148,8 +133,42 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
default_int: {
|
||||
realName: 'default_answer',
|
||||
type: 'custom',
|
||||
control: '<div class="row">'+
|
||||
'<div class="col-xs-6"><label for="default_int"><span class="label-text">Default Answer</span></label><input id="default_int" ng-model="default_int" type="number" class="form-control"></div></div>',
|
||||
control: '<div>'+
|
||||
'<label for="default_int"><span class="label-text">Default Answer</span></label>'+
|
||||
'<input type="number" ng-model="default_int" name="default_int" ng-min="int_min" ng-max="int_max" class="form-control" integer />'+
|
||||
'<div class="error" ng-show="survey_question_form.default_int.$error.number || survey_question_form.default_int.$error.integer">This is not valid integer!</div>'+
|
||||
'<div class="error" ng-show="survey_question_form.default_int.$error.ngMin || survey_question_form.default_int.$error.ngMax"> The value must be in range {{int_min}} to {{int_max}}!</div>'+
|
||||
// 'value = {{default_int}}<br>'+
|
||||
// 'value.$valid = {{survey_question_form.default_int.$valid}}'+
|
||||
'</div>',
|
||||
|
||||
// '<div class="row">'+
|
||||
// '<div class="col-xs-6"><label for="default_int"><span class="label-text">Default Answer</span></label>'+
|
||||
// '<input id="default_int" ng-model="default_int" type="number" class="form-control" survey-integer></div></div>'+
|
||||
// '<br><div ng-show="survey_question.default_int.$error.survey-integer">This is not valid integer!</div>',
|
||||
|
||||
|
||||
// '<div class="row">'+
|
||||
// '<div class="col-xs-6>'+
|
||||
// '<input id="default_int" ng-model="default_int" type="number" class=" col-xs-6 form-control" integer>'+
|
||||
|
||||
// '<div class="error" id="survey_question-default_int-required-error" ng-show="survey_question.default_int.$error.integer">This is not valid integer!</div>'+
|
||||
// // '<div class="error api-error ng-binding" id="survey_question-default_int-api-error" ng-bind="default_int_api_error"></div>'+
|
||||
// '</div>'+
|
||||
// '</div>',
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// <div>
|
||||
// <input type="text" ng-model="question_name" name="question_name" id="survey_question_question_name" class="form-control ng-pristine ng-invalid ng-invalid-required" required="" aw-survey-question="">
|
||||
// <div class="error ng-hide" id="survey_question-question_name-required-error" ng-show="survey_question_form.question_name.$dirty && survey_question_form.question_name.$error.required">A value is required!</div>
|
||||
// <div class="error api-error ng-binding" id="survey_question-question_name-api-error" ng-bind="question_name_api_error"></div>
|
||||
// </div>
|
||||
|
||||
column: 2,
|
||||
ngShow: 'type.type === "integer" '
|
||||
},
|
||||
@ -175,51 +194,18 @@ angular.module('SurveyQuestionFormDefinition', [])
|
||||
realName: 'required_answer',
|
||||
label: 'Required',
|
||||
type: 'checkbox',
|
||||
// checked: true,
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
column: 2,
|
||||
// trueValue: true,
|
||||
// falseValue: false
|
||||
// label: 'Answer required or optional',
|
||||
// type: 'custom',
|
||||
// column: 2,
|
||||
// control: '<div><label for="required"><span class="label-text">Required</span></label><input id="answer_required" type="radio" checked=true></div>'+
|
||||
// '<div><label for="optional"><span class="label-text">Optional</span></label><input id="answer_optional" type="radio"></div>',
|
||||
|
||||
column: 2
|
||||
}
|
||||
// answer_options: {
|
||||
// label: 'Variables',
|
||||
// type: 'textarea',
|
||||
// 'class': 'span12',
|
||||
// addRequired: false,
|
||||
// editRequird: false,
|
||||
// rows: 6,
|
||||
// "default": "---",
|
||||
// awPopOver: "<p>Enter inventory variables using either JSON or YAML syntax. Use the radio button to toggle between the two.</p>" +
|
||||
// "JSON:<br />\n" +
|
||||
// "<blockquote>{<br />\"somevar\": \"somevalue\",<br />\"password\": \"magic\"<br /> }</blockquote>\n" +
|
||||
// "YAML:<br />\n" +
|
||||
// "<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n" +
|
||||
// '<p>View JSON examples at <a href="http://www.json.org" target="_blank">www.json.org</a></p>' +
|
||||
// '<p>View YAML examples at <a href="http://docs.ansible.com/YAMLSyntax.html" target="_blank">docs.ansible.com</a></p>',
|
||||
// dataTitle: 'Inventory Variables',
|
||||
// dataPlacement: 'right',
|
||||
// dataContainer: 'body'
|
||||
// }
|
||||
// },
|
||||
},
|
||||
buttons: {
|
||||
submit_question: {
|
||||
ngClick: 'submitQuestion()',
|
||||
ngDisabled: "!question_name || !variable || !type || ((type.type==='multiplechoice' || type.type === 'multiselect' ) && !choices)", //|| type.type===multiselect ',//'!question_name || !variable || !type' ,
|
||||
ngDisabled: true, //'survey_question.$valid', //"!question_name || !variable || !type || ((type.type==='multiplechoice' || type.type === 'multiselect' ) && !choices)", //|| type.type===multiselect ',//'!question_name || !variable || !type' ,
|
||||
'class': 'btn btn-sm btn-primary',
|
||||
label: 'Submit Question'
|
||||
}
|
||||
},
|
||||
|
||||
related: {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user