Skip to content

Commit eb09a85

Browse files
Merge pull request #487 from jeff-phillips-18/wizard
Fixes for Wizard Issues
2 parents b828a11 + ac13984 commit eb09a85

File tree

5 files changed

+51
-14
lines changed

5 files changed

+51
-14
lines changed

src/wizard/wizard.component.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ angular.module('patternfly.wizard').component('pfWizard', {
376376
ctrl.context = {};
377377
ctrl.hideHeader = ctrl.hideHeader === 'true';
378378
ctrl.hideSidebar = ctrl.hideSidebar === 'true';
379-
ctrl.hideBaackButton = ctrl.hideBackButton === 'true';
379+
ctrl.hideBackButton = ctrl.hideBackButton === 'true';
380380

381381
// If a step class is given use it for all steps
382382
if (angular.isDefined(ctrl.stepClass)) {
@@ -415,6 +415,18 @@ angular.module('patternfly.wizard').component('pfWizard', {
415415
ctrl.$onChanges = function (changesObj) {
416416
var step;
417417

418+
if (changesObj.hideHeader) {
419+
ctrl.hideHeader = ctrl.hideHeader === 'true';
420+
}
421+
422+
if (changesObj.hideSidebar) {
423+
ctrl.hideSidebar = ctrl.hideSidebar === 'true';
424+
}
425+
426+
if (changesObj.hideBackButton) {
427+
ctrl.hideBackButton = ctrl.hideBackButton === 'true';
428+
}
429+
418430
if (changesObj.wizardReady && changesObj.wizardReady.currentValue) {
419431
ctrl.goTo(ctrl.getEnabledSteps()[0]);
420432
}

src/wizard/wizard.html

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,25 @@ <h3 class="blank-slate-pf-main-action">{{$ctrl.loadingWizardTitle}}</h3>
2828
<div class="wizard-pf-position-override" ng-transclude ></div>
2929
</div>
3030
<div class="modal-footer wizard-pf-footer wizard-pf-position-override" ng-class="{'wizard-pf-footer-inline': $ctrl.embedInPage}">
31-
<pf-wiz-cancel class="btn btn-default btn-cancel wizard-pf-cancel" ng-disabled="$ctrl.wizardDone" ng-click="$ctrl.onCancel()" ng-if="!$ctrl.embedInPage">{{$ctrl.cancelTitle}}</pf-wiz-cancel>
31+
<pf-wiz-cancel class="btn btn-default btn-cancel wizard-pf-cancel"
32+
ng-class="{'wizard-pf-cancel-no-back': $ctrl.hideBackButton}"
33+
ng-disabled="$ctrl.wizardDone" ng-click="$ctrl.onCancel()"
34+
ng-if="!$ctrl.embedInPage">{{$ctrl.cancelTitle}}</pf-wiz-cancel>
3235
<div ng-if="!$ctrl.hideBackButton" class="tooltip-wrapper" uib-tooltip="{{$ctrl.prevTooltip}}" tooltip-placement="left">
33-
<pf-wiz-previous id="backButton" class="btn btn-default" ng-disabled="!$ctrl.wizardReady || $ctrl.wizardDone || !$ctrl.selectedStep.prevEnabled || $ctrl.firstStep"
34-
callback="$ctrl.backCallback">
35-
<span class="i fa fa-angular-left"></span>
36-
{{$ctrl.backTitle}}
37-
</pf-wiz-previous>
36+
<pf-wiz-previous id="backButton"
37+
class="btn btn-default"
38+
ng-disabled="!$ctrl.wizardReady || $ctrl.wizardDone || !$ctrl.selectedStep.prevEnabled || $ctrl.firstStep"
39+
callback="$ctrl.backCallback">{{$ctrl.backTitle}}</pf-wiz-previous>
3840
</div>
3941
<div class="tooltip-wrapper" uib-tooltip="{{$ctrl.nextTooltip}}" tooltip-placement="left">
40-
<pf-wiz-next id="nextButton" class="btn btn-primary wizard-pf-next" ng-disabled="!$ctrl.wizardReady || !$ctrl.selectedStep.nextEnabled"
41-
callback="$ctrl.nextCallback">
42-
{{$ctrl.nextTitle}}
43-
<span class="i fa fa-angular-right"></span>
44-
</pf-wiz-next>
42+
<pf-wiz-next id="nextButton"
43+
class="btn btn-primary wizard-pf-next"
44+
ng-disabled="!$ctrl.wizardReady || !$ctrl.selectedStep.nextEnabled"
45+
callback="$ctrl.nextCallback">{{$ctrl.nextTitle}}</pf-wiz-next>
4546
</div>
46-
<pf-wiz-cancel class="btn btn-default btn-cancel wizard-pf-cancel wizard-pf-cancel-inline" ng-disabled="$ctrl.wizardDone" ng-click="$ctrl.onCancel()" ng-if="$ctrl.embedInPage">{{$ctrl.cancelTitle}}</pf-wiz-cancel>
47+
<pf-wiz-cancel class="btn btn-default btn-cancel wizard-pf-cancel wizard-pf-cancel-inline"
48+
ng-disabled="$ctrl.wizardDone"
49+
ng-click="$ctrl.onCancel()"
50+
ng-if="$ctrl.embedInPage">{{$ctrl.cancelTitle}}</pf-wiz-cancel>
4751
</div>
4852
</div>

src/wizard/wizard.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
pointer-events: none;
1111
}
1212
}
13+
.btn-cancel {
14+
&.wizard-pf-cancel-no-back {
15+
margin-right: 0;
16+
}
17+
}
1318
}
1419
.wizard-pf-singlestep {
1520
margin-left: 0;

test/wizard/wizard-container-hide-back.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
next-callback="nextCallback"
88
back-callback="backCallback"
99
current-step="currentStep"
10-
hide-back-button="true"
10+
hide-back-button="{{hideBackButton}}"
1111
wizard-done="deployComplete || deployInProgress"
1212
loading-secondary-information="secondaryLoadInformation">
1313
<div ng-include="'test/wizard/wizard-test-steps.html'"></div>

test/wizard/wizard.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,26 @@ describe('Component: pfWizard', function () {
259259
expect(sidebarPanel.length).toBe(3);
260260
});
261261

262+
it('should show the back button when not specified', function () {
263+
setupWizard('test/wizard/wizard-container.html');
264+
265+
var backButton = element.find('.wizard-pf-footer #backButton');
266+
expect(backButton.length).toBe(1);
267+
});
268+
262269
it('should hide the back button when specified', function () {
270+
$scope.hideBackButton = true;
263271
setupWizard('test/wizard/wizard-container-hide-back.html');
264272

265273
var backButton = element.find('.wizard-pf-footer #backButton');
266274
expect(backButton.length).toBe(0);
267275
});
276+
277+
it('should not hide the back button when specified', function () {
278+
$scope.hideBackButton = false;
279+
setupWizard('test/wizard/wizard-container-hide-back.html');
280+
281+
var backButton = element.find('.wizard-pf-footer #backButton');
282+
expect(backButton.length).toBe(1);
283+
});
268284
});

0 commit comments

Comments
 (0)