ember-cli-bootstrap-datepicker
Advanced tools
Comparing version 0.2.0 to 0.3.0
import Ember from 'ember'; | ||
import DatepickerSupport from 'ember-cli-bootstrap-datepicker/components/datepicker-support'; | ||
export default Ember.TextField.extend({ | ||
setupBootstrapDatepicker: function() { | ||
var self = this, | ||
element = this.$(), | ||
value = this.get('value'); | ||
export default Ember.Component.extend(DatepickerSupport, { | ||
instrumentDisplay: '{{input type="text"}}', | ||
element. | ||
datepicker({ | ||
autoclose: this.get('autoclose') || true, | ||
format: this.get('format') || 'dd.mm.yyyy', | ||
weekStart: this.get('weekStart') || 1, | ||
todayHighlight: this.get('todayHighlight') || false, | ||
todayBtn: this.get('todayBtn') || false, | ||
language: this.get('language') || 'en' | ||
}). | ||
on('changeDate', function(event) { | ||
Ember.run(function() { | ||
self.didSelectDate(event); | ||
}); | ||
}); | ||
classNames: ['ember-text-field'], | ||
if (value) { | ||
element.datepicker('setDate', new Date(value)); | ||
}; | ||
}.on('didInsertElement'), | ||
tagName: 'input', | ||
teardownBootstrapDatepicker: function() { | ||
// no-op | ||
}.on('willDestroyElement'), | ||
attributeBindings: [ | ||
'accesskey', | ||
'autocomplete', | ||
'autofocus', | ||
'contenteditable', | ||
'contextmenu', | ||
'dir', | ||
'disabled', | ||
'draggable', | ||
'dropzone', | ||
'form', | ||
'hidden', | ||
'id', | ||
'lang', | ||
'list', | ||
'max', | ||
'min', | ||
'name', | ||
'placeholder', | ||
'readonly', | ||
'required', | ||
'spellcheck', | ||
'step', | ||
'style', | ||
'tabindex', | ||
'title', | ||
'translate', | ||
'type' | ||
], | ||
didSelectDate: function(event) { | ||
var date = this.$().datepicker('getUTCDate'); | ||
this.set('value', date.toISOString()); | ||
} | ||
type: 'text' | ||
}); |
@@ -6,5 +6,5 @@ { | ||
"jquery": "^1.11.1", | ||
"ember": "1.7.0", | ||
"ember-data": "1.0.0-beta.10", | ||
"ember-resolver": "~0.1.7", | ||
"ember": "1.8.1", | ||
"ember-data": "1.0.0-beta.12", | ||
"ember-resolver": "~0.1.11", | ||
"loader.js": "stefanpenner/loader.js#1.0.1", | ||
@@ -19,4 +19,4 @@ "ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3", | ||
"devDependencies": { | ||
"bootstrap-datepicker": "~1.3.0" | ||
"bootstrap-datepicker": "~1.3.1" | ||
} | ||
} |
@@ -0,1 +1,2 @@ | ||
/* jshint node: true */ | ||
/* global require, module */ | ||
@@ -20,2 +21,9 @@ | ||
app.import(app.bowerDirectory + '/bootstrap/dist/css/bootstrap.css'); | ||
app.import(app.bowerDirectory + '/bootstrap/dist/css/bootstrap.css.map', { | ||
destDir: 'assets' | ||
}); | ||
app.import(app.bowerDirectory + '/bootstrap-datepicker/js/locales/bootstrap-datepicker.de.js'); | ||
module.exports = app.toTree(); |
@@ -0,1 +1,2 @@ | ||
/* jshint node: true */ | ||
'use strict'; | ||
@@ -2,0 +3,0 @@ |
{ | ||
"name": "ember-cli-bootstrap-datepicker", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Datepicker component for Ember CLI based on bootstrap-datepicker", | ||
"directories": { | ||
@@ -20,12 +21,13 @@ "doc": "doc", | ||
"devDependencies": { | ||
"body-parser": "^1.2.0", | ||
"broccoli-asset-rev": "0.3.1", | ||
"broccoli-asset-rev": "^2.0.0", | ||
"broccoli-ember-hbs-template-compiler": "^1.6.1", | ||
"ember-cli": "0.1.2", | ||
"ember-cli": "0.1.5", | ||
"ember-cli-content-security-policy": "0.3.0", | ||
"ember-export-application-global": "^1.0.0", | ||
"ember-cli-dependency-checker": "0.0.7", | ||
"ember-cli-esnext": "0.1.1", | ||
"ember-cli-ic-ajax": "0.1.1", | ||
"ember-cli-inject-live-reload": "^1.3.0", | ||
"ember-cli-qunit": "0.1.0", | ||
"ember-data": "1.0.0-beta.10", | ||
"ember-cli-qunit": "0.1.2", | ||
"ember-data": "1.0.0-beta.12", | ||
"ember-export-application-global": "^1.0.0", | ||
"express": "^4.8.5", | ||
@@ -41,4 +43,5 @@ "glob": "^4.0.5" | ||
"ember-addon": { | ||
"configPath": "tests/dummy/config" | ||
"configPath": "tests/dummy/config", | ||
"defaultBlueprint": "bootstrap-datepicker" | ||
} | ||
} |
176
README.md
@@ -1,10 +0,20 @@ | ||
# Ember CLI datepicker | ||
# Ember CLI datepicker add-on | ||
The addon provides you a `bootstrap-datapicker` input component. It can be used in Ember CLI applications. | ||
[![Build Status](https://travis-ci.org/soulim/ember-cli-bootstrap-datepicker.svg?branch=master&style=flat)](https://travis-ci.org/soulim/ember-cli-bootstrap-datepicker) | ||
The input component is based on [bootstrap-datepicker library](https://github.com/eternicode/bootstrap-datepicker). | ||
The add-on provides you a date input component based on amazing bootstrap-datepicker library. It supports popup and inline mode, and can be used in Ember CLI applications. | ||
[Online demo](http://sul.im/ember-cli-bootstrap-datepicker) | ||
## Installation | ||
If you are using Ember CLI 0.1.5 and higher, just run within your project directory: | ||
```bash | ||
ember install:addon ember-cli-bootstrap-datepicker | ||
``` | ||
When your Ember CLI version is below 0.1.5, please run within your project directory: | ||
```bash | ||
npm install --save-dev ember-cli-bootstrap-datepicker | ||
@@ -16,2 +26,4 @@ ember generate bootstrap-datepicker | ||
Basic example: | ||
```handlebars | ||
@@ -21,63 +33,164 @@ {{bootstrap-datepicker value=expiresAt}} | ||
The component supports many options of the bootstrap-datepicker library: | ||
Use separate component for inline mode: | ||
* **autoclose**, default value `true` | ||
* **format**, default value `dd.mm.yyyy` | ||
* **language**, default value `en` | ||
* **todayBtn**, default value `false` | ||
* **todayHighlight**, default value `false` | ||
* **weekStart**, default value 1 (Monday) | ||
```handlebars | ||
{{bootstrap-datepicker-inline value=expiresAt}} | ||
``` | ||
Let me show you how to use all these options. | ||
The component supports many options of the bootstrap-datepicker library. Let me show you how to use them :sparkles: | ||
Autoclose: | ||
### Available options | ||
#### autoclose | ||
Type: `Boolean` | ||
Default: `false` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt autoclose=false}} | ||
{{bootstrap-datepicker value=expiresAt autoclose=true}} | ||
``` | ||
Format: | ||
#### calendarWeeks | ||
Type: `Boolean` | ||
Default: `false` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt format="dd/mm/yy"}} | ||
{{bootstrap-datepicker value=expiresAt calendarWeeks=true}} | ||
``` | ||
language: | ||
#### clearBtn | ||
Default locale is `en`. When you need another language, you should import a locale file, e.g. | ||
Type: `Boolean` | ||
Default: `false` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt clearBtn=true}} | ||
``` | ||
#### daysOfWeekDisabled | ||
Type: `Array` or `String` | ||
Default: `""` or `[]` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt daysOfWeekDisabled="1,2"}} | ||
``` | ||
#### endDate | ||
Type: `Date` or `String` | ||
Default: `Infinity` (end of time) | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt endDate="01/01/2018"}} | ||
``` | ||
#### forceParse | ||
Type: `Boolean` | ||
Default: `true` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt forceParse=false}} | ||
``` | ||
#### format | ||
Type: `String` | ||
Default: `'mm/dd/yyyy'` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt format="dd.mm.yy"}} | ||
``` | ||
#### keyboardNavigation | ||
Type: `Boolean` | ||
Default: `true` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt keyboardNavigation=false}} | ||
``` | ||
#### language | ||
Type: `String` | ||
Default: `'en'` | ||
When you need another language, you should import a locale file using your Brocfile.js. Just import `bower_components/bootstrap-datepicker/js/locales/bootstrap-datepicker.<LANGUAGE_CODE>.js`, e.g.: | ||
```javascript | ||
// Brocfile.js | ||
app.import('bower_components/bootstrap-datepicker/js/locales/bootstrap-datepicker.de.js'); | ||
``` | ||
```handlebars | ||
{{! somewhere in template }} | ||
{{bootstrap-datepicker value=expiresAt language="de"}} | ||
``` | ||
todayBtn: | ||
#### minViewMode | ||
Type: `Number` or `String` | ||
Default: `0` or `'days'` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt todayBtn=true}} | ||
{{bootstrap-datepicker value=expiresAt minViewMode="months"}} | ||
``` | ||
todayHighlight: | ||
#### orientation | ||
Type: `String` | ||
Default: `'auto'` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt todayHighlight=true}} | ||
{{bootstrap-datepicker value=expiresAt orientation="right"}} | ||
``` | ||
weekStart: | ||
#### startDate | ||
Type: `Date` or `String` | ||
Default: `-Infinity` (beginning of time) | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt weekStart=0}} | ||
{{bootstrap-datepicker value=expiresAt startDate="01/01/2014"}} | ||
``` | ||
All options at once: | ||
#### startView | ||
Type: `Number` or `String` | ||
Default: `0` or `'month'` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt autoclose=false format="dd/mm/yy" language="de" todayBtn=true todayHighlight=true weekStart=0}} | ||
{{bootstrap-datepicker value=expiresAt startView="decade"}} | ||
``` | ||
#### todayBtn | ||
Type: `Boolean` | ||
Default: `false` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt todayBtn=true}} | ||
``` | ||
#### todayHighlight | ||
Type: `Boolean` | ||
Default: `false` | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt todayHighlight=true}} | ||
``` | ||
#### weekStart | ||
Type: `Number` | ||
Default: `0` (Sunday) | ||
```handlebars | ||
{{bootstrap-datepicker value=expiresAt weekStart=1}} | ||
``` | ||
## Contributing | ||
@@ -90,1 +203,10 @@ | ||
5. Create a new Pull Request | ||
## Credits | ||
The add-on is based on [bootstrap-datepicker](https://github.com/eternicode/bootstrap-datepicker). | ||
## License | ||
[MIT License](https://github.com/soulim/ember-cli-bootstrap-datepicker/blob/master/LICENSE.md) |
@@ -24,6 +24,6 @@ /* jshint node: true */ | ||
// ENV.APP.LOG_RESOLVER = true; | ||
ENV.APP.LOG_ACTIVE_GENERATION = true; | ||
// ENV.APP.LOG_ACTIVE_GENERATION = true; | ||
// ENV.APP.LOG_TRANSITIONS = true; | ||
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true; | ||
ENV.APP.LOG_VIEW_LOOKUPS = true; | ||
// ENV.APP.LOG_VIEW_LOOKUPS = true; | ||
} | ||
@@ -34,3 +34,3 @@ | ||
ENV.baseURL = '/'; | ||
ENV.locationType = 'auto'; | ||
ENV.locationType = 'none'; | ||
@@ -45,3 +45,3 @@ // keep test console output quieter | ||
if (environment === 'production') { | ||
ENV.baseURL = '/ember-cli-bootstrap-datepicker/'; | ||
} | ||
@@ -48,0 +48,0 @@ |
@@ -1,3 +0,2 @@ | ||
# robotstxt.org/ | ||
# http://www.robotstxt.org | ||
User-agent: * |
@@ -7,3 +7,3 @@ import Ember from 'ember'; | ||
export default function startApp(attrs) { | ||
var App; | ||
var application; | ||
@@ -13,15 +13,9 @@ var attributes = Ember.merge({}, config.APP); | ||
Router.reopen({ | ||
location: 'none' | ||
}); | ||
Ember.run(function() { | ||
App = Application.create(attributes); | ||
App.setupForTesting(); | ||
App.injectTestHelpers(); | ||
application = Application.create(attributes); | ||
application.setupForTesting(); | ||
application.injectTestHelpers(); | ||
}); | ||
App.reset(); // this shouldn't be needed, i want to be able to "start an app at a specific URL" | ||
return App; | ||
return application; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38320
58
377
209
13
1