Skip to content

Commit bb1c33e

Browse files
committed
Merge branch 'release/0.4.0'
2 parents 0c2b7c1 + 3475002 commit bb1c33e

18 files changed

+581
-322
lines changed

.bowerrc

-3
This file was deleted.

.gitignore

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
.idea
2-
coverage/*
3-
complexity/*
4-
lib-cov
5-
bower_components/*
6-
node_modules/*
7-
*.seed
8-
*.log
91
*.csv
102
*.dat
11-
*.out
12-
*.pid
133
*.gz
144
*.iml
15-
16-
pids
5+
*.log
6+
*.out
7+
*.pid
8+
*.seed
9+
.idea
10+
build
11+
lib-cov
1712
logs
18-
results
19-
13+
node_modules/*
2014
npm-debug.log
21-
15+
pids
16+
results

README.md

+33-20
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# Angular bootstrap date & time picker version: 0.3.15
1+
# Angular bootstrap date & time picker version: 0.4.0
22

33
Native AngularJS datetime picker directive styled by Twitter Bootstrap 3
44

55
[![MIT License][license-image]][license-url]
66
[![Build Status](https://travis-ci.org/dalelotts/angular-bootstrap-datetimepicker.png?branch=master)](https://travis-ci.org/dalelotts/angular-bootstrap-datetimepicker)
77
[![Dependency Status](https://david-dm.org/dalelotts/angular-bootstrap-datetimepicker.svg)](https://david-dm.org/dalelotts/angular-bootstrap-datetimepicker)
88
[![devDependency Status](https://david-dm.org/dalelotts/angular-bootstrap-datetimepicker/dev-status.png)](https://david-dm.org/dalelotts/angular-bootstrap-datetimepicker#info=devDependencies)
9+
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
910
[![PayPal donate button](http://img.shields.io/paypal/donate.png?color=yellow)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=F3FX5W6S2U4BW&lc=US&item_name=Dale%20Lotts&item_number=angular%2dbootstrap%2ddatetimepicker&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted "Donate one-time to this project using Paypal")
1011
<a href="https://twitter.com/intent/tweet?original_referer=https%3A%2F%2Fabout.twitter.com%2Fresources%2Fbuttons&amp;text=Check%20out%20this%20%23AngularJS%20directive%20that%20makes%20it%20dead%20simple%20for%20users%20to%20select%20dates%20%26%20times&amp;tw_p=tweetbutton&amp;url=https%3A%2F%2Fgithub.com%2Fdalelotts%2Fangular-bootstrap-datetimepicker&amp;via=dalelotts" target="_blank">
1112
<img src="http://jpillora.com/github-twitter-button/img/tweet.png"></img>
@@ -18,7 +19,7 @@ Native AngularJS datetime picker directive styled by Twitter Bootstrap 3
1819
#Dependencies
1920

2021
Requires:
21-
* AngularJS 1.2.26 or higher (1.0.x will not work)
22+
* AngularJS 1.4.x or higher (1.0.x will not work)
2223
* moment.js 2.8.3 or higher for date parsing and formatting
2324
* bootstrap's glyphicons for arrows (Can be overridden in css)
2425

@@ -30,7 +31,7 @@ This directive was written using TDD and all enhancements and changes have relat
3031

3132
We use karma and jshint to ensure the quality of the code. The easiest way to run these checks is to use gulp:
3233

33-
```
34+
```shell
3435
npm install
3536
npm test
3637
```
@@ -39,35 +40,27 @@ The karma task will try to open Chrome as a browser in which to run the tests.
3940
Make sure Chrome is available or change the browsers setting in karma.config.js
4041

4142
#Usage
42-
We use bower for dependency management. Add
43-
44-
```json
45-
dependencies: {
46-
"angular-bootstrap-datetimepicker": "latest"
47-
}
48-
```
43+
We use npm for dependency management, run
4944

50-
To your bower.json file. Then run
51-
52-
```html
53-
bower install
45+
```shell
46+
npm install --save angular-bootstrap-datetimepicker
5447
```
5548

5649
This will copy the angular-bootstrap-datetimepicker files into your components folder, along with its dependencies.
5750

5851
Add the css:
5952

6053
```html
61-
<link rel="stylesheet" href="components/bootstrap/dist/css/bootstrap.css">
62-
<link rel="stylesheet" href="components/angular-bootstrap-datetimepicker/src/css/datetimepicker.css"/>
54+
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css">
55+
<link rel="stylesheet" href="node_modules/angular-bootstrap-datetimepicker/src/css/datetimepicker.css"/>
6356
```
6457

6558
Load the script files in your application:
6659
```html
67-
<script type="text/javascript" src="components/moment/moment.js"></script>
68-
<script type="text/javascript" src="components/bootstrap/dist/js/bootstrap.js"></script>
69-
<script type="text/javascript" src="components/angular/angular.js"></script>
70-
<script type="text/javascript" src="components/angular-bootstrap-datetimepicker/src/js/datetimepicker.js"></script>
60+
<script type="text/javascript" src="node_modules/moment/moment.js"></script>
61+
<script type="text/javascript" src="node_modules/bootstrap/dist/js/bootstrap.js"></script>
62+
<script type="text/javascript" src="node_modules/angular/angular.js"></script>
63+
<script type="text/javascript" src="node_modules/angular-bootstrap-datetimepicker/src/js/datetimepicker.js"></script>
7164
```
7265

7366
Add the date module as a dependency to your application module:
@@ -170,12 +163,32 @@ String. 'minute'
170163

171164
The lowest view that the datetimepicker should show.
172165

166+
Accepts the same values as startView.
167+
173168
### minuteStep
174169

175170
Number. Default: 5
176171

177172
The increment used to build the hour view. A button is created for each <code>minuteStep</code> minutes.
178173

174+
### configureOn
175+
176+
String. Default: null
177+
178+
Causes the date/time picker to re-read its configuration when the specified event is received.
179+
180+
For example, perhaps the startView option in the configuration has changed and you would like the
181+
new configuration to be used. You can $broadcast the event to cause this directive to use the new configuration.
182+
183+
### renderOn
184+
185+
String. Default: null
186+
187+
Causes the date/time picker to re-render its view when the specified event is received.
188+
189+
For example, if you want to disable any dates or times that are in the past.
190+
You can $broadcast the event at an interval to disable times in the past (or any other time valid dates change).
191+
179192
### dropdownSelector
180193

181194
When used within a Bootstrap dropdown and jQuery, the selector specified in dropdownSelector will toggle the dropdown when a date/time is selected.

bower.json

-34
This file was deleted.

demo/demo-controller.js

+36
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,41 @@ angular.module('demo.demoController', [])
6969
$scope.configFunction = function configFunction() {
7070
return {startView: 'month'};
7171
};
72+
73+
$scope.config = {
74+
configureOnConfig: {
75+
startView: 'year',
76+
configureOn: 'config-changed'
77+
},
78+
renderOnConfig: {
79+
startView: 'year',
80+
renderOn: 'valid-dates-changed'
81+
}
82+
};
83+
84+
var validViews = ['year', 'month', 'day', 'hour', 'minute'];
85+
86+
$scope.changeConfig = function changeConfig() {
87+
var newIndex = validViews.indexOf($scope.config.configureOnConfig.startView) + 1;
88+
console.log(newIndex);
89+
if (newIndex >= validViews.length) {
90+
newIndex = 0;
91+
}
92+
$scope.config.configureOnConfig.startView = validViews[newIndex];
93+
$scope.$broadcast('config-changed');
94+
};
95+
96+
var selectable = true;
97+
98+
$scope.renderOnBeforeRender = function ($dates) {
99+
angular.forEach($dates, function (dateObject) {
100+
dateObject.selectable = selectable;
101+
});
102+
};
103+
104+
$scope.renderOnClick = function renderOnClick() {
105+
selectable = (!selectable);
106+
$scope.$broadcast('valid-dates-changed');
107+
};
72108
}
73109
]);

0 commit comments

Comments
 (0)