FEATURE: adds a filter for all/unread/read on user's notifications page (#9535)

This commit is contained in:
Ahmed Gagan
2020-05-04 12:06:59 +05:30
committed by GitHub
parent 57fcea7709
commit 99abdf51cd
10 changed files with 132 additions and 7 deletions

View File

@@ -0,0 +1,25 @@
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
import { computed } from "@ember/object";
export default DropdownSelectBoxComponent.extend({
classNames: ["notifications-filter"],
content: computed(function() {
return [
{
id: "all",
label: I18n.t("user.user_notifications.filters.all")
},
{
id: "read",
label: I18n.t("user.user_notifications.filters.read")
},
{
id: "unread",
label: I18n.t("user.user_notifications.filters.unread")
}
];
}),
selectKitOptions: {
headerComponent: "notifications-filter/notifications-filter-header"
}
});

View File

@@ -0,0 +1,18 @@
import DropdownSelectBoxHeaderComponent from "select-kit/components/dropdown-select-box/dropdown-select-box-header";
import discourseComputed from "discourse-common/utils/decorators";
export default DropdownSelectBoxHeaderComponent.extend({
layoutName:
"select-kit/templates/components/notifications-filter/notifications-filter-header",
classNames: ["notifications-filter-header"],
@discourseComputed("value")
label(value) {
return `user.user_notifications.filters.${value}`;
},
@discourseComputed("selectKit.isExpanded")
caretIcon(isExpanded) {
return isExpanded ? "caret-up" : "caret-down";
}
});

View File

@@ -0,0 +1,7 @@
<label class="filter-text">
{{i18n "user.user_notifications.filters.filter_by"}}
</label>
<label class="header-text">
{{i18n label}}
</label>
{{d-icon caretIcon class="caret-icon"}}