mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Allow date-picker component to be extended with custom options.
This commit is contained in:
parent
65e808b26d
commit
4f9eb0fc67
1 changed files with 9 additions and 3 deletions
|
@ -12,13 +12,15 @@ export default Em.Component.extend({
|
||||||
const input = this.$()[0];
|
const input = this.$()[0];
|
||||||
|
|
||||||
loadScript("/javascripts/pikaday.js").then(() => {
|
loadScript("/javascripts/pikaday.js").then(() => {
|
||||||
this._picker = new Pikaday({
|
const default_opts = {
|
||||||
field: input,
|
field: input,
|
||||||
format: "YYYY-MM-DD",
|
format: "YYYY-MM-DD",
|
||||||
defaultDate: moment().add(1, "day").toDate(),
|
defaultDate: moment().add(1, "day").toDate(),
|
||||||
minDate: new Date(),
|
minDate: new Date(),
|
||||||
onSelect: date => this.set("value", moment(date).format("YYYY-MM-DD")),
|
onSelect: date => this.set("value", moment(date).format("YYYY-MM-DD"))
|
||||||
});
|
};
|
||||||
|
|
||||||
|
this._picker = new Pikaday(Object.assign(default_opts, this._opts()));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -27,4 +29,8 @@ export default Em.Component.extend({
|
||||||
this._picker = null;
|
this._picker = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_opts: function() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue