updated module name to datePicker

moved templates from `scripts` to `templates` directory
more verbose template names
updated `translate-z` to higher value - so we don't have conflicts with things like modals
unified bower.json with `master` branch
unified readme
updated `grunt` tasks to copy readme and bower.json
This commit is contained in:
g00fy
2013-06-20 00:27:20 +02:00
parent 209b884a37
commit fdf8a67fef
14 changed files with 161 additions and 23 deletions

View File

@@ -69,7 +69,7 @@ module.exports = function (grunt) {
dist : {
files: [
{
dot: true,
dot: false,
src: [
'.tmp',
'<%= yeoman.dist %>'
@@ -128,10 +128,10 @@ module.exports = function (grunt) {
expand : true,
flatten: true,
dot : true,
cwd : '<%= yeoman.app %>',
dest : '<%= yeoman.dist %>',
src : [
'styles/date.css'
'README.md',
'bower.json'
]
}
]
@@ -141,9 +141,9 @@ module.exports = function (grunt) {
dist: {
options: {
base : '<%= yeoman.app %>',
module: 'dateInput'
module: 'datePicker'
},
src : '<%= yeoman.app %>/scripts/*.html',
src : '<%= yeoman.app %>/templates/*.html',
dest : '.tmp/templates.js'
}
},
@@ -185,7 +185,8 @@ module.exports = function (grunt) {
'concat',
'cssmin',
'ngmin',
'uglify'
'uglify',
'copy:dist'
]);
grunt.registerTask('default', ['build']);

View File

@@ -77,4 +77,3 @@ Live demo : http://run.plnkr.co/erJj712N4bbkGsub/
```html
<div date-range start="start" end="end"></div>
```

View File

@@ -87,7 +87,7 @@
<script src="scripts/module.js"></script>
<!-- endbuild -->
<script>
angular.module('sample', ['dateInput', 'ui.bootstrap'])
angular.module('sample', ['datePicker', 'ui.bootstrap']);
</script>
</body>
</html>

View File

@@ -1,6 +1,6 @@
(function (angular) {
'use strict';
var Module = angular.module('dateInput', []);
var Module = angular.module('datePicker', []);
Module.directive('datePicker', function () {
@@ -357,7 +357,7 @@
},
transclude : true,
replace : true,
templateUrl: 'scripts/template.html'
templateUrl: 'templates/datepicker.html'
};
});
@@ -392,7 +392,7 @@
picker = $compile('<div date-picker="' + attrs.ngModel + '" class="datetimepicker datetimepicker-dropdown-bottom-left dropdown-menu" format="' + format + '" ' + views.join(' ') + '></div>')(scope);
body.append(picker);
scope.$digest();
var pos = angular.extend({}, element.position(), { height: element[0].offsetHeight });
var pos = angular.extend(element.offset(), { height: element[0].offsetHeight });
picker.css({ top: pos.top + pos.height, left: pos.left, display: 'block', position: 'absolute'});
picker.bind('mousedown', function () {
return false;
@@ -414,7 +414,7 @@
Module.directive('dateRange', function () {
return {
template: '<div>\n <table >\n <tr>\n <td valign="top"><div date-picker="start" class="date-picker" date after="start" before="end"></div></td>\n <td valign="top"><div date-picker="end" class="date-picker" date after="start" before="end"></div></td>\n </tr>\n </table>\n \n \n</div>',
templateUrl: 'templates/daterange.html',
scope : {
start: '=',
end : '='

View File

@@ -20,6 +20,7 @@
}
[date-picker] {
z-index: 11000; /* to avoid bootstrap-modal issues */
padding: 4px;
margin-top: 1px;
-webkit-border-radius: 4px;

View File

@@ -0,0 +1,12 @@
<div>
<table>
<tr>
<td valign="top">
<div date-picker="start" class="date-picker" date after="start" before="end"></div>
</td>
<td valign="top">
<div date-picker="end" class="date-picker" date after="start" before="end"></div>
</td>
</tr>
</table>
</div>

View File

@@ -1,10 +1,10 @@
{
"name": "angular-datepicker",
"main": ["dist/module.min.js","dist/date.min.css"],
"main": ["module.min.js","date.min.css"],
"license": "MIT",
"version": "0.0.1",
"ignore": [
"**/.*"
".gitignore","README.md"
],
"dependencies": {},
"devDependencies": {
@@ -16,4 +16,4 @@
"angular-scenario": "~1.0.5",
"angular-bootstrap": "~0.3.0"
}
}
}

79
dist/README.md vendored Normal file
View File

@@ -0,0 +1,79 @@
# AngularJS datepicker directives
#### Requirements
- Angular v1.1.4+
- jQuery or your own implementation of `position()` on top of `jQuery Lite`
#### Development version
Checkout branch `dev`, run `grunt install` and `bower install`.
To build run `gunt build`
## Examples
Live demo : http://run.plnkr.co/erJj712N4bbkGsub/
##### defaults
```html
<div date-picker="start"></div>
```
##### year view
```html
<div date-picker="start" year></div>
```
##### month view
```html
<div date-picker="start" month></div>
```
##### only date view
```html
<div date-picker="start" date></div>
```
##### hours view
```html
<div date-picker="start" hours></div>
```
##### minutes view
```html
<div date-picker="start" minutes></div>
```
##### input as datepicker
```html
<input type="datetime" date-time ng-model="start">
```
##### input with formatted value
```html
<input type="datetime" date-time ng-model="end" hours format="short">
```
##### date-range picker
```html
<div date-range start="start" end="end"></div>
```

19
dist/bower.json vendored Normal file
View File

@@ -0,0 +1,19 @@
{
"name": "angular-datepicker",
"main": ["module.min.js","date.min.css"],
"license": "MIT",
"version": "0.0.1",
"ignore": [
".gitignore","README.md"
],
"dependencies": {},
"devDependencies": {
"angular-unstable": "latest",
"json3": "~3.2.4",
"es5-shim": "~2.0.8",
"jquery": "~2.0.2",
"angular-mocks": "~1.0.5",
"angular-scenario": "~1.0.5",
"angular-bootstrap": "~0.3.0"
}
}

1
dist/index.css vendored
View File

@@ -20,6 +20,7 @@
}
[date-picker] {
z-index: 11000; /* to avoid bootstrap-modal issues */
padding: 4px;
margin-top: 1px;
-webkit-border-radius: 4px;

38
dist/index.js vendored
View File

@@ -1,6 +1,6 @@
(function (angular) {
'use strict';
var Module = angular.module('dateInput', []);
var Module = angular.module('datePicker', []);
Module.directive('datePicker', function () {
@@ -357,7 +357,7 @@
},
transclude : true,
replace : true,
templateUrl: 'scripts/template.html'
templateUrl: 'templates/datepicker.html'
};
});
@@ -392,7 +392,7 @@
picker = $compile('<div date-picker="' + attrs.ngModel + '" class="datetimepicker datetimepicker-dropdown-bottom-left dropdown-menu" format="' + format + '" ' + views.join(' ') + '></div>')(scope);
body.append(picker);
scope.$digest();
var pos = angular.extend({}, element.position(), { height: element[0].offsetHeight });
var pos = angular.extend(element.offset(), { height: element[0].offsetHeight });
picker.css({ top: pos.top + pos.height, left: pos.left, display: 'block', position: 'absolute'});
picker.bind('mousedown', function () {
return false;
@@ -414,7 +414,7 @@
Module.directive('dateRange', function () {
return {
template: '<div>\n <table >\n <tr>\n <td valign="top"><div date-picker="start" class="date-picker" date after="start" before="end"></div></td>\n <td valign="top"><div date-picker="end" class="date-picker" date after="start" before="end"></div></td>\n </tr>\n </table>\n \n \n</div>',
templateUrl: 'templates/daterange.html',
scope : {
start: '=',
end : '='
@@ -434,9 +434,9 @@
};
});
})(angular);
angular.module("dateInput").run(["$templateCache", function($templateCache) {
angular.module("datePicker").run(["$templateCache", function($templateCache) {
$templateCache.put("scripts/template.html",
$templateCache.put("templates/datepicker.html",
"<div ng-transclude ng-switch=\"view\">\r" +
"\n" +
" <div class=\"datetimepicker-days\" ng-switch-when=\"date\">\r" +
@@ -688,4 +688,30 @@ angular.module("dateInput").run(["$templateCache", function($templateCache) {
"</div>"
);
$templateCache.put("templates/daterange.html",
"<div>\r" +
"\n" +
" <table>\r" +
"\n" +
" <tr>\r" +
"\n" +
" <td valign=\"top\">\r" +
"\n" +
" <div date-picker=\"start\" class=\"date-picker\" date after=\"start\" before=\"end\"></div>\r" +
"\n" +
" </td>\r" +
"\n" +
" <td valign=\"top\">\r" +
"\n" +
" <div date-picker=\"end\" class=\"date-picker\" date after=\"start\" before=\"end\"></div>\r" +
"\n" +
" </td>\r" +
"\n" +
" </tr>\r" +
"\n" +
" </table>\r" +
"\n" +
"</div>"
);
}]);

2
dist/index.min.css vendored

File diff suppressed because one or more lines are too long

2
dist/index.min.js vendored

File diff suppressed because one or more lines are too long