|
24 | 24 | * @param {string=} cancelTitle The text to display on the cancel button |
25 | 25 | * @param {string=} backTitle The text to display on the back button |
26 | 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 |
| 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 |
31 | 31 | * @param {boolean} wizardReady Value that is set when the wizard is ready |
32 | 32 | * @param {boolean=} wizardDone Value that is set when the wizard is done |
33 | 33 | * @param {string} loadingWizardTitle The text displayed when the wizard is loading |
34 | 34 | * @param {string=} loadingSecondaryInformation Secondary descriptive information to display when the wizard is loading |
35 | | - * @param {number=} wizardHeight The height the wizard should be set to. If this is not set, the wizard height is adjusted with the window resize event. |
| 35 | + * @param {string=} contentHeight The height the wizard content should be set to. This defaults to 300px if the property is not supplied. |
36 | 36 | * |
37 | 37 | * @example |
38 | 38 | <example module="patternfly.wizard" deps="patternfly.form"> |
|
50 | 50 | next-callback="nextCallback" |
51 | 51 | back-callback="backCallback" |
52 | 52 | wizard-done="deployComplete || deployInProgress" |
| 53 | + content-height="'600px'" |
53 | 54 | loading-secondary-information="secondaryLoadInformation"> |
54 | 55 | <div pf-wizard-step step-title="First Step" substeps="true" step-id="details" step-priority="0" show-review="true" show-review-details="true"> |
55 | 56 | <div ng-include="'detail-page.html'"> |
|
67 | 68 | </div> |
68 | 69 | <div pf-wizard-step step-title="Second Step" substeps="false" step-id="configuration" step-priority="1" show-review="true" review-template="review-second-template.html" > |
69 | 70 | <form class="form-horizontal"> |
| 71 | + <h3>Wizards should make use of substeps consistently throughout (either using them or not using them). This is an example only.</h3> |
70 | 72 | <div pf-form-group pf-label="Lorem"> |
71 | 73 | <input id="new-lorem" name="lorem" ng-model="data.lorem" type="text"/> |
72 | 74 | </div> |
@@ -314,7 +316,7 @@ angular.module('patternfly.wizard').directive('pfWizard', function ($window) { |
314 | 316 | wizardDone: '=?', |
315 | 317 | loadingWizardTitle: '=?', |
316 | 318 | loadingSecondaryInformation: '=?', |
317 | | - wizardHeight: '=?' |
| 319 | + contentHeight: '=?' |
318 | 320 | }, |
319 | 321 | templateUrl: 'wizard/wizard.html', |
320 | 322 | controller: function ($scope, $timeout) { |
@@ -389,6 +391,17 @@ angular.module('patternfly.wizard').directive('pfWizard', function ($window) { |
389 | 391 | $scope.wizardReady = true; |
390 | 392 | } |
391 | 393 |
|
| 394 | + if (angular.isUndefined($scope.contentHeight)) { |
| 395 | + $scope.contentHeight = '300px'; |
| 396 | + } |
| 397 | + this.contentHeight = $scope.contentHeight; |
| 398 | + $scope.contentStyle = { |
| 399 | + 'height': $scope.contentHeight, |
| 400 | + 'max-height': $scope.contentHeight, |
| 401 | + 'overflow-y': 'auto' |
| 402 | + }; |
| 403 | + this.contentStyle = $scope.contentStyle; |
| 404 | + |
392 | 405 | $scope.nextEnabled = false; |
393 | 406 | $scope.prevEnabled = false; |
394 | 407 |
|
@@ -659,36 +672,12 @@ angular.module('patternfly.wizard').directive('pfWizard', function ($window) { |
659 | 672 | this.goTo(0); |
660 | 673 | }; |
661 | 674 | }, |
662 | | - link: function ($scope, $element, $attrs) { |
663 | | - var INDICATOR_HEIGHT = 131, |
664 | | - FOOTER_HEIGHT = 58, |
665 | | - HEADER_HEIGHT = 41, |
666 | | - WINDOW_SPACING = 70; |
667 | | - |
668 | | - var minimumHeight = !$scope.hideIndicators ? INDICATOR_HEIGHT + HEADER_HEIGHT + FOOTER_HEIGHT : HEADER_HEIGHT + FOOTER_HEIGHT; |
669 | | - |
670 | | - // user has specified the height |
671 | | - if ($scope.wizardHeight) { |
672 | | - $element.height($scope.wizardHeight); |
673 | | - } else { |
674 | | - if ($window.innerHeight - WINDOW_SPACING > minimumHeight) { |
675 | | - $element.height($window.innerHeight - WINDOW_SPACING); |
676 | | - } else { |
677 | | - $element.height(minimumHeight); |
678 | | - } |
679 | | - } |
680 | | - |
| 675 | + link: function ($scope) { |
681 | 676 | $scope.$watch('wizardReady', function () { |
682 | 677 | if ($scope.wizardReady) { |
683 | 678 | $scope.goTo($scope.getEnabledSteps()[0]); |
684 | 679 | } |
685 | 680 | }); |
686 | | - |
687 | | - angular.element($window).bind('resize', function () { |
688 | | - if ($window.innerHeight - WINDOW_SPACING > minimumHeight && !$scope.wizardHeight) { |
689 | | - $element.height($window.innerHeight - WINDOW_SPACING); |
690 | | - } |
691 | | - }); |
692 | 681 | } |
693 | 682 | }; |
694 | 683 | }); |
0 commit comments