Skip to content

Commit c7fa768

Browse files
committed
Merge branch 'expose-new-options' of https://github.com/raoulus/angular-schema-form-datepicker into raoulus-expose-new-options
Conflicts: bootstrap-datepicker.js bootstrap-datepicker.min.js package.json
2 parents d422d6b + 1d5b71a commit c7fa768

6 files changed

+34
-19
lines changed

.jscs.json .jscsrc

File renamed without changes.

.travis.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
language: node_js
22
node_js:
3-
- 0.10
4-
3+
- 4.2
4+
5+
before_install:
6+
- wget https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2
7+
- tar -xjf phantomjs-2.0.0-ubuntu-12.04.tar.bz2
8+
- sudo rm -rf /usr/local/phantomjs/bin/phantomjs
9+
- sudo mv phantomjs /usr/local/phantomjs/bin/phantomjs
10+
511
before_script:
612
- npm install -g bower
713
- bower install

bootstrap-datepicker.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/datepicker/datepicker.html","<div class=\"form-group {{form.htmlClass}}\" ng-class=\"{\'has-error\': hasError()}\">\n <label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label>\n <div ng-class=\"{\'input-group\': (form.fieldAddonLeft || form.fieldAddonRight)}\">\n <span ng-if=\"form.fieldAddonLeft\"\n class=\"input-group-addon\"\n ng-bind-html=\"form.fieldAddonLeft\"></span>\n <input ng-show=\"form.key\"\n style=\"background-color: white\"\n type=\"text\"\n class=\"form-control {{form.fieldHtmlClass}}\"\n schema-validate=\"form\"\n ng-model=\"$$value$$\"\n ng-disabled=\"form.readonly\"\n pick-a-date=\"form.pickadate\"\n min-date=\"form.minDate\"\n max-date=\"form.maxDate\"\n name=\"{{form.key.slice(-1)[0]}}\"\n format=\"form.format\" />\n <span ng-if=\"form.fieldAddonRight\"\n class=\"input-group-addon\"\n ng-bind-html=\"form.fieldAddonRight\"></span>\n </div>\n <span class=\"help-block\">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span>\n</div>\n");}]);
2-
angular.module('schemaForm').directive('pickADate', function () {
1+
angular.module("schemaForm").run(["$templateCache", function($templateCache) {$templateCache.put("directives/decorators/bootstrap/datepicker/datepicker.html","<div class=\"form-group {{form.htmlClass}}\" ng-class=\"{\'has-error\': hasError()}\">\n <label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">{{form.title}}</label>\n <div ng-class=\"{\'input-group\': (form.fieldAddonLeft || form.fieldAddonRight)}\">\n <span ng-if=\"form.fieldAddonLeft\"\n class=\"input-group-addon\"\n ng-bind-html=\"form.fieldAddonLeft\"></span>\n <input ng-show=\"form.key\"\n type=\"text\"\n class=\"form-control {{form.fieldHtmlClass}}\"\n schema-validate=\"form\"\n ng-model=\"$$value$$\"\n ng-disabled=\"form.readonly\"\n pick-a-date=\"form.pickadate\"\n min-date=\"form.minDate\"\n max-date=\"form.maxDate\"\n select-years=\"form.selectYears\"\n select-months=\"form.selectMonths\"\n name=\"{{form.key.slice(-1)[0]}}\"\n format=\"form.format\" />\n <span ng-if=\"form.fieldAddonRight\"\n class=\"input-group-addon\"\n ng-bind-html=\"form.fieldAddonRight\"></span>\n </div>\n <span class=\"help-block\">{{ (hasError() && errorMessage(schemaError())) || form.description}}</span>\n</div>\n");}]);
2+
angular.module('schemaForm').directive('pickADate', function() {
33

44
//String dates for min and max is not supported
55
//https://github.com/amsul/pickadate.js/issues/439
@@ -20,9 +20,11 @@ angular.module('schemaForm').directive('pickADate', function () {
2020
pickADate: '=',
2121
minDate: '=',
2222
maxDate: '=',
23-
format: '='
23+
format: '=',
24+
selectYears: '=?',
25+
selectMonths: '=?'
2426
},
25-
link: function (scope, element, attrs, ngModel) {
27+
link: function(scope, element, attrs, ngModel) {
2628
//Bail out gracefully if pickadate is not loaded.
2729
if (!element.pickadate) {
2830
return;
@@ -32,10 +34,12 @@ angular.module('schemaForm').directive('pickADate', function () {
3234
//hidden field that pickadate likes to create.
3335
//We use ngModel formatters instead to format the value.
3436
var opts = {
35-
onClose: function () {
37+
onClose: function() {
3638
element.blur();
3739
},
38-
formatSubmit: null
40+
formatSubmit: null,
41+
selectYears: (scope.selectYears || false),
42+
selectMonths: (scope.selectMonths || false)
3943
};
4044
if (scope.pickADate) {
4145
angular.extend(opts, scope.pickADate);
@@ -72,7 +76,7 @@ angular.module('schemaForm').directive('pickADate', function () {
7276

7377
//bind once.
7478
if (angular.isDefined(attrs.minDate)) {
75-
var onceMin = scope.$watch('minDate', function (value) {
79+
var onceMin = scope.$watch('minDate', function(value) {
7680
if (value) {
7781
picker.set('min', formatDate(value));
7882
onceMin();
@@ -81,7 +85,7 @@ angular.module('schemaForm').directive('pickADate', function () {
8185
}
8286

8387
if (angular.isDefined(attrs.maxDate)) {
84-
var onceMax = scope.$watch('maxDate', function (value) {
88+
var onceMax = scope.$watch('maxDate', function(value) {
8589
if (value) {
8690
picker.set('max', formatDate(value));
8791
onceMax();

bootstrap-datepicker.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/angular-pickadate.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
angular.module('schemaForm').directive('pickADate', function () {
1+
angular.module('schemaForm').directive('pickADate', function() {
22

33
//String dates for min and max is not supported
44
//https://github.com/amsul/pickadate.js/issues/439
@@ -19,9 +19,11 @@ angular.module('schemaForm').directive('pickADate', function () {
1919
pickADate: '=',
2020
minDate: '=',
2121
maxDate: '=',
22-
format: '='
22+
format: '=',
23+
selectYears: '=?',
24+
selectMonths: '=?'
2325
},
24-
link: function (scope, element, attrs, ngModel) {
26+
link: function(scope, element, attrs, ngModel) {
2527
//Bail out gracefully if pickadate is not loaded.
2628
if (!element.pickadate) {
2729
return;
@@ -31,10 +33,12 @@ angular.module('schemaForm').directive('pickADate', function () {
3133
//hidden field that pickadate likes to create.
3234
//We use ngModel formatters instead to format the value.
3335
var opts = {
34-
onClose: function () {
36+
onClose: function() {
3537
element.blur();
3638
},
37-
formatSubmit: null
39+
formatSubmit: null,
40+
selectYears: (scope.selectYears || false),
41+
selectMonths: (scope.selectMonths || false)
3842
};
3943
if (scope.pickADate) {
4044
angular.extend(opts, scope.pickADate);
@@ -71,7 +75,7 @@ angular.module('schemaForm').directive('pickADate', function () {
7175

7276
//bind once.
7377
if (angular.isDefined(attrs.minDate)) {
74-
var onceMin = scope.$watch('minDate', function (value) {
78+
var onceMin = scope.$watch('minDate', function(value) {
7579
if (value) {
7680
picker.set('min', formatDate(value));
7781
onceMin();
@@ -80,7 +84,7 @@ angular.module('schemaForm').directive('pickADate', function () {
8084
}
8185

8286
if (angular.isDefined(attrs.maxDate)) {
83-
var onceMax = scope.$watch('maxDate', function (value) {
87+
var onceMax = scope.$watch('maxDate', function(value) {
8488
if (value) {
8589
picker.set('max', formatDate(value));
8690
onceMax();

src/datepicker.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
class="input-group-addon"
66
ng-bind-html="form.fieldAddonLeft"></span>
77
<input ng-show="form.key"
8-
style="background-color: white"
98
type="text"
109
class="form-control {{form.fieldHtmlClass}}"
1110
schema-validate="form"
@@ -14,6 +13,8 @@
1413
pick-a-date="form.pickadate"
1514
min-date="form.minDate"
1615
max-date="form.maxDate"
16+
select-years="form.selectYears"
17+
select-months="form.selectMonths"
1718
name="{{form.key.slice(-1)[0]}}"
1819
format="form.format" />
1920
<span ng-if="form.fieldAddonRight"

0 commit comments

Comments
 (0)