diff --git a/awx/ui/static/js/helpers/Survey.js b/awx/ui/static/js/helpers/Survey.js index 4764fffb87..9163dfcb50 100644 --- a/awx/ui/static/js/helpers/Survey.js +++ b/awx/ui/static/js/helpers/Survey.js @@ -116,7 +116,7 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', $('#survey-modal-dialog').dialog('open'); }); - + scope.resetForm(); Wait('start'); if(scope.mode === 'add'){ tempSurv.survey_name = scope.survey_name; @@ -138,7 +138,7 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', Rest.get() .success(function (data) { if(!Empty(data)){ - generator.inject(form, { id: 'survey-modal-dialog' , mode: 'edit', related: false, scope: scope, breadCrumbs: false }); + // generator.inject(form, { id: 'survey-modal-dialog' , mode: 'edit', related: false, scope: scope, breadCrumbs: false }); ShowSurveyModal({ title: "Edit Survey", scope: scope, callback: 'DialogReady' }); scope.survey_name = data.name; @@ -164,24 +164,24 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', }; }]) - .factory('AddSurvey', ['$location', '$routeParams', 'SchedulerInit', 'ShowSurveyModal', 'Wait', 'GetBasePath', 'Empty', - 'SchedulePost', 'GenerateForm', 'SurveyMakerForm', - function($location, $routeParams, SchedulerInit, ShowSurveyModal, Wait, GetBasePath, Empty, - SchedulePost, GenerateForm, SurveyMakerForm) { + .factory('AddSurvey', ['$location', '$routeParams', 'SchedulerInit', 'ShowSurveyModal', 'Wait', + function($location, $routeParams, SchedulerInit, ShowSurveyModal, Wait) { return function(params) { - var scope = params.scope, + var scope = params.scope; // callback= params.callback, // base = $location.path().replace(/^\//, '').split('/')[0], // url = GetBasePath(base), - generator = GenerateForm, - form = SurveyMakerForm; + // generator = GenerateForm, + // form = SurveyQuestionForm; if (scope.removeDialogReady) { scope.removeDialogReady(); } scope.removeDialogReady = scope.$on('DialogReady', function() { - scope.addQuestion(); + $('#survey-modal-dialog').dialog('open'); + scope.addQuestion(); + // $('#surveyName').focus(); // $('#question_unique_required_chbox').prop('checked' , true); }); @@ -189,8 +189,8 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', Wait('start'); $('#form-container').empty(); - - generator.inject(form, { id: 'survey-modal-dialog' , mode: 'add', related: false, scope: scope, breadCrumbs: false }); + scope.resetForm(); + // generator.inject(form, { id: 'survey-modal-dialog' , mode: 'add', related: false, scope: scope, breadCrumbs: false }); ShowSurveyModal({ title: "Add Survey", scope: scope, callback: 'DialogReady' }); // if (scope.removeScheduleSaved) { @@ -284,7 +284,7 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', index = params.index, required, element, choices, i, checked, - max, min, defaultValue, + max, min, defaultValue, numberValidation, html = ""; @@ -333,9 +333,10 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', if(question.type === 'integer' || question.type === "float"){ min = (question.min) ? question.min : ""; max = (question.max) ? question.max : "" ; + numberValidation = (question.type==="integer") ? "integer" : 'float'; html+='