2018-01-15 18:55:16 +08:00
|
|
|
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
|
2019-11-08 05:38:28 +08:00
|
|
|
import discourseComputed, { on } from "discourse-common/utils/decorators";
|
2018-01-15 18:55:16 +08:00
|
|
|
|
|
|
|
export default DropdownSelectBoxComponent.extend({
|
|
|
|
classNames: ["period-chooser"],
|
|
|
|
rowComponent: "period-chooser/period-chooser-row",
|
|
|
|
headerComponent: "period-chooser/period-chooser-header",
|
2018-12-20 06:09:05 +08:00
|
|
|
content: Ember.computed.oneWay("site.periods"),
|
2018-01-15 18:55:16 +08:00
|
|
|
value: Ember.computed.alias("period"),
|
|
|
|
isHidden: Ember.computed.alias("showPeriods"),
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("isExpanded")
|
2018-03-22 18:29:55 +08:00
|
|
|
caretIcon(isExpanded) {
|
|
|
|
return isExpanded ? "caret-up" : "caret-down";
|
|
|
|
},
|
|
|
|
|
2019-05-10 23:12:10 +08:00
|
|
|
@on("didUpdateAttrs", "init")
|
2018-05-09 16:05:40 +08:00
|
|
|
_setFullDay() {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.headerComponentOptions.setProperties({
|
|
|
|
fullDay: this.fullDay
|
2018-06-15 23:03:24 +08:00
|
|
|
});
|
2019-05-27 16:15:39 +08:00
|
|
|
this.rowComponentOptions.setProperties({
|
|
|
|
fullDay: this.fullDay
|
2018-06-15 23:03:24 +08:00
|
|
|
});
|
2018-05-09 16:05:40 +08:00
|
|
|
},
|
|
|
|
|
2018-01-15 18:55:16 +08:00
|
|
|
actions: {
|
|
|
|
onSelect() {
|
2019-01-10 18:06:01 +08:00
|
|
|
if (this.action) {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.action(this.computedValue);
|
2019-01-10 18:06:01 +08:00
|
|
|
}
|
2018-01-15 18:55:16 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|