Skip to content

Commit 443ea76

Browse files
committed
Merge branch 'release/0.3.6'
2 parents e1c1576 + 92f462e commit 443ea76

35 files changed

+514
-241
lines changed

.jshintrc

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
// JSHint Default Configuration File (as on JSHint website)
3+
// See http://jshint.com/docs/ for more details
4+
5+
"maxerr" : 50, // {int} Maximum error before stopping
6+
7+
// Enforcing
8+
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
9+
"camelcase" : true, // true: Identifiers must be in camelCase
10+
"curly" : true, // true: Require {} for every new block or scope
11+
"eqeqeq" : true, // true: Require triple equals (===) for comparison
12+
"freeze" : true, // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
13+
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty()
14+
"immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
15+
"indent" : 2, // {int} Number of spaces to use for indentation
16+
"latedef" : true, // true: Require variables/functions to be defined before being used
17+
"newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
18+
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
19+
"noempty" : true, // true: Prohibit use of empty blocks
20+
"nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters.
21+
"nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment)
22+
"plusplus" : true, // true: Prohibit use of `++` & `--`
23+
"quotmark" : "single", // Quotation mark consistency:
24+
// false : do nothing (default)
25+
// true : ensure whatever is used is consistent
26+
// "single" : require single quotes
27+
// "double" : require double quotes
28+
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
29+
"unused" : true, // true: Require all defined variables be used
30+
"strict" : true, // true: Requires all functions run in ES5 Strict Mode
31+
"maxparams" : false, // {int} Max number of formal params allowed per function
32+
"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
33+
"maxstatements" : false, // {int} Max number statements per function
34+
"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
35+
"maxlen" : false, // {int} Max number of characters per line
36+
37+
// Relaxing
38+
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
39+
"boss" : false, // true: Tolerate assignments where comparisons would be expected
40+
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
41+
"eqnull" : false, // true: Tolerate use of `== null`
42+
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
43+
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
44+
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
45+
// (ex: `for each`, multiple try/catch, function expression…)
46+
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
47+
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
48+
"funcscope" : false, // true: Tolerate defining variables inside control statements
49+
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
50+
"iterator" : false, // true: Tolerate using the `__iterator__` property
51+
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
52+
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
53+
"laxcomma" : false, // true: Tolerate comma-first style coding
54+
"loopfunc" : false, // true: Tolerate functions being defined in loops
55+
"multistr" : false, // true: Tolerate multi-line strings
56+
"noyield" : false, // true: Tolerate generator functions with no yield statement in them.
57+
"notypeof" : false, // true: Tolerate invalid typeof operator values
58+
"proto" : false, // true: Tolerate using the `__proto__` property
59+
"scripturl" : false, // true: Tolerate script-targeted URLs
60+
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
61+
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
62+
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
63+
"validthis" : false, // true: Tolerate using this in a non-constructor function
64+
65+
// Environments
66+
"browser" : true, // Web Browser (window, document, etc)
67+
"browserify" : false, // Browserify (node.js code in the browser)
68+
"couch" : false, // CouchDB
69+
"devel" : true, // Development/debugging (alert, confirm, etc)
70+
"dojo" : false, // Dojo Toolkit
71+
"jasmine" : true, // Jasmine
72+
"jquery" : false, // jQuery
73+
"mocha" : true, // Mocha
74+
"mootools" : false, // MooTools
75+
"node" : false, // Node.js
76+
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
77+
"prototypejs" : false, // Prototype and Scriptaculous
78+
"qunit" : false, // QUnit
79+
"rhino" : false, // Rhino
80+
"shelljs" : false, // ShellJS
81+
"worker" : false, // Web Workers
82+
"wsh" : false, // Windows Scripting Host
83+
"yui" : false, // Yahoo User Interface
84+
85+
// Custom Globals
86+
"globals" : {
87+
"angular" : true,
88+
"moment" : true
89+
}
90+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Angular bootstrap date & time picker version: 0.3.5
1+
# Angular bootstrap date & time picker version: 0.3.6
22
================================
33

44
Native AngularJS datetime picker directive styled by Twitter Bootstrap 3

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-bootstrap-datetimepicker",
3-
"version": "0.3.5",
3+
"version": "0.3.6",
44
"description": "This directive allows you to add a datetime-picker to your form.",
55
"author": "https://github.com/dalelotts/angular-bootstrap-datetimepicker/graphs/contributors",
66
"license": "MIT",

demo/demo-controller.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ angular.module('demo.demoController', [])
77
'use strict';
88
$scope.controllerName = 'demoController';
99

10-
moment.locale("en");
10+
moment.locale('en');
1111

