Skip to content

Commit

Permalink
Support global icon overrides. Closes #12.
Browse files Browse the repository at this point in the history
  • Loading branch information
btecu committed Jun 27, 2016
1 parent 0d52844 commit 0e03455
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
22 changes: 21 additions & 1 deletion README.md
Expand Up @@ -83,16 +83,36 @@ Accepts: `string`
See [momentjs'](http://momentjs.com/docs/#/displaying/format/) docs for valid formats. Format also dictates what components are shown, e.g. `MM/dd/YYYY` will not display the time picker.



#### iconClasses, iconText

Defaults: `glyphicon glyphicon-calendar`, '‌'
Defaults: `glyphicon glyphicon-calendar`, ''

Accepts: `string`

```handlebars
{{bs-datetimepicker iconClasses='material-icons' iconText='face'}}
```

Replaces the calendar icon class and text.


#### icons

Defaults: `component defaults`

```js
'ember-cli-bootstrap-datetimepicker': {
icons: {
next: 'chevron right',
previous: 'chevron left'
}
}
```

Replaces icon classes globally.
Supported icons include `clear`, `close`, `date`, `down`, `next`, `previous`, `time`, `today` and `up`.



#### locale
Expand Down
13 changes: 13 additions & 0 deletions addon/components/bs-datetimepicker.js
Expand Up @@ -17,10 +17,23 @@ export default Component.extend({
this._super(...arguments);
let { defaults } = $.fn.datetimepicker;

let icons = {
clear: this.getWithDefault('config.icons.clear', defaults.icons.clear),
close: this.getWithDefault('config.icons.close', defaults.icons.close),
date: this.getWithDefault('config.icons.date', defaults.icons.date),
down: this.getWithDefault('config.icons.down', defaults.icons.down),
next: this.getWithDefault('config.icons.next', defaults.icons.next),
previous: this.getWithDefault('config.icons.previous', defaults.icons.previous),
time: this.getWithDefault('config.icons.time', defaults.icons.time),
today: this.getWithDefault('config.icons.today', defaults.icons.today),
up: this.getWithDefault('config.icons.up', defaults.icons.up)
};

this.$().datetimepicker({
date: this.getWithDefault('date', defaults.defaultDate),
focusOnShow: this.getWithDefault('focusOnShow', defaults.focusOnShow),
format: this.getWithDefault('format', defaults.format),
icons,
locale: this.getWithDefault('locale', defaults.locale),
maxDate: this.getWithDefault('maxDate', defaults.maxDate),
minDate: this.getWithDefault('minDate', defaults.minDate),
Expand Down
7 changes: 6 additions & 1 deletion app/components/bs-datetimepicker.js
@@ -1 +1,6 @@
export { default } from 'ember-cli-bootstrap-datetimepicker/components/bs-datetimepicker';
import DateTimePicker from 'ember-cli-bootstrap-datetimepicker/components/bs-datetimepicker';
import ENV from '../config/environment';

export default DateTimePicker.extend({
config: ENV['ember-cli-bootstrap-datetimepicker']
});

0 comments on commit 0e03455

Please sign in to comment.