DEV: Modernise navigation controllers (#22982)
Converts to native class syntax, native getters, and removes unused properties
This commit is contained in:
parent
ae95260645
commit
f9361b9eda
|
@ -1,6 +1,6 @@
|
|||
import NavigationDefaultController from "discourse/controllers/navigation/default";
|
||||
import { inject as controller } from "@ember/controller";
|
||||
|
||||
export default NavigationDefaultController.extend({
|
||||
discoveryCategories: controller("discovery/categories"),
|
||||
});
|
||||
export default class NavigationCategoriesController extends NavigationDefaultController {
|
||||
@controller("discovery/categories") discoveryCategories;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
import { and, none } from "@ember/object/computed";
|
||||
import FilterModeMixin from "discourse/mixins/filter-mode";
|
||||
import NavigationDefaultController from "discourse/controllers/navigation/default";
|
||||
|
||||
export default NavigationDefaultController.extend(FilterModeMixin, {
|
||||
showingParentCategory: none("category.parentCategory"),
|
||||
showingSubcategoryList: and(
|
||||
"category.show_subcategory_list",
|
||||
"showingParentCategory"
|
||||
),
|
||||
});
|
||||
export default class NavigationCategoryController extends NavigationDefaultController.extend(
|
||||
FilterModeMixin
|
||||
) {}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import { inject as service } from "@ember/service";
|
||||
import Controller, { inject as controller } from "@ember/controller";
|
||||
import FilterModeMixin from "discourse/mixins/filter-mode";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { TRACKED_QUERY_PARAM_VALUE } from "discourse/lib/topic-list-tracked-filter";
|
||||
|
||||
export default Controller.extend(FilterModeMixin, {
|
||||
discovery: controller(),
|
||||
router: service(),
|
||||
export default class NavigationDefaultController extends Controller.extend(
|
||||
FilterModeMixin
|
||||
) {
|
||||
@service router;
|
||||
@controller discovery;
|
||||
|
||||
@discourseComputed("router.currentRoute.queryParams.f")
|
||||
skipCategoriesNavItem(filterParamValue) {
|
||||
return filterParamValue === TRACKED_QUERY_PARAM_VALUE;
|
||||
},
|
||||
});
|
||||
get skipCategoriesNavItem() {
|
||||
return this.router.currentRoute.queryParams.f === TRACKED_QUERY_PARAM_VALUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import { action } from "@ember/object";
|
|||
import { bind } from "discourse-common/utils/decorators";
|
||||
import discourseDebounce from "discourse-common/lib/debounce";
|
||||
|
||||
export default class extends Controller {
|
||||
export default class NavigationFilterController extends Controller {
|
||||
@controller("discovery/filter") discoveryFilter;
|
||||
|
||||
@tracked copyIcon = "link";
|
||||
|
|
Loading…
Reference in New Issue