1212
$scope.data = {
1313
guardians: [
@@ -26,7 +26,7 @@ angular.module('demo.demoController', [])
2626
$scope.data.checked = false;
2727
};
2828

29-
$scope.inputOnTimeSet = function (newDate, oldDate) {
29+
$scope.inputOnTimeSet = function (newDate) {
3030
// If you are not using jQuery or bootstrap.js,
3131
// this will throw an error.
3232
// However, can write this function to take any
@@ -45,15 +45,28 @@ angular.module('demo.demoController', [])
4545
};
4646

4747

48-
$scope.guardianOnTimeSet = function ($index) {
48+
$scope.guardianOnSetTime = function ($index, guardian, newDate, oldDate) {
4949
console.log($index);
50-
$('#guardian' + $index).dropdown('toggle');
50+
console.log(guardian.name);
51+
console.log(newDate);
52+
console.log(oldDate);
53+
angular.element('#guardian' + $index).dropdown('toggle');
5154
};
5255

5356
$scope.beforeRender = function ($dates) {
5457
var index = Math.floor(Math.random() * $dates.length);
5558
console.log(index);
5659
$dates[index].selectable = false;
5760
};
61+
62+
$scope.config = {
63+
datetimePicker: {
64+
startView: 'year'
65+
}
66+
};
67+
68+
$scope.configFunction = function configFunction() {
69+
return {startView: 'month'};
70+
};
5871
}
59-
]);
72+
]);

demo/index.html

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,6 @@ <h3>Show / hide with check box</h3>
214214
</div>
215215

216216
<div class="row">
217-
218-
219217
<div class="col-sm-6">
220218
<h3>Embedded calendar</h3>
221219

@@ -258,9 +256,39 @@ <h3>Embedded calendar form integration</h3>
258256
</div>
259257
</div>
260258

259+
261260
<div class="row">
261+
<div class="col-sm-6">
262+
<h3>Embedded calendar with property configuration</h3>
263+
264+
<p><code>data-datetimepicker-config="config.datetimePicker"</code></p>
265+
<p>which returns <code>{ startView: 'year' }</code></p>
266+
267+
<div class="well">
268+
<p>Formatted Date: {{ data.embeddedPropertyConfig | date:'yyyy-MM-dd h:mm a' }}</p>
269+
270+
<datetimepicker data-ng-model="data.embeddedPropertyConfig" data-datetimepicker-config="config.datetimePicker" ></datetimepicker>
271+
</div>
272+
</div>
262273
<div class="col-sm-6">
274+
<h3>Embedded calendar with function configuration</h3>
275+
276+
<p><code>data-datetimepicker-config="configFunction()"</code></p>
277+
<p>which returns <code>{ startView: 'month' }</code></p>
263278

279+
<div class="well">
280+
<p>Formatted Date: {{ data.embeddedFunctionConfig | date:'yyyy-MM-dd h:mm a' }}</p>
281+
282+
<datetimepicker data-ng-model="data.embeddedFunctionConfig" data-datetimepicker-config="configFunction()" ></datetimepicker>
283+
</div>
284+
</div>
285+
286+
</div>
287+
288+
<div class="row">
289+
<div class="col-sm-6">
290+
<h3>ng-repeat with drop-down using text link</h3>
291+
<p><code>data-on-set-time="guardianOnSetTime($index, guardian, newDate, oldDate)"</code></p>
264292
<div class="well" data-ng-repeat = "guardian in data.guardians">
265293
<p>{{ guardian.name }}</p>
266294
<p>DOB: {{ guardian.dob | date:'yyyy-MM-dd' }} </p>
@@ -271,7 +299,7 @@ <h3>Embedded calendar form integration</h3>
271299
</a>
272300
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
273301
<datetimepicker data-ng-model="guardian.dob"
274-
data-on-set-time="guardianOnTimeSetDoesNotExist"></datetimepicker>
302+
data-on-set-time="guardianOnSetTime($index, guardian, newDate, oldDate)"></datetimepicker>
275303
</ul>
276304
</div>
277305
</div>
@@ -309,4 +337,4 @@ <h4>One date is randomly disabled on each view</h4>
309337

310338

311339
</body>
312-
</html>
340+
</html>

gulpfile.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*globals require, __dirname */
2+
/* jshint node:true */
3+
'use strict';
4+
5+
var gulp = require('gulp');
6+
var jshint = require('gulp-jshint');
7+
var karma = require('karma').server;
8+
var bump = require('gulp-bump');
9+
var plato = require('gulp-plato');
10+
var karmaConfig = __dirname + '/karma.conf.js';
11+
var paths = require('./paths');
12+
13+
14+
gulp.task('bump', function () {
15+
return gulp.src(paths.bump)
16+
.pipe(bump())
17+
.pipe(gulp.dest('./'));
18+
});
19+
20+
gulp.task('complexity', function () {
21+
return gulp.src('src/**/*.js')
22+
.pipe(plato('complexity'));
23+
});
24+
25+
gulp.task('test', function (done) {
26+
karma.start({configFile: karmaConfig, singleRun: true}, done);
27+
});
28+
29+
gulp.task('tdd', function (done) {
30+
gulp.watch(paths.all, ['lint']);
31+
32+
karma.start({
33+
configFile: paths.karmaConfig
34+
}, done);
35+
});
36+
37+
gulp.task('lint', function () {
38+
return gulp
39+
.src(paths.lint)
40+
.pipe(jshint())
41+
.pipe(jshint.reporter('jshint-stylish'))
42+
.pipe(jshint.reporter('fail'));
43+
});
44+
45+
gulp.task('default', ['lint', 'complexity', 'test']);

