mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 21:35:48 +08:00
1a2b9435b0
* DEV: Standardize table sorting verbiage This commit creates a common component that tables can use to make their headers sortable. This commit also standardizes on using `desc` as the default and passing in the `asc=true` flag to adjust the sorting direction. * Add deprecation warnings Adds deprecation warnings if using previous params and maintains backwards compatibility. Set the default sort value for group members to be asc. * switch group requests to use common table-header-toggle * update fixture
31 lines
894 B
JavaScript
31 lines
894 B
JavaScript
import DiscourseRoute from "discourse/routes/discourse";
|
|
|
|
export default DiscourseRoute.extend({
|
|
queryParams: {
|
|
order: { refreshModel: true },
|
|
asc: { refreshModel: true }
|
|
},
|
|
|
|
// TODO: this has been introduced to fix a bug in admin-users-list-show
|
|
// loading AdminUser model multiple times without refactoring the controller
|
|
beforeModel(transition) {
|
|
const routeName = "adminUsersList.show";
|
|
|
|
if (transition.targetName === routeName) {
|
|
const params = transition.routeInfos.find(a => a.name === routeName)
|
|
.params;
|
|
const controller = this.controllerFor(routeName);
|
|
if (controller) {
|
|
controller.setProperties({
|
|
order: transition.to.queryParams.order,
|
|
asc: transition.to.queryParams.asc,
|
|
query: params.filter,
|
|
refreshing: false
|
|
});
|
|
|
|
controller.resetFilters();
|
|
}
|
|
}
|
|
}
|
|
});
|