mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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>
|
const Header = <template>
|
||||||
<tr>
|
<tr>
|
||||||
{{#each @columns as |entry|}}
|
{{#each @columns as |entry|}}
|
||||||
<entry.value.header
|
<entry.value.header
|
||||||
@sortable={{@sortable}}
|
@sortable={{applyValueTransformer
|
||||||
|
"topic-list-header-sortable-column"
|
||||||
|
@sortable
|
||||||
|
(hash category=@category name=@name)
|
||||||
|
}}
|
||||||
@activeOrder={{@order}}
|
@activeOrder={{@order}}
|
||||||
@changeSort={{@changeSort}}
|
@changeSort={{@changeSort}}
|
||||||
@ascending={{@ascending}}
|
@ascending={{@ascending}}
|
||||||
|
@ -121,10 +121,6 @@ export default class TopicList extends Component {
|
|||||||
return !this.bulkSelectEnabled && this.args.canBulkSelect;
|
return !this.bulkSelectEnabled && this.args.canBulkSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
get sortable() {
|
|
||||||
return !!this.args.changeSort;
|
|
||||||
}
|
|
||||||
|
|
||||||
get showTopicPostBadges() {
|
get showTopicPostBadges() {
|
||||||
return this.args.showTopicPostBadges ?? true;
|
return this.args.showTopicPostBadges ?? true;
|
||||||
}
|
}
|
||||||
@ -189,7 +185,7 @@ export default class TopicList extends Component {
|
|||||||
@order={{@order}}
|
@order={{@order}}
|
||||||
@changeSort={{@changeSort}}
|
@changeSort={{@changeSort}}
|
||||||
@ascending={{@ascending}}
|
@ascending={{@ascending}}
|
||||||
@sortable={{this.sortable}}
|
@sortable={{@changeSort}}
|
||||||
@listTitle={{or @listTitle "topic.title"}}
|
@listTitle={{or @listTitle "topic.title"}}
|
||||||
@bulkSelectHelper={{@bulkSelectHelper}}
|
@bulkSelectHelper={{@bulkSelectHelper}}
|
||||||
@bulkSelectEnabled={{this.bulkSelectEnabled}}
|
@bulkSelectEnabled={{this.bulkSelectEnabled}}
|
||||||
|
@ -16,4 +16,5 @@ export const VALUE_TRANSFORMERS = Object.freeze([
|
|||||||
"post-menu-buttons",
|
"post-menu-buttons",
|
||||||
"small-user-attrs",
|
"small-user-attrs",
|
||||||
"topic-list-columns",
|
"topic-list-columns",
|
||||||
|
"topic-list-header-sortable-column",
|
||||||
]);
|
]);
|
||||||
|
Loading…
Reference in New Issue
Block a user