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