1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

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:
Jared Tabor 2014-10-10 14:46:53 -04:00
parent 7dd2612268
commit 995bf8c58f
2 changed files with 15 additions and 3 deletions

View File

@ -179,7 +179,7 @@ angular.module('SurveyQuestionFormDefinition', [])
question_cancel : {
label: 'Cancel',
'class' : 'btn btn-default',
ngClick: 'cancelQuestion()'
ngClick: 'cancelQuestion($event)'
},
submit_question: {
ngClick: 'submitQuestion()',

View File

@ -529,8 +529,20 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper',
scope: scope
});
};
scope.cancelQuestion = function(){
alert('success');
scope.cancelQuestion = function(event){
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){