discourse/app/assets/javascripts/admin/addon/routes/admin-site-text-index.js
David Taylor a60d7a2bc7
DEV: Modernize admin-site-text route/controller (#23581)
- Switch to `@tracked` and native getters
- Remove queryParam defaults which are awkward to work with. Instead, add `resolvedBlah` getters
- Add 'no results found' text
- Use standard 'model' key instead of a custom `setupController` method
- Remove use of `route-action`
- Remove `{{action` helper

Default queryParams in ember controllers are tricky to work with, especially when combined with the new router service. Instead, we can handle defaults ourselves
2023-09-14 11:27:09 +01:00

26 lines
701 B
JavaScript

import Route from "@ember/routing/route";
import { disableImplicitInjections } from "discourse/lib/implicit-injections";
import { inject as service } from "@ember/service";
@disableImplicitInjections
export default class AdminSiteTextIndexRoute extends Route {
@service siteSettings;
@service store;
queryParams = {
q: { replace: true },
overridden: { replace: true },
outdated: { replace: true },
locale: { replace: true },
};
model(params) {
return this.store.find("site-text", {
q: params.q,
overridden: params.overridden ?? false,
outdated: params.outdated ?? false,
locale: params.locale ?? this.siteSettings.default_locale,
});
}
}