Skip to content

Commit 0e03455

Browse files
committed
Support global icon overrides. Closes #12.
1 parent 0d52844 commit 0e03455

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

README.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,36 @@ Accepts: `string`
8383
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.
8484

8585

86+
8687
#### iconClasses, iconText
8788

88-
Defaults: `glyphicon glyphicon-calendar`, '‌'
89+
Defaults: `glyphicon glyphicon-calendar`, ''
8990

9091
Accepts: `string`
9192

9293
```handlebars
9394
{{bs-datetimepicker iconClasses='material-icons' iconText='face'}}
9495
```
9596

97+
Replaces the calendar icon class and text.
98+
99+
100+
#### icons
101+
102+
Defaults: `component defaults`
103+
104+
```js
105+
'ember-cli-bootstrap-datetimepicker': {
106+
icons: {
107+
next: 'chevron right',
108+
previous: 'chevron left'
109+
}
110+
}
111+
```
112+
113+
Replaces icon classes globally.
114+
Supported icons include `clear`, `close`, `date`, `down`, `next`, `previous`, `time`, `today` and `up`.
115+
96116

97117

98118
#### locale

addon/components/bs-datetimepicker.js

+13
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,23 @@ export default Component.extend({
1717
this._super(...arguments);
1818
let { defaults } = $.fn.datetimepicker;
1919

20+
let icons = {
21+
clear: this.getWithDefault('config.icons.clear', defaults.icons.clear),
22+
close: this.getWithDefault('config.icons.close', defaults.icons.close),
23+
date: this.getWithDefault('config.icons.date', defaults.icons.date),
24+
down: this.getWithDefault('config.icons.down', defaults.icons.down),
25+
next: this.getWithDefault('config.icons.next', defaults.icons.next),
26+
previous: this.getWithDefault('config.icons.previous', defaults.icons.previous),
27+
time: this.getWithDefault('config.icons.time', defaults.icons.time),
28+
today: this.getWithDefault('config.icons.today', defaults.icons.today),
29+
up: this.getWithDefault('config.icons.up', defaults.icons.up)
30+
};
31+
2032
this.$().datetimepicker({
2133
date: this.getWithDefault('date', defaults.defaultDate),
2234
focusOnShow: this.getWithDefault('focusOnShow', defaults.focusOnShow),
2335
format: this.getWithDefault('format', defaults.format),
36+
icons,
2437
locale: this.getWithDefault('locale', defaults.locale),
2538
maxDate: this.getWithDefault('maxDate', defaults.maxDate),
2639
minDate: this.getWithDefault('minDate', defaults.minDate),

app/components/bs-datetimepicker.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
export { default } from 'ember-cli-bootstrap-datetimepicker/components/bs-datetimepicker';
1+
import DateTimePicker from 'ember-cli-bootstrap-datetimepicker/components/bs-datetimepicker';
2+
import ENV from '../config/environment';
3+
4+
export default DateTimePicker.extend({
5+
config: ENV['ember-cli-bootstrap-datetimepicker']
6+
});

0 commit comments

Comments
 (0)