|
117 | 117 | , generateHtmlTemplate = function generateHtmlTemplate(prevButton, nextButton) { |
118 | 118 |
|
119 | 119 | var toReturn = [ |
120 | | - '<div class="_720kb-datepicker-calendar {{datepickerClass}} {{datepickerID}}" ng-class="{\'_720kb-datepicker-forced-to-open\': checkAndToggleVisibility()}" ng-blur="hideCalendar()">', |
| 120 | + '<div class="_720kb-datepicker-calendar {{datepickerClass}} {{datepickerID}}" ng-class="{\'_720kb-datepicker-forced-to-open\': checkVisibility()}" ng-blur="hideCalendar()">', |
121 | 121 | '</div>' |
122 | 122 | ] |
123 | 123 | , monthAndYearHeader = generateMonthAndYearHeader(prevButton, nextButton) |
|
267 | 267 | classHelper.add(theCalendar, '_720kb-datepicker-open'); |
268 | 268 | } |
269 | 269 | } |
270 | | - , checkAndToggleVisibility = function checkAndToggleVisibility() { |
| 270 | + , checkToggle = function checkToggle() { |
271 | 271 |
|
272 | | - if ($scope.datepickerShow && |
273 | | - $scope.$eval($scope.datepickerShow)) { |
274 | | - |
275 | | - showCalendar(); |
276 | | - } else if ($scope.datepickerShow && |
277 | | - !$scope.$eval($scope.datepickerShow)) { |
| 272 | + return $scope.$eval($scope.datepickerToggle); |
| 273 | + } |
| 274 | + , checkVisibility = function checkVisibility() { |
278 | 275 |
|
279 | | - $scope.hideCalendar(); |
280 | | - } |
| 276 | + return $scope.$eval($scope.datepickerShow); |
281 | 277 | } |
282 | 278 | , setDaysInMonth = function setDaysInMonth(month, year) { |
283 | 279 |
|
|
358 | 354 |
|
359 | 355 | setInputValue(); |
360 | 356 | } |
361 | | - checkAndToggleVisibility(); |
362 | 357 | } |
363 | 358 | }); |
364 | 359 |
|
|
735 | 730 | theCalendar = element[0].querySelector('._720kb-datepicker-calendar'); |
736 | 731 | } |
737 | 732 | //if datepicker-toggle="" is not present or true by default |
738 | | - if (!$scope.datepickerToggle || |
739 | | - $scope.datepickerToggle !== 'false' || |
740 | | - !$scope.$eval($scope.datepickerToggle)) { |
| 733 | + if (checkToggle()) { |
741 | 734 |
|
742 | 735 | thisInput.on('focus click focusin', function onFocusAndClick() { |
743 | 736 |
|
|
751 | 744 |
|
752 | 745 | showCalendar(); |
753 | 746 | } |
754 | | - checkAndToggleVisibility(); |
755 | 747 | }); |
756 | 748 | } |
757 | 749 |
|
|
794 | 786 |
|
795 | 787 | //datepicker boot start |
796 | 788 | $scope.paginateYears($scope.year); |
| 789 | + |
797 | 790 | setDaysInMonth($scope.monthNumber, $scope.year); |
798 | | - $scope.checkAndToggleVisibility = checkAndToggleVisibility; |
| 791 | + $scope.checkVisibility = checkVisibility; |
799 | 792 |
|
800 | 793 | $scope.$on('$destroy', function unregisterListener() { |
801 | 794 |
|
|
0 commit comments