Skip to content

Commit d8c6849

Browse files
jeff-phillips-18cdcabrera
authored andcommitted
feat(wizard): Support for wizard at mobile resolutions (#615)
Show only the selected step and substep titles at mobile resolution Add the activeStepTitleOnly option to show only the active step title in the steps indicator (header) when set to true.
1 parent 2d6c6ac commit d8c6849

File tree

7 files changed

+32
-15
lines changed

7 files changed

+32
-15
lines changed

bower.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
"angular-animate": "1.5.*",
4242
"angular-bootstrap": "2.2.x",
4343
"angular-dragdrop": "1.0.13",
44-
"angularjs-datatables": "^0.5.8",
44+
"angularjs-datatables": "^0.5.9",
4545
"angular-drag-and-drop-lists": "2.0.0",
4646
"angular-sanitize": "1.5.*",
4747
"datatables.net": "^1.10.12",
4848
"datatables.net-select": "~1.2.0",
4949
"lodash": "4.x",
50-
"patternfly": ">=3.26.0"
50+
"patternfly": ">=3.27.2"
5151
},
5252
"devDependencies": {
5353
"angular-mocks": "1.5.*",

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"angular-ui-bootstrap": "2.3.x",
1818
"angular-svg-base-fix": "2.0.0",
1919
"lodash": "4.x",
20-
"patternfly": ">=3.26.0"
20+
"patternfly": ">=3.27.2"
2121
},
2222
"devDependencies": {
2323
"angular-dragdrop": "1.0.13",
@@ -58,7 +58,7 @@
5858
"semantic-release": "^6.3.6"
5959
},
6060
"optionalDependencies": {
61-
"angularjs-datatables": "^0.5.8",
61+
"angularjs-datatables": "^0.5.9",
6262
"angular-drag-and-drop-lists": "2.0.0",
6363
"bootstrap-select": "~1.10.0",
6464
"c3": "~0.4.11",

src/wizard/wizard-step.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<section ng-show="$ctrl.selected" ng-class="{current: $ctrl.selected, done: $ctrl.completed}">
1+
<section ng-show="$ctrl.selected" class="wizard-pf-row" ng-class="{current: $ctrl.selected, done: $ctrl.completed}" style="height: inherit;">
22
<div ng-if="!$ctrl.wizard.hideSidebar" class="wizard-pf-sidebar" ng-style="$ctrl.contentStyle" ng-class="$ctrl.wizard.sidebarClass" ng-if="$ctrl.substeps === true">
33
<ul class="list-group">
44
<li class="list-group-item" ng-class="{active: step.selected}" ng-repeat="step in $ctrl.getEnabledSteps()">

src/wizard/wizard.component.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*
2222
* @param {string} title The wizard title displayed in the header
2323
* @param {boolean=} hideIndicators Hides the step indicators in the header of the wizard
24+
* @param {boolean=} activeStepTitleOnly Shows the title only for the active step in the step indicators, optional, default is false.
2425
* @param {boolean=} hideSidebar Hides page navigation sidebar on the wizard pages
2526
* @param {boolean=} hideHeader Optional value to hide the title bar. Default is false.
2627
* @param {boolean=} hideBackButton Optional value to hide the back button, useful in 2 step wizards. Default is false.
@@ -68,10 +69,10 @@
6869
</div>
6970
<pf-wizard-substep step-title="Details - Extra" next-enabled="true" step-id="details-extra" step-priority="1" show-review="true" show-review-details="true" review-template="review-second-template.html">
7071
<form class="form-horizontal">
71-
<pf-form-group pf-label="Lorem" required>
72+
<pf-form-group pf-label="Lorem" pf-label-class="col-sm-3 col-md-2" pf-input-class="col-sm-9 col-md-10" required>
7273
<input id="new-lorem" name="lorem" ng-model="data.lorem" type="text" required/>
7374
</pf-form-group>
74-
<pf-form-group pf-label="Ipsum">
75+
<pf-form-group pf-label="Ipsum" pf-label-class="col-sm-3 col-md-2" pf-input-class="col-sm-9 col-md-10" >
7576
<input id="new-ipsum" name="ipsum" ng-model="data.ipsum" type="text" />
7677
</pf-form-group>
7778
</form>
@@ -80,10 +81,10 @@
8081
<pf-wizard-step step-title="Second Step" substeps="false" step-id="configuration" step-priority="1" show-review="true" review-template="review-second-template.html" >
8182
<form class="form-horizontal">
8283
<h3>Wizards should make use of substeps consistently throughout (either using them or not using them). This is an example only.</h3>
83-
<pf-form-group pf-label="Lorem">
84+
<pf-form-group pf-label="Lorem" pf-label-class="col-sm-3 col-md-2" pf-input-class="col-sm-9 col-md-10" >
8485
<input id="new-lorem" name="lorem" ng-model="data.lorem" type="text"/>
8586
</pf-form-group>
86-
<pf-form-group pf-label="Ipsum">
87+
<pf-form-group pf-label="Ipsum" pf-label-class="col-sm-3 col-md-2" pf-input-class="col-sm-9 col-md-10" >
8788
<input id="new-ipsum" name="ipsum" ng-model="data.ipsum" type="text" />
8889
</pf-form-group>
8990
</form>
@@ -98,10 +99,10 @@
9899
<div ng-controller="DetailsGeneralController">
99100
<pf-wizard-substep step-title="General" next-enabled="detailsGeneralComplete" step-id="details-general" step-priority="0" on-show="onShow" review-template="{{reviewTemplate}}" show-review-details="true">
100101
<form class="form-horizontal">
101-
<pf-form-group pf-label="Name" required>
102+
<pf-form-group pf-label="Name" pf-label-class="col-sm-3 col-md-2" pf-input-class="col-sm-9 col-md-10" required>
102103
<input id="new-name" name="name" ng-model="data.name" type="text" ng-change="updateName()" required/>
103104
</pf-form-group>
104-
<pf-form-group pf-label="Description">
105+
<pf-form-group pf-label="Description" pf-label-class="col-sm-3 col-md-2" pf-input-class="col-sm-9 col-md-10" >
105106
<input id="new-description" name="description" ng-model="data.description" type="text" />
106107
</pf-form-group>
107108
</form>
@@ -312,6 +313,7 @@ angular.module('patternfly.wizard').component('pfWizard', {
312313
bindings: {
313314
title: '@',
314315
hideIndicators: '=?',
316+
activeStepTitleOnly: '<?',
315317
hideSidebar: '@',
316318
hideHeader: '@',
317319
hideBackButton: '@',
@@ -377,6 +379,7 @@ angular.module('patternfly.wizard').component('pfWizard', {
377379
ctrl.hideHeader = ctrl.hideHeader === 'true';
378380
ctrl.hideSidebar = ctrl.hideSidebar === 'true';
379381
ctrl.hideBackButton = ctrl.hideBackButton === 'true';
382+
ctrl.activeStepTitleOnly = ctrl.activeStepTitleOnly === true;
380383

381384
// If a step class is given use it for all steps
382385
if (angular.isDefined(ctrl.stepClass)) {
@@ -386,7 +389,7 @@ angular.module('patternfly.wizard').component('pfWizard', {
386389
ctrl.sidebarClass = ctrl.stepClass;
387390
}
388391
} else {
389-
// No step claass give, setup the content style to allow scrolling and a fixed height
392+
// No step class give, setup the content style to allow scrolling and a fixed height
390393
if (angular.isUndefined(ctrl.contentHeight)) {
391394
ctrl.contentHeight = '300px';
392395
}
@@ -595,7 +598,7 @@ angular.module('patternfly.wizard').component('pfWizard', {
595598
// Check if callback is a function
596599
if (angular.isFunction(callback)) {
597600
if (callback(ctrl.selectedStep)) {
598-
if (index <= enabledSteps.length - 1) {
601+
if (index < enabledSteps.length - 1) {
599602
// Go to the next step
600603
if (enabledSteps[index + 1].substeps) {
601604
enabledSteps[index + 1].resetNav();

src/wizard/wizard.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<li class="wizard-pf-step" ng-class="{active: step.selected}" ng-repeat="step in $ctrl.getEnabledSteps()" data-tabgroup="{{$index }}">
1313
<a ng-click="$ctrl.stepClick(step)" ng-class="{'disabled': !$ctrl.allowStepIndicatorClick(step)}">
1414
<span class="wizard-pf-step-number">{{$index + 1}}</span>
15-
<span class="wizard-pf-step-title">{{step.title}}</span>
15+
<span ng-if="!$ctrl.activeStepTitleOnly || step.selected" class="wizard-pf-step-title">{{step.title}}</span>
16+
<span class="wizard-pf-step-title-substep" ng-repeat="substep in step.steps track by $index" ng-class="{'active': substep.selected}">{{substep.title}}</span>
1617
</a>
1718
</li>
1819
</ul>

test/wizard/wizard-container.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<pf-wizard title="Wizard Title"
22
wizard-ready="deployReady"
3+
active-step-title-only="activeStepTitleOnly"
34
on-finish="finishedWizard()"
45
on-cancel="cancelDeploymentWizard()"
56
next-title="nextButtonTitle"
@@ -10,4 +11,4 @@
1011
wizard-done="deployComplete || deployInProgress"
1112
loading-secondary-information="secondaryLoadInformation">
1213
<div ng-include="'test/wizard/wizard-test-steps.html'"></div>
13-
</div>
14+
</pf-wizard>

test/wizard/wizard.spec.js

+12
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,16 @@ describe('Component: pfWizard', function () {
302302
var backButton = element.find('.wizard-pf-footer #backButton');
303303
expect(backButton.length).toBe(1);
304304
});
305+
306+
it('should not show inactive step titles when activeStepTitleOnly is specified', function () {
307+
setupWizard('test/wizard/wizard-container.html');
308+
var stepTitles = element.find('.wizard-pf-step-title');
309+
expect(stepTitles.length).toBe(3);
310+
311+
$scope.activeStepTitleOnly = true;
312+
$scope.$digest();
313+
314+
stepTitles = element.find('.wizard-pf-step-title');
315+
expect(stepTitles.length).toBe(1);
316+
});
305317
});

0 commit comments

Comments
 (0)