diff --git a/awx/ui/static/js/helpers/JobSubmission.js b/awx/ui/static/js/helpers/JobSubmission.js index b8a3b5827f..992416e6ba 100644 --- a/awx/ui/static/js/helpers/JobSubmission.js +++ b/awx/ui/static/js/helpers/JobSubmission.js @@ -594,7 +594,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi // html+=''; - html+= '' + + html+= '' + ''+choices[j] +'
' ; } @@ -612,7 +612,7 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi for( j = 0; j' + + html+= '' + ''+choices[j] +'
' ; } diff --git a/awx/ui/static/js/helpers/Survey.js b/awx/ui/static/js/helpers/Survey.js index c865933ce7..aadf3017f7 100644 --- a/awx/ui/static/js/helpers/Survey.js +++ b/awx/ui/static/js/helpers/Survey.js @@ -308,14 +308,14 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', choices = question.choices.split(/\n/); element = (question.type==="multiselect") ? "checkbox" : 'radio'; question.default = (question.default) ? question.default : (question.default_multiselect) ? question.default_multiselect : "" ; + for( i = 0; i'+ - '' +choices[i]+ - ''; + html+= '' + + ''+choices[i] +'
' ; } - } + if(question.type === 'integer'){ min = (!Empty(question.min)) ? question.min : ""; max = (!Empty(question.max)) ? question.max : "" ; @@ -378,7 +378,10 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', var scope = params.scope, index = params.index, - element, fld, i, + element, + //fld, + i, + question = scope.survey_questions[index], form = SurveyQuestionForm; $('#survey-save-button').attr('disabled', 'disabled'); @@ -391,33 +394,54 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', scope.int_max = null; scope.float_min = null; scope.float_max = null; - GenerateForm.inject(form, { id: 'question_'+index, mode: 'edit' , related: false, scope:scope, breadCrumbs: false}); - for(fld in form.fields){ - if( scope.survey_questions[index].type==='integer' && fld === 'int_options'){ - scope.int_min = scope.survey_questions[index].min; - scope.int_max = scope.survey_questions[index].max; - // $("#int_min").val(scope.survey_questions[index].min); - // $("#int_max").val(scope.survey_questions[index].max); - } - if( scope.survey_questions[index].type==='float' && fld === 'float_options' ) { - scope.float_min = scope.survey_questions[index].min; - scope.float_max = scope.survey_questions[index].max; - // $("#float_min").val(scope.survey_questions[index].min); - // $("#float_max").val(scope.survey_questions[index].max); - } - if( fld === 'default_int' || fld === 'default_float'){ - $("#"+fld ).val(scope.survey_questions[index].default); - } - if(form.fields[fld].type === 'select'){ - for (i = 0; i < scope.answer_types.length; i++) { - if (scope.survey_questions[index][fld] === scope.answer_types[i].type) { - scope[fld] = scope.answer_types[i]; + + + + + //GenerateForm.inject(form, { id: 'question_'+index, mode: 'edit' , related: false, scope:scope, breadCrumbs: false}); + + + if (scope.removeFillQuestionForm) { + scope.removeFillQuestionForm(); + } + scope.removeFillQuestionForm = scope.$on('FillQuestionForm', function() { + for( var fld in form.fields){ + scope[fld] = question[fld]; + if(form.fields[fld].type === 'select'){ + for (i = 0; i < scope.answer_types.length; i++) { + if (scope.survey_questions[index][fld] === scope.answer_types[i].type) { + scope[fld] = scope.answer_types[i]; + } } } - } else { - scope[fld] = scope.survey_questions[index][fld]; } + if( question.type === 'integer'){ + scope.int_min = question.min; + scope.int_max = question.max; + scope.default_int = question.default; + } + else if( question.type === 'float' ) { + scope.float_min = question.min; + scope.float_max = question.max; + scope.default_int = question.default; + + } + else if ( question.type === 'multiselect'){ + scope.default_multiselect = question.default; + } + }); + + if (scope.removeGenerateForm) { + scope.removeGenerateForm(); } + scope.removeGenerateForm = scope.$on('GenerateForm', function() { + GenerateForm.inject(form, { id: 'question_'+index, mode: 'edit' , related: false, scope:scope, breadCrumbs: false}); + scope.$emit('FillQuestionForm'); + }); + + + scope.$emit('GenerateForm'); + }; }]) diff --git a/awx/ui/static/less/survey-maker.less b/awx/ui/static/less/survey-maker.less index 4e34d42e4a..d7d56e946e 100644 --- a/awx/ui/static/less/survey-maker.less +++ b/awx/ui/static/less/survey-maker.less @@ -40,6 +40,7 @@ opacity: 0.7; padding: 5px; position: relative; + .final{ margin-left: 15px; margin-top: 5px; @@ -47,6 +48,11 @@ .description{ margin-left: 15px; } + .mc{ + margin-left: 18px; + margin-right: 7px; +} + } #new_question{ @@ -65,13 +71,14 @@ .survey_taker_input{ margin-top: 5px; margin-left: 15px; - - input{ + .mc{ margin-left: 18px; margin-right: 7px; } } + + .survey_taker_description{ padding-left: 30px; }