Skip to content

Commit a594b8d

Browse files
committed
Modify bower.json to clean up reference, add better documentation to wizard directives (optional values, information about proper structure) and added minHeight property as well.
1 parent a790459 commit a594b8d

File tree

5 files changed

+57
-50
lines changed

5 files changed

+57
-50
lines changed

bower.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,9 @@
4242
"angular-sanitize": "1.3.0 - 1.5.*",
4343
"angular-bootstrap": "0.13.x",
4444
"lodash": "3.x",
45-
"patternfly": "a014002ebcfad2c6ff2fbeda52dfcd425e016f2a"
45+
"patternfly": "[email protected]:patternfly/patternfly.git#master-dist"
4646
},
4747
"devDependencies": {
4848
"angular-mocks": "1.3.0 - 1.5.*"
49-
},
50-
"resolutions": {
51-
"bootstrap-datepicker": "~1.6.4",
52-
"bootstrap-select": "~1.10.0",
53-
"bootstrap-touchspin": "~3.1.1",
54-
"datatables-colreorder": "~1.3.2",
55-
"font-awesome": "~4.6.3",
56-
"moment": "~2.14.1"
5749
}
5850
}

src/wizard/wizard-directive.js

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,36 @@
33
* @name patternfly.wizard.directive:pfWizard
44
*
55
* @description
6-
* Directive for rendering a Wizard modal.
6+
* Directive for rendering a Wizard modal. Each wizard dynamically creates the step navigation both in the header and the left-hand side based on nested steps.
7+
* Use the pf-wizardstep to define individual steps within a wizard and pf-wizardsubstep to define portions of pf-wizardsteps if so desired. For instance, Step one can have two substeps - 1A and 1B when it is logical to group those together.
8+
* <br /><br />
9+
* The basic structure should be:
10+
* <pre>
11+
* <div pf-wizard>
12+
* <div pf-wizardstep>
13+
* <div pf-wizardsubstep><!-- content here --></div>
14+
* <div pf-wizardsubstep><!-- content here --></div>
15+
* </div>
16+
* <div pf-wizardstep><!-- additional configuration can be added here with substeps if desired --></div>
17+
* <div pf-wizardstep><!-- review steps and final command here --></div>
18+
* </div>
19+
* </pre>
720
*
821
* @param {string} title The wizard title displayed in the header
9-
* @param {boolean} hideIndicators Hides the step indicators in the header of the wizard
10-
* @param {string} currentStep The current step can be changed externally - this is the title of the step to switch the wizard to
11-
* @param {string} cancelTitle The text to display on the cancel button
12-
* @param {string} backTitle The text to display on the back button
13-
* @param {string} nextTitle The text to display on the next button
14-
* @param {function (step) } backCallback Called to notify when the back button is clicked
15-
* @param {function (step) } nextCallback Called to notify when the next button is clicked
16-
* @param {function ()} onFinish Called to notify when when the wizard is complete. Returns a boolean value to indicate if the finish operation is complete
17-
* @param {function ()} onCancel Called when the wizard is canceled, returns a boolean value to indicate if cancel is successful
22+
* @param {boolean=} hideIndicators Hides the step indicators in the header of the wizard
23+
* @param {string=} currentStep The current step can be changed externally - this is the title of the step to switch the wizard to
24+
* @param {string=} cancelTitle The text to display on the cancel button
25+
* @param {string=} backTitle The text to display on the back button
26+
* @param {string=} nextTitle The text to display on the next button
27+
* @param {function (step)=} backCallback Called to notify when the back button is clicked
28+
* @param {function (step)=} nextCallback Called to notify when the next button is clicked
29+
* @param {function ()=} onFinish Called to notify when when the wizard is complete. Returns a boolean value to indicate if the finish operation is complete
30+
* @param {function ()=} onCancel Called when the wizard is canceled, returns a boolean value to indicate if cancel is successful
1831
* @param {boolean} wizardReady Value that is set when the wizard is ready
19-
* @param {boolean} wizardDone Value that is set when the wizard is done
32+
* @param {boolean=} wizardDone Value that is set when the wizard is done
2033
* @param {string} loadingWizardTitle The text displayed when the wizard is loading
21-
* @param {string} loadingSecondaryInformation Secondary descriptive information to display when the wizard is loading
34+
* @param {string=} loadingSecondaryInformation Secondary descriptive information to display when the wizard is loading
35+
* @param {number=} minHeight The minimum height the wizard should adjust to if the window height is decreased. The wizard height is adjusted with the window resize event and this sets the minimum.
2236
*
2337
* @example
2438
<example module="patternfly.wizard" deps="patternfly.form">
@@ -300,7 +314,8 @@ angular.module('patternfly.wizard').directive('pfWizard', function ($window) {
300314
wizardReady: '=?',
301315
wizardDone: '=?',
302316
loadingWizardTitle: '=?',
303-
loadingSecondaryInformation: '=?'
317+
loadingSecondaryInformation: '=?',
318+
minHeight: '=?'
304319
},
305320
templateUrl: 'wizard/wizard.html',
306321
controller: function ($scope, $timeout) {
@@ -654,10 +669,14 @@ angular.module('patternfly.wizard').directive('pfWizard', function ($window) {
654669
}
655670
});
656671

657-
if ($window.innerHeight > 400) {
672+
if (!$scope.minHeight) {
673+
$scope.minHeight = 400;
674+
}
675+
676+
if ($window.innerHeight > $scope.minHeight) {
658677
$element.height($window.innerHeight - 70);
659678
} else {
660-
$element.height(400);
679+
$element.height($scope.minHeight);
661680
}
662681
$scope.$on('$destroy', isOpenListener);
663682

@@ -668,7 +687,7 @@ angular.module('patternfly.wizard').directive('pfWizard', function ($window) {
668687
});
669688

670689
angular.element($window).bind('resize', function () {
671-
if ($window.innerHeight > 400) {
690+
if ($window.innerHeight > $scope.minHeight) {
672691
$element.height($window.innerHeight - 70);
673692
}
674693
});

src/wizard/wizard-step-directive.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
* @name patternfly.wizard.directive:pfWizardStep
44
*
55
* @description
6-
* Directive for rendering a Wizard step. Each step can stand alone or have substeps.
6+
* Directive for rendering a Wizard step. Each step can stand alone or have substeps. This directive can only be used as a child of pf-wizard.
77
*
88
* @param {string} stepTitle The step title displayed in the header and used for the review screen when displayed
99
* @param {string} stepId Sets the text identifier of the step
1010
* @param {number} stepPriority This sets the priority of this wizard step relative to other wizard steps. They should be numbered sequentially in the order they should be viewed.
1111
* @param {boolean} substeps Sets whether this step has substeps
12-
* @param {boolean} nextEnabled Sets whether the next button should be enabled when this step is first displayed
13-
* @param {boolean} prevEnabled Sets whether the back button should be enabled when this step is first displayed
14-
* @param {string} nextTooltip The text to display as a tooltip on the next button
15-
* @param {string} prevTooltip The text to display as a tooltip on the back button
16-
* @param {boolean} wzDisabled Disables the wizard when this page is shown
12+
* @param {boolean=} nextEnabled Sets whether the next button should be enabled when this step is first displayed
13+
* @param {boolean=} prevEnabled Sets whether the back button should be enabled when this step is first displayed
14+
* @param {string=} nextTooltip The text to display as a tooltip on the next button
15+
* @param {string=} prevTooltip The text to display as a tooltip on the back button
16+
* @param {boolean=} wzDisabled Disables the wizard when this page is shown
1717
* @param {boolean} okToNavAway Sets whether or not it's ok for the user to leave this page
1818
* @param {boolean} allowClickNav Sets whether the user can click on the numeric step indicators to navigate directly to this step
19-
* @param {string} description The step description (optional)
19+
* @param {string=} description The step description (optional)
2020
* @param {object} wizardData Data passed to the step that is shared by the entire wizard
21-
* @param {function()} onShow The function called when the wizard shows this step
22-
* @param {boolean} showReview Indicates whether review information should be displayed for this step when the review step is reached
23-
* @param {boolean} showReviewDetails Indicators whether the review information should be expanded by default when the review step is reached
24-
* @param {string} reviewTemplate The template that should be used for the review details screen
21+
* @param {function()=} onShow The function called when the wizard shows this step
22+
* @param {boolean=} showReview Indicates whether review information should be displayed for this step when the review step is reached
23+
* @param {boolean=} showReviewDetails Indicators whether the review information should be expanded by default when the review step is reached
24+
* @param {string=} reviewTemplate The template that should be used for the review details screen
2525
*/
2626
angular.module('patternfly.wizard').directive('pfWizardStep', function () {
2727
'use strict';

src/wizard/wizard-substep-directive.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
* @name patternfly.wizard.directive:pfWizardSubstep
33
*
44
* @description
5-
* Directive for rendering a Wizard substep. Each substep must be a child of a step in a wizard.
5+
* Directive for rendering a Wizard substep. Each substep must be a child of a pf-wizardstep in a pf-wizard directive.
66
*
77
* @param {string} stepTitle The step title displayed in the header and used for the review screen when displayed
88
* @param {string} stepId Sets the text identifier of the step
99
* @param {number} stepPriority This sets the priority of this wizard step relative to other wizard steps. They should be numbered sequentially in the order they should be viewed.
10-
* @param {boolean} nextEnabled Sets whether the next button should be enabled when this step is first displayed
11-
* @param {boolean} prevEnabled Sets whether the back button should be enabled when this step is first displayed
12-
* @param {boolean} wzDisabled Disables the wizard when this page is shown
10+
* @param {boolean=} nextEnabled Sets whether the next button should be enabled when this step is first displayed
11+
* @param {boolean=} prevEnabled Sets whether the back button should be enabled when this step is first displayed
12+
* @param {boolean=} wzDisabled Disables the wizard when this page is shown
1313
* @param {boolean} okToNavAway Sets whether or not it's ok for the user to leave this page
14-
* @param {boolean} allowClickNav Sets whether the user can click on the numeric step indicators to navigate directly to this step
15-
* @param {string} description The step description (optional)
14+
* @param {boolean=} allowClickNav Sets whether the user can click on the numeric step indicators to navigate directly to this step
15+
* @param {string=} description The step description
1616
* @param {object} wizardData Data passed to the step that is shared by the entire wizard
17-
* @param {function()} onShow The function called when the wizard shows this step
18-
* @param {boolean} showReviewDetails Indicators whether the review information should be expanded by default when the review step is reached
19-
* @param {string} reviewTemplate The template that should be used for the review details screen
17+
* @param {function()=} onShow The function called when the wizard shows this step
18+
* @param {boolean=} showReviewDetails Indicators whether the review information should be expanded by default when the review step is reached
19+
* @param {string=} reviewTemplate The template that should be used for the review details screen
2020
*/
2121
angular.module('patternfly.wizard').directive('pfWizardSubstep', function () {
2222
'use strict';

test/wizard/wizard.spec.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,10 @@ describe('Directive: pfWizard', function () {
105105

106106
it('should dispatch the cancel event on the close button click', function () {
107107
var closeButton = element.find('.close');
108-
$rootScope.$on('wizard.done', function (event, data) {
109-
expect(data).toBe('cancel');
110-
});
111108
spyOn($rootScope, '$emit');
112109
eventFire(closeButton[0], 'click');
113110
$scope.$digest();
114-
115-
expect($rootScope.$emit).toHaveBeenCalled();
111+
expect($rootScope.$emit).toHaveBeenCalledWith('wizard.done', 'cancel');
116112
});
117113

118114
it('should have three step indicators in the header', function () {

0 commit comments

Comments
 (0)