ensure pikaday respects our color scheme

This commit is contained in:
Régis Hanol
2016-04-21 20:56:12 +02:00
parent ee7ef46b9e
commit ded03a1aa4
5 changed files with 62 additions and 38 deletions

View File

@@ -9,24 +9,28 @@ export default Em.Component.extend({
@on("didInsertElement")
_loadDatePicker() {
const input = this.$(".date-picker")[0];
const container = $("#" + this.get("containerId"))[0];
loadScript("/javascripts/pikaday.js").then(() => {
let default_opts = {
field: input,
container: this.$()[0],
format: "YYYY-MM-DD",
firstDay: moment.localeData().firstDayOfWeek(),
i18n: {
previousMonth: I18n.t('dates.previous_month'),
nextMonth: I18n.t('dates.next_month'),
months: moment.months(),
weekdays: moment.weekdays(),
weekdaysShort: moment.weekdaysShort()
},
onSelect: date => this.set("value", moment(date).format("YYYY-MM-DD"))
};
Ember.run.next(() => {
let default_opts = {
field: input,
container: container || this.$()[0],
bound: container === undefined,
format: "YYYY-MM-DD",
firstDay: moment.localeData().firstDayOfWeek(),
i18n: {
previousMonth: I18n.t('dates.previous_month'),
nextMonth: I18n.t('dates.next_month'),
months: moment.months(),
weekdays: moment.weekdays(),
weekdaysShort: moment.weekdaysShort()
},
onSelect: date => this.set("value", moment(date).format("YYYY-MM-DD"))
};
this._picker = new Pikaday(_.merge(default_opts, this._opts()));
this._picker = new Pikaday(_.merge(default_opts, this._opts()));
});
});
},

View File

@@ -1 +1 @@
<input class="date-picker">
<input type="text" class="date-picker">

View File

@@ -1,4 +1,4 @@
<div class="modal-body">
<div class="modal-body change-timestamp">
<p>
{{i18n 'topic.change_timestamp.instructions'}}
</p>
@@ -8,9 +8,11 @@
</p>
<form>
{{input type="date" value=date}}
{{date-picker-past value=date containerId="date-container"}}
{{input type="time" value=time}}
</form>
<div id="date-container" />
</div>
<div class="modal-footer">