discourse/app/assets/javascripts/select-kit/components/period-chooser.js.es6
Joffrey JAFFEUX f9648de897
DEV: upgrades from Ember 2.13 to Ember 3.5.1 (#6808)
Co-Authored-By: Bianca Nenciu <nbianca@users.noreply.github.com>
Co-Authored-By: David Taylor <david@taylorhq.com>
2019-01-10 11:06:01 +01:00

35 lines
970 B
JavaScript

import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
import computed, { on } from "ember-addons/ember-computed-decorators";
export default DropdownSelectBoxComponent.extend({
classNames: ["period-chooser"],
rowComponent: "period-chooser/period-chooser-row",
headerComponent: "period-chooser/period-chooser-header",
content: Ember.computed.oneWay("site.periods"),
value: Ember.computed.alias("period"),
isHidden: Ember.computed.alias("showPeriods"),
@computed("isExpanded")
caretIcon(isExpanded) {
return isExpanded ? "caret-up" : "caret-down";
},
@on("didReceiveAttrs")
_setFullDay() {
this.get("headerComponentOptions").setProperties({
fullDay: this.get("fullDay")
});
this.get("rowComponentOptions").setProperties({
fullDay: this.get("fullDay")
});
},
actions: {
onSelect() {
if (this.action) {
this.action(this.get("computedValue"));
}
}
}
});