Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dab1833

Browse files
bekospkozlowski-opensource
authored andcommittedAug 4, 2013
feat(datepikcer): ngModelController plug & new datepikcerPopup
* `ngModelController` integration * `datepikcerPopup` directive ti use with inputs * invalid & disabled validation * add `min` / `max` into configuration Closes #612
1 parent a742690 commit dab1833

File tree

6 files changed

+959
-342
lines changed

6 files changed

+959
-342
lines changed
 

Diff for: ‎src/datepicker/datepicker.js

+351-135
Large diffs are not rendered by default.

Diff for: ‎src/datepicker/docs/demo.html

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
<div ng-controller="DatepickerDemoCtrl">
2-
<datepicker ng-model="dt" show-weeks="showWeeks" starting-day="1" date-disabled="disabled(date, mode)" min="minDate" max="'2015-06-22'"></datepicker>
32
<pre>Selected date is: <em>{{dt | date:'fullDate' }}</em></pre>
43

4+
<div class="well well-small pull-left" ng-model="dt">
5+
<datepicker min="minDate" show-weeks="showWeeks"></datepciker>
6+
</div>
7+
8+
<div class="form-horizontal">
9+
<input type="text" datepicker-popup="dd-MMMM-yyyy" ng-model="dt" open="opened" min="minDate" max="'2015-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" />
10+
<button class="btn" ng-click="open()"><i class="icon-calendar"></i></button>
11+
</div>
12+
13+
<hr />
514
<button class="btn btn-small btn-inverse" ng-click="today()">Today</button>
6-
<button class="btn btn-small btn-success" ng-click="toggleWeeks()">Toggle Weeks</button>
15+
<button class="btn btn-small btn-inverse" ng-click="dt = '2009-08-24'">2009-08-24</button>
16+
<button class="btn btn-small btn-success" ng-click="toggleWeeks()" tooltip="For inline datepicker">Toggle Weeks</button>
717
<button class="btn btn-small btn-danger" ng-click="clear()">Clear</button>
8-
<button class="btn btn-small" ng-click="toggleMin()">After today restriction</button>
18+
<button class="btn btn-small" ng-click="toggleMin()" tooltip="After today restriction">Min date</button>
919
</div>

Diff for: ‎src/datepicker/docs/demo.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var DatepickerDemoCtrl = function ($scope) {
1+
var DatepickerDemoCtrl = function ($scope, $timeout) {
22
$scope.today = function() {
33
$scope.dt = new Date();
44
};
@@ -22,4 +22,15 @@ var DatepickerDemoCtrl = function ($scope) {
2222
$scope.minDate = ( $scope.minDate ) ? null : new Date();
2323
};
2424
$scope.toggleMin();
25+
26+
$scope.open = function() {
27+
$timeout(function() {
28+
$scope.opened = true;
29+
});
30+
};
31+
32+
$scope.dateOptions = {
33+
'year-format': "'yy'",
34+
'starting-day': 1
35+
};
2536
};

Diff for: ‎src/datepicker/test/datepicker.spec.js

+569-201
Large diffs are not rendered by default.

Diff for: ‎template/datepicker/datepicker.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<table class="well well-large">
1+
<table>
22
<thead>
33
<tr class="text-center">
44
<th><button type="button" class="btn pull-left" ng-click="move(-1)"><i class="icon-chevron-left"></i></button></th>
@@ -14,7 +14,7 @@
1414
<tr ng-repeat="row in rows">
1515
<td ng-show="showWeekNumbers" class="text-center"><em>{{ getWeekNumber(row) }}</em></td>
1616
<td ng-repeat="dt in row" class="text-center">
17-
<button type="button" style="width:100%;" class="btn" ng-class="{'btn-info': dt.isSelected}" ng-click="select(dt.date)" ng-disabled="dt.disabled"><span ng-class="{muted: ! dt.isCurrent}">{{dt.label}}</span></button>
17+
<button type="button" style="width:100%;" class="btn" ng-class="{'btn-info': dt.selected}" ng-click="select(dt.date)" ng-disabled="dt.disabled"><span ng-class="{muted: dt.secondary}">{{dt.label}}</span></button>
1818
</td>
1919
</tr>
2020
</tbody>

Diff for: ‎template/datepicker/popup.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<ul class="dropdown-menu" ng-style="{display: (isOpen && 'block') || 'none', top: position.top+'px', left: position.left+'px'}" class="dropdown-menu">
2+
<li ng-transclude></li>
3+
<li class="divider"></li>
4+
<li style="padding: 9px;">
5+
<span class="btn-group">
6+
<button class="btn btn-small btn-inverse" ng-click="today()">Today</button>
7+
<button class="btn btn-small btn-info" ng-click="showWeeks = ! showWeeks" ng-class="{active: showWeeks}">Weeks</button>
8+
<button class="btn btn-small btn-danger" ng-click="clear()">Clear</button>
9+
</span>
10+
<button class="btn btn-small btn-success pull-right" ng-click="isOpen = false">Close</button>
11+
</li>
12+
</ul>

0 commit comments

Comments
 (0)
This repository has been archived.