discourse/app/assets/javascripts/select-kit/components/period-chooser.js.es6
Sam c475905387 Improvements to new community dashboard
- Limit dashboard to yearly,quarterly,monthly,weekly
- Always prefer UTC full days for reporting
2018-05-09 18:06:13 +10:00

31 lines
926 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.alias("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() {
this.sendAction("action", this.get("computedValue"));
}
}
});