karma.conf.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/*globals module */
1+
/*globals require */
2+
/* jshint node:true */
23

34
/**
45
* @license angular-bootstrap-datetimepicker
@@ -12,6 +13,9 @@
1213
* @since 7/21/13
1314
*/
1415

16+
17+
var paths = require('./paths');
18+
1519
module.exports = function (config) {
1620
'use strict';
1721
config.set({
@@ -24,26 +28,16 @@ module.exports = function (config) {
2428
'karma-firefox-launcher',
2529
'karma-phantomjs-launcher',
2630
'karma-coverage'
31+
// 'karma-threshold-reporter'
2732
],
2833

29-
files: [
30-
'bower_components/jquery/dist/jquery.js',
31-
'bower_components/moment/moment.js',
32-
'bower_components/moment/locale/*.js',
33-
'bower_components/bootstrap/dist/js/bootstrap.js',
34-
'bower_components/angular/angular.js',
35-
'bower_components/angular-mocks/angular-mocks.js',
36-
'src/js/datetimepicker.js',
37-
'test/**/*.spec.js'
38-
],
34+
files: paths.all,
3935

4036
// list of files to exclude
41-
exclude: [
42-
43-
],
37+
exclude: [],
4438

4539
preprocessors: {
46-
'**/src/js/*.js': ['coverage']
40+
'src/**/*.js': ['coverage']
4741
},
4842

4943
// optionally, configure the reporter
@@ -58,6 +52,15 @@ module.exports = function (config) {
5852
// possible values: 'dots', 'progress', 'junit'
5953
reporters: ['progress', 'coverage'],
6054

55+
56+
// the configure thresholds
57+
thresholdReporter: {
58+
statements: 100,
59+
branches: 100,
60+
functions: 100,
61+
lines: 100
62+
},
63+
6164
// web server port
6265
port: 9876,
6366

@@ -98,4 +101,4 @@ module.exports = function (config) {
98101
// if true, it capture browsers, run tests and exit
99102
singleRun: false
100103
});
101-
};
104+
};

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
22
"name": "angular-bootstrap-datetimepicker",
3-
"version": "0.3.5",
3+
"version": "0.3.6",
44
"description": "This directive allows you to add a datetime-picker to your form elements.",
55
"author": "https://github.com/dalelotts/ng-bootstrap-datetimepicker/graphs/contributors",
6+
"bugs": {
7+
"url": "https://github.com/dalelotts/ng-bootstrap-datetimepicker/issues"
8+
},
69
"license": "MIT",
710
"homepage": "http://dalelotts.github.io/angular-bootstrap-datetimepicker",
811
"main": "src/js/datetimepicker.js",
@@ -15,11 +18,18 @@
1518
"grunt-contrib-jshint": "^0.10.0",
1619
"grunt-istanbul-coverage": "^0.1.0",
1720
"grunt-karma": "^0.9.0",
21+
"gulp": "^3.8.10",
22+
"gulp-bump": "^0.1.11",
23+
"gulp-jshint": "^1.9.0",
24+
"gulp-plato": "^1.0.1",
25+
"jshint-stylish": "^1.0.0",
26+
"karma": "^0.12.25",
1827
"karma-chrome-launcher": "^0.1.5",
1928
"karma-coverage": "^0.2.1",
2029
"karma-firefox-launcher": "^0.1.3",
2130
"karma-jasmine": "^0.2.3",
2231
"karma-phantomjs-launcher": "^0.1.2",
32+
"karma-threshold-reporter": "^0.1.9",
2333
"matchdep": "^0.3.0",
2434
"phantomjs": "^1.9.12"
2535
},

paths.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* jshint node:true */
2+
3+
var bower = [
4+
'bower_components/jquery/dist/jquery.js',
5+
'bower_components/moment/moment.js',
6+
'bower_components/moment/locale/*.js',
7+
'bower_components/bootstrap/dist/js/bootstrap.js',
8+
'bower_components/angular/angular.js',
9+
'bower_components/angular-mocks/angular-mocks.js'
10+
];
11+
var sourceFiles = ['src/**/*.js'];
12+
var testFiles = ['test/**/*.js'];
13+
var miscFiles = ['karma.conf.js', 'demo/**/*.js'];
14+
var bumpFiles = ['package.json', 'bower.json', 'README.md', 'src/js/*.js', 'src/css/*.css'];
15+
16+
module.exports = {
17+
all: bower.concat(sourceFiles).concat(testFiles).concat(miscFiles),
18+
app: sourceFiles,
19+
bump: bumpFiles,
20+
lint: ['gulpfile.js'].concat(sourceFiles).concat(testFiles).concat(miscFiles),
21+
test: testFiles
22+
};

src/css/datetimepicker.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license angular-bootstrap-datetimepicker version: 0.3.5
2+
* @license angular-bootstrap-datetimepicker version: 0.3.6
33
* (c) 2013-2014 Knight Rider Consulting, Inc. http://www.knightrider.com
44
* License: MIT
55
*/

0 commit comments

Comments
 (0)