Skip to content

Commit ea8a779

Browse files
Merge pull request #486 from jeff-phillips-18/wizard_v3
(3.x) Fixes for Wizard Issues
2 parents 135a45a + 32696ea commit ea8a779

File tree

5 files changed

+52
-15
lines changed

5 files changed

+52
-15
lines changed

src/wizard/wizard-directive.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,7 @@ angular.module('patternfly.wizard').directive('pfWizard', function ($window) {
399399
$scope.steps = [];
400400
$scope.context = {};
401401
this.context = $scope.context;
402-
$scope.hideHeader = $scope.hideHeader === 'true';
403402
this.hideSidebar = $scope.hideSidebar === 'true';
404-
$scope.hideBaackButton = $scope.hideBackButton === 'true';
405403

406404
// If a step class is given use it for all steps
407405
if (angular.isDefined($scope.stepClass)) {
@@ -702,6 +700,16 @@ angular.module('patternfly.wizard').directive('pfWizard', function ($window) {
702700
$scope.wizard = this;
703701
},
704702
link: function ($scope) {
703+
$scope.$watch('hideBackButton', function () {
704+
$scope.hideBackButton = $scope.hideBackButton === 'true' || $scope.hideBackButton === true;
705+
});
706+
$scope.$watch('hideHeader', function () {
707+
$scope.hideHeader = $scope.hideHeader === 'true' || $scope.hideHeader === true;
708+
});
709+
$scope.$watch('hideSidebar', function () {
710+
$scope.hideSidebar = $scope.hideSidebar === 'true' || $scope.hideSidebar === true;
711+
});
712+
705713
$scope.$watch('wizardReady', function () {
706714
if ($scope.wizardReady) {
707715
$scope.goTo($scope.getEnabledSteps()[0]);

src/wizard/wizard.html

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,30 @@ <h3 class="blank-slate-pf-main-action">{{loadingWizardTitle}}</h3>
2929
<div class="wizard-pf-position-override" ng-transclude ></div>
3030
</div>
3131
<div class="modal-footer wizard-pf-footer wizard-pf-position-override" ng-class="{'wizard-pf-footer-inline': embedInPage}">
32-
<button pf-wiz-cancel class="btn btn-default btn-cancel wizard-pf-cancel" ng-disabled="wizardDone" ng-click="onCancel()" ng-if="!embedInPage">{{cancelTitle}}</button>
32+
<button pf-wiz-cancel
33+
class="btn btn-default btn-cancel wizard-pf-cancel"
34+
ng-class="{'wizard-pf-cancel-no-back': hideBackButton}"
35+
ng-disabled="wizardDone"
36+
ng-click="onCancel()"
37+
ng-if="!embedInPage">{{cancelTitle}}</button>
3338
<div ng-if="!hideBackButton" class="tooltip-wrapper" uib-tooltip="{{prevTooltip}}" tooltip-placement="left">
34-
<button id="backButton" pf-wiz-previous class="btn btn-default" ng-disabled="!wizardReady || wizardDone || !prevEnabled || firstStep"
35-
callback="backCallback">
36-
<span class="i fa fa-angular-left"></span>
37-
{{backTitle}}
38-
</button>
39+
<button pf-wiz-previous
40+
id="backButton"
41+
class="btn btn-default"
42+
ng-disabled="!wizardReady || wizardDone || !prevEnabled || firstStep"
43+
callback="backCallback">{{backTitle}}</button>
3944
</div>
4045
<div class="tooltip-wrapper" uib-tooltip="{{nextTooltip}}" tooltip-placement="left">
41-
<button id="nextButton" pf-wiz-next class="btn btn-primary wizard-pf-next" ng-disabled="!wizardReady || !nextEnabled"
42-
callback="nextCallback">
43-
{{nextTitle}}
44-
<span class="i fa fa-angular-right"></span>
45-
</button>
46+
<button pf-wiz-next
47+
id="nextButton"
48+
class="btn btn-primary wizard-pf-next"
49+
ng-disabled="!wizardReady || !nextEnabled"
50+
callback="nextCallback">{{nextTitle}}</button>
4651
</div>
47-
<button pf-wiz-cancel class="btn btn-default btn-cancel wizard-pf-cancel wizard-pf-cancel-inline" ng-disabled="wizardDone" ng-click="onCancel()" ng-if="embedInPage">{{cancelTitle}}</button>
52+
<button pf-wiz-cancel
53+
class="btn btn-default btn-cancel wizard-pf-cancel wizard-pf-cancel-inline"
54+
ng-disabled="wizardDone"
55+
ng-click="onCancel()"
56+
ng-if="embedInPage">{{cancelTitle}}</button>
4857
</div>
4958
</div>

styles/angular-patternfly.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,3 +480,7 @@ accordion > .panel-group .panel-open .panel-title > a:before {
480480
border-color: #bbb;
481481
color: #bbb;
482482
}
483+
484+
.wizard-pf-footer .btn-cancel.wizard-pf-cancel-no-back {
485+
margin-right: 0;
486+
}

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
@@ -263,12 +263,28 @@ describe('Directive: pfWizard', function () {
263263
expect(sidebarPanel.length).toBe(3);
264264
});
265265

266+
it('should show the back button when not specified', function () {
267+
setupWizard('test/wizard/wizard-container.html');
268+
269+
var backButton = element.find('.wizard-pf-footer #backButton');
270+
expect(backButton.length).toBe(1);
271+
});
272+
266273
it('should hide the back button when specified', function () {
274+
$scope.hideBackButton = true;
267275
setupWizard('test/wizard/wizard-container-hide-back.html');
268276
$timeout.flush();
269277
$timeout.flush();
270278

271279
var backButton = element.find('.wizard-pf-footer #backButton');
272280
expect(backButton.length).toBe(0);
273281
});
282+
283+
it('should not hide the back button when specified', function () {
284+
$scope.hideBackButton = false;
285+
setupWizard('test/wizard/wizard-container-hide-back.html');
286+
287+
var backButton = element.find('.wizard-pf-footer #backButton');
288+
expect(backButton.length).toBe(1);
289+
});
274290
});

0 commit comments

Comments
 (0)