Next/Create button loses state in create network

Ensure that if the Next button should be Create button due to a tab in workflow
being removed, it stays as the Create button even after going back through the
workflow.

Change-Id: I5bf3ff79726db9464b7c1179f0a646901d3152f8
Closes-bug: 1384305
This commit is contained in:
Bradley Jones 2014-10-30 14:49:08 +00:00
parent 4fdc42cf63
commit a792e5b319
1 changed files with 19 additions and 2 deletions

View File

@ -268,16 +268,19 @@ horizon.addInitFunction(horizon.forms.init = function () {
// If the checkbox has hide-tab attribute then hide/show the tab
if (hide_tab) {
var $btnfinal = $('.button-final');
if(checked == hide_on) {
// If the checkbox is not checked then hide the tab
$('*[data-target="#'+ hide_tab +'"]').parent().hide();
$('.button-next').hide();
$('.button-final').show();
$btnfinal.show();
$btnfinal.data('show-on-tab', $fieldset.prop('id'));
} else if (!$('*[data-target="#'+ hide_tab +'"]').parent().is(':visible')) {
// If the checkbox is checked and the tab is currently hidden then show the tab again
$('*[data-target="#'+ hide_tab +'"]').parent().show();
$('.button-final').hide();
$btnfinal.hide();
$('.button-next').show();
$btnfinal.removeData('show-on-tab');
}
}
@ -310,6 +313,20 @@ horizon.addInitFunction(horizon.forms.init = function () {
$(modal).find('input.switchable').trigger('change');
});
$document.on('shown.bs.tab', function(evt) {
var $fieldset = $('fieldset.active');
var $btnfinal = $('.button-final');
if ($btnfinal.data('show-on-tab')) {
if ($fieldset.prop('id') == $btnfinal.data('show-on-tab')) {
$('.button-next').hide();
$btnfinal.show();
} else {
$btnfinal.hide();
$('.button-next').show();
}
}
});
// Handle field toggles for the Create Volume source type field
function update_volume_source_displayed_fields (field) {
var $this = $(field),