DEV: Make filterModes obsolete

This mixin handles the translation between old filterModes and new
filterTypes. filterModes have context information, filterTypes do not.
This commit is contained in:
Daniel Waterworth 2019-11-21 10:33:40 +00:00
parent 3d1b6b6729
commit a8d58c3b21
7 changed files with 14 additions and 7 deletions

View File

@ -2,8 +2,9 @@ import discourseComputed from "discourse-common/utils/decorators";
import NavItem from "discourse/models/nav-item";
import { inject as service } from "@ember/service";
import Component from "@ember/component";
import FilterModeMixin from "discourse/mixins/filter-mode";
export default Component.extend({
export default Component.extend(FilterModeMixin, {
router: service(),
persistedQueryParams: null,

View File

@ -6,8 +6,9 @@ import {
} from "discourse-common/utils/decorators";
import DiscourseURL from "discourse/lib/url";
import { renderedConnectorsFor } from "discourse/lib/plugin-connectors";
import FilterModeMixin from "discourse/mixins/filter-mode";
export default Component.extend({
export default Component.extend(FilterModeMixin, {
tagName: "ul",
classNameBindings: [":nav", ":nav-pills"],
elementId: "navigation-bar",

View File

@ -1,8 +1,10 @@
import discourseComputed from "discourse-common/utils/decorators";
import Component from "@ember/component";
import { bufferedRender } from "discourse-common/lib/buffered-render";
import FilterModeMixin from "discourse/mixins/filter-mode";
export default Component.extend(
FilterModeMixin,
bufferedRender({
tagName: "li",
classNameBindings: [

View File

@ -1,7 +1,8 @@
import { none, and } from "@ember/object/computed";
import NavigationDefaultController from "discourse/controllers/navigation/default";
import FilterModeMixin from "discourse/mixins/filter-mode";
export default NavigationDefaultController.extend({
export default NavigationDefaultController.extend(FilterModeMixin, {
showingParentCategory: none("category.parentCategory"),
showingSubcategoryList: and(
"category.show_subcategory_list",

View File

@ -1,8 +1,9 @@
import discourseComputed from "discourse-common/utils/decorators";
import { inject } from "@ember/controller";
import Controller from "@ember/controller";
import FilterModeMixin from "discourse/mixins/filter-mode";
export default Controller.extend({
export default Controller.extend(FilterModeMixin, {
discovery: inject(),
discoveryTopics: inject("discovery/topics"),

View File

@ -7,15 +7,15 @@ import {
} from "discourse-common/utils/decorators";
import BulkTopicSelection from "discourse/mixins/bulk-topic-selection";
import { default as NavItem } from "discourse/models/nav-item";
import FilterModeMixin from "discourse/mixins/filter-mode";
export default Controller.extend(BulkTopicSelection, {
export default Controller.extend(BulkTopicSelection, FilterModeMixin, {
application: inject(),
tag: null,
additionalTags: null,
list: null,
canAdminTag: alias("currentUser.staff"),
filterMode: null,
navMode: "latest",
loading: false,
canCreateTopic: false,

View File

@ -8,8 +8,9 @@ import {
import { queryParams } from "discourse/controllers/discovery-sortable";
import PermissionType from "discourse/models/permission-type";
import Category from "discourse/models/category";
import FilterModeMixin from "discourse/mixins/filter-mode";
export default DiscourseRoute.extend({
export default DiscourseRoute.extend(FilterModeMixin, {
navMode: "latest",
queryParams,