mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 18:21:03 -03:30
adding cancel button for survey question form
cancel button closes the survey question form and returns the modal into its previous state
This commit is contained in:
@@ -179,7 +179,7 @@ angular.module('SurveyQuestionFormDefinition', [])
|
|||||||
question_cancel : {
|
question_cancel : {
|
||||||
label: 'Cancel',
|
label: 'Cancel',
|
||||||
'class' : 'btn btn-default',
|
'class' : 'btn btn-default',
|
||||||
ngClick: 'cancelQuestion()'
|
ngClick: 'cancelQuestion($event)'
|
||||||
},
|
},
|
||||||
submit_question: {
|
submit_question: {
|
||||||
ngClick: 'submitQuestion()',
|
ngClick: 'submitQuestion()',
|
||||||
|
|||||||
@@ -529,8 +529,20 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper',
|
|||||||
scope: scope
|
scope: scope
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
scope.cancelQuestion = function(){
|
scope.cancelQuestion = function(event){
|
||||||
alert('success');
|
var elementID, key;
|
||||||
|
if(event.target.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.id==="new_question"){
|
||||||
|
$('#new_question .aw-form-well').remove();
|
||||||
|
$('#add_question_btn').show();
|
||||||
|
$('#add_question_btn').removeAttr('disabled');
|
||||||
|
} else {
|
||||||
|
elementID = event.target.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.id;
|
||||||
|
key = elementID.split('_')[1];
|
||||||
|
$('#'+elementID).empty();
|
||||||
|
scope.finalizeQuestion(scope.survey_questions[key] , key);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
scope.questionUp = function(index){
|
scope.questionUp = function(index){
|
||||||
|
|||||||
Reference in New Issue
Block a user