From ded03a1aa4ebf72d73187e7214f72fc57a9a8dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 21 Apr 2016 20:56:12 +0200 Subject: [PATCH] ensure pikaday respects our color scheme --- .../discourse/components/date-picker.js.es6 | 34 ++++++++------- .../templates/components/date-picker.hbs | 2 +- .../templates/modal/change-timestamp.hbs | 6 ++- app/assets/stylesheets/desktop/modal.scss | 16 +++++++ app/assets/stylesheets/vendor/pikaday.scss | 42 ++++++++++--------- 5 files changed, 62 insertions(+), 38 deletions(-) diff --git a/app/assets/javascripts/discourse/components/date-picker.js.es6 b/app/assets/javascripts/discourse/components/date-picker.js.es6 index 21825d2ed8c..ea86648784a 100644 --- a/app/assets/javascripts/discourse/components/date-picker.js.es6 +++ b/app/assets/javascripts/discourse/components/date-picker.js.es6 @@ -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())); + }); }); }, diff --git a/app/assets/javascripts/discourse/templates/components/date-picker.hbs b/app/assets/javascripts/discourse/templates/components/date-picker.hbs index 7d9e48080a7..a2c89401aba 100644 --- a/app/assets/javascripts/discourse/templates/components/date-picker.hbs +++ b/app/assets/javascripts/discourse/templates/components/date-picker.hbs @@ -1 +1 @@ - + diff --git a/app/assets/javascripts/discourse/templates/modal/change-timestamp.hbs b/app/assets/javascripts/discourse/templates/modal/change-timestamp.hbs index c76c58e1241..5114bd9cf96 100644 --- a/app/assets/javascripts/discourse/templates/modal/change-timestamp.hbs +++ b/app/assets/javascripts/discourse/templates/modal/change-timestamp.hbs @@ -1,4 +1,4 @@ -