Added onExit functions to routes where the job launch and survey maker modals may be displayed. This will handle cleaning up the modal properly so that it can be re-opened

This commit is contained in:
Michael Abashian 2016-07-13 13:31:10 -04:00
parent 9965ec01be
commit 8c234dc915
8 changed files with 99 additions and 1 deletions

View File

@ -255,6 +255,16 @@ var tower = angular.module('Tower', [
});
});
}]
},
onExit: function(){
// close the job launch modal
// using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X"
// Destroy the dialog
if($("#job-launch-modal").hasClass('ui-dialog-content')) {
$('#job-launch-modal').dialog('destroy');
}
// Remove the directive from the page (if it's there)
$('#content-container').find('submit-job').remove();
}
}).
@ -264,6 +274,16 @@ var tower = angular.module('Tower', [
controller: JobsListController,
ncyBreadcrumb: {
label: "JOBS"
},
onExit: function(){
// close the job launch modal
// using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X"
// Destroy the dialog
if($("#job-launch-modal").hasClass('ui-dialog-content')) {
$('#job-launch-modal').dialog('destroy');
}
// Remove the directive from the page (if it's there)
$('#content-container').find('submit-job').remove();
}
}).

View File

@ -17,5 +17,15 @@ export default {
},
ncyBreadcrumb: {
skip: true // Never display this state in breadcrumb.
},
onExit: function(){
// close the job launch modal
// using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X"
// Destroy the dialog
if($("#job-launch-modal").hasClass('ui-dialog-content')) {
$('#job-launch-modal').dialog('destroy');
}
// Remove the directive from the page (if it's there)
$('#content-container').find('submit-job').remove();
}
};

View File

@ -30,5 +30,15 @@ export default {
}]
},
templateUrl: templateUrl('job-detail/job-detail'),
controller: 'JobDetailController'
controller: 'JobDetailController',
onExit: function(){
// close the job launch modal
// using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X"
// Destroy the dialog
if($("#job-launch-modal").hasClass('ui-dialog-content')) {
$('#job-launch-modal').dialog('destroy');
}
// Remove the directive from the page (if it's there)
$('#content-container').find('submit-job').remove();
}
};

View File

@ -14,5 +14,19 @@ export default {
ncyBreadcrumb: {
parent: "jobTemplates",
label: "CREATE JOB TEMPLATE"
},
onExit: function(){
// close the job launch modal
// using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X"
// Destroy the dialog
if($("#job-launch-modal").hasClass('ui-dialog-content')) {
$('#job-launch-modal').dialog('destroy');
}
// Remove the directive from the page (if it's there)
$('#content-container').find('submit-job').remove();
if($("#survey-modal-dialog").hasClass('ui-dialog-content')) {
$('#survey-modal-dialog').dialog('destroy');
}
}
};

View File

@ -17,5 +17,19 @@ export default {
ncyBreadcrumb: {
parent: 'jobTemplates',
label: "{{name}}"
},
onExit: function(){
// close the job launch modal
// using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X"
// Destroy the dialog
if($("#job-launch-modal").hasClass('ui-dialog-content')) {
$('#job-launch-modal').dialog('destroy');
}
// Remove the directive from the page (if it's there)
$('#content-container').find('submit-job').remove();
if($("#survey-modal-dialog").hasClass('ui-dialog-content')) {
$('#survey-modal-dialog').dialog('destroy');
}
}
};

View File

@ -17,5 +17,15 @@ export default {
},
ncyBreadcrumb: {
label: "JOB TEMPLATES"
},
onExit: function(){
// close the job launch modal
// using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X"
// Destroy the dialog
if($("#job-launch-modal").hasClass('ui-dialog-content')) {
$('#job-launch-modal').dialog('destroy');
}
// Remove the directive from the page (if it's there)
$('#content-container').find('submit-job').remove();
}
};

View File

@ -121,6 +121,16 @@ export default [
features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get();
}]
},
onExit: function(){
// close the job launch modal
// using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X"
// Destroy the dialog
if($("#job-launch-modal").hasClass('ui-dialog-content')) {
$('#job-launch-modal').dialog('destroy');
}
// Remove the directive from the page (if it's there)
$('#content-container').find('submit-job').remove();
}
},
{

View File

@ -24,5 +24,15 @@ export default {
templateUrl: templateUrl('portal-mode/portal-mode-jobs'),
controller: PortalModeJobsController
}
},
onExit: function(){
// close the job launch modal
// using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X"
// Destroy the dialog
if($("#job-launch-modal").hasClass('ui-dialog-content')) {
$('#job-launch-modal').dialog('destroy');
}
// Remove the directive from the page (if it's there)
$('#content-container').find('submit-job').remove();
}
};