diff --git a/app/assets/javascripts/discourse/app/components/bulk-select-toggle.js b/app/assets/javascripts/discourse/app/components/bulk-select-toggle.js new file mode 100644 index 00000000000..80ddbc7decc --- /dev/null +++ b/app/assets/javascripts/discourse/app/components/bulk-select-toggle.js @@ -0,0 +1,17 @@ +import Component from "@ember/component"; +import { action } from "@ember/object"; +import { getOwner } from "discourse-common/lib/get-owner"; + +export default Component.extend({ + parentController: null, + + @action + toggleBulkSelect() { + const controller = getOwner(this).lookup( + `controller:${this.parentController}` + ); + const selection = controller.selected; + controller.toggleProperty("bulkSelectEnabled"); + selection.clear(); + }, +}); diff --git a/app/assets/javascripts/discourse/app/components/d-navigation.js b/app/assets/javascripts/discourse/app/components/d-navigation.js index 266bbf7c4d5..32f8756b42b 100644 --- a/app/assets/javascripts/discourse/app/components/d-navigation.js +++ b/app/assets/javascripts/discourse/app/components/d-navigation.js @@ -4,6 +4,7 @@ import NavItem from "discourse/models/nav-item"; import bootbox from "bootbox"; import discourseComputed from "discourse-common/utils/decorators"; import { NotificationLevels } from "discourse/lib/notification-levels"; +import { getOwner } from "discourse-common/lib/get-owner"; import { inject as service } from "@ember/service"; export default Component.extend(FilterModeMixin, { @@ -128,6 +129,17 @@ export default Component.extend(FilterModeMixin, { }); }, + @discourseComputed("filterType") + notCategoriesRoute(filterType) { + return filterType !== "categories"; + }, + + @discourseComputed() + canBulk() { + const controller = getOwner(this).lookup("controller:discovery/topics"); + return controller.canBulkSelect; + }, + actions: { changeCategoryNotificationLevel(notificationLevel) { this.category.setNotification(notificationLevel); diff --git a/app/assets/javascripts/discourse/app/components/topic-list.js b/app/assets/javascripts/discourse/app/components/topic-list.js index 74fe6518cfb..22b01c759d4 100644 --- a/app/assets/javascripts/discourse/app/components/topic-list.js +++ b/app/assets/javascripts/discourse/app/components/topic-list.js @@ -1,4 +1,4 @@ -import { alias, and, reads } from "@ember/object/computed"; +import { alias, and } from "@ember/object/computed"; import discourseComputed, { observes } from "discourse-common/utils/decorators"; import Component from "@ember/component"; import LoadMore from "discourse/mixins/load-more"; @@ -34,8 +34,6 @@ export default Component.extend(LoadMore, { return !!this.changeSort; }, - skipHeader: reads("site.mobileView"), - @discourseComputed("order") showLikes(order) { return order === "likes"; diff --git a/app/assets/javascripts/discourse/app/templates/components/bulk-select-toggle.hbs b/app/assets/javascripts/discourse/app/templates/components/bulk-select-toggle.hbs new file mode 100644 index 00000000000..4a48158dc45 --- /dev/null +++ b/app/assets/javascripts/discourse/app/templates/components/bulk-select-toggle.hbs @@ -0,0 +1 @@ + diff --git a/app/assets/javascripts/discourse/app/templates/components/d-navigation.hbs b/app/assets/javascripts/discourse/app/templates/components/d-navigation.hbs index 8b7151b7be3..2e793cfaa8b 100644 --- a/app/assets/javascripts/discourse/app/templates/components/d-navigation.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/d-navigation.hbs @@ -6,6 +6,9 @@ {{/unless}}