DEV: Add `topic-list-header-sortable-column` transformer (#29917)
For conditionally disabling ability to sort on specific columns in the topic list.
This commit is contained in:
parent
a2c8177a4c
commit
2f932812e0
|
@ -1,8 +1,15 @@
|
|||
import { hash } from "@ember/helper";
|
||||
import { applyValueTransformer } from "discourse/lib/transformer";
|
||||
|
||||
const Header = <template>
|
||||
<tr>
|
||||
{{#each @columns as |entry|}}
|
||||
<entry.value.header
|
||||
@sortable={{@sortable}}
|
||||
@sortable={{applyValueTransformer
|
||||
"topic-list-header-sortable-column"
|
||||
@sortable
|
||||
(hash category=@category name=@name)
|
||||
}}
|
||||
@activeOrder={{@order}}
|
||||
@changeSort={{@changeSort}}
|
||||
@ascending={{@ascending}}
|
||||
|
|
|
@ -121,10 +121,6 @@ export default class TopicList extends Component {
|
|||
return !this.bulkSelectEnabled && this.args.canBulkSelect;
|
||||
}
|
||||
|
||||
get sortable() {
|
||||
return !!this.args.changeSort;
|
||||
}
|
||||
|
||||
get showTopicPostBadges() {
|
||||
return this.args.showTopicPostBadges ?? true;
|
||||
}
|
||||
|
@ -189,7 +185,7 @@ export default class TopicList extends Component {
|
|||
@order={{@order}}
|
||||
@changeSort={{@changeSort}}
|
||||
@ascending={{@ascending}}
|
||||
@sortable={{this.sortable}}
|
||||
@sortable={{@changeSort}}
|
||||
@listTitle={{or @listTitle "topic.title"}}
|
||||
@bulkSelectHelper={{@bulkSelectHelper}}
|
||||
@bulkSelectEnabled={{this.bulkSelectEnabled}}
|
||||
|
|
|
@ -16,4 +16,5 @@ export const VALUE_TRANSFORMERS = Object.freeze([
|
|||
"post-menu-buttons",
|
||||
"small-user-attrs",
|
||||
"topic-list-columns",
|
||||
"topic-list-header-sortable-column",
|
||||
]);
|
||||
|
|
Loading…
Reference in New Issue