discourse/app/assets/javascripts/admin/addon/routes/admin-site-text-edit.js
Martin Brennan 23b7b42acd
DEV: Bump eslint-config-discourse (#14868)
Changes for 4f7aba06c0

Also fixes all of the object-shorthand violations in our JS code.
2021-11-10 09:31:41 +10:00

31 lines
721 B
JavaScript

import Route from "@ember/routing/route";
import { ajax } from "discourse/lib/ajax";
export default Route.extend({
queryParams: {
locale: { replace: true },
},
model(params) {
return ajax(
`/admin/customize/site_texts/${params.id}?locale=${params.locale}`
).then((result) => {
return this.store.createRecord("site-text", result.site_text);
});
},
setupController(controller, siteText) {
const locales = JSON.parse(this.siteSettings.available_locales);
const localeFullName = locales.find((locale) => {
return locale.value === controller.locale;
}).name;
controller.setProperties({
siteText,
saved: false,
localeFullName,
});
},
});