DEV: `controllers/admin-site-text-edit` to native class syntax (#28173)

This commit is contained in:
David Taylor 2024-07-31 17:37:24 +01:00 committed by GitHub
parent d4479eab73
commit fa6dbbed1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 11 deletions

View File

@ -6,20 +6,23 @@ import { bufferedProperty } from "discourse/mixins/buffered-content";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "discourse-i18n";
export default Controller.extend(bufferedProperty("siteText"), {
dialog: service(),
saved: false,
queryParams: ["locale"],
export default class AdminSiteTextEdit extends Controller.extend(
bufferedProperty("siteText")
) {
@service dialog;
saved = false;
queryParams = ["locale"];
@discourseComputed("buffered.value")
saveDisabled(value) {
return this.siteText.value === value;
},
}
@discourseComputed("siteText.status")
isOutdated(status) {
return status === "outdated";
},
}
@action
saveChanges() {
@ -33,7 +36,7 @@ export default Controller.extend(bufferedProperty("siteText"), {
this.set("saved", true);
})
.catch(popupAjaxError);
},
}
@action
revertChanges() {
@ -52,7 +55,7 @@ export default Controller.extend(bufferedProperty("siteText"), {
.catch(popupAjaxError);
},
});
},
}
@action
dismissOutdated() {
@ -62,9 +65,9 @@ export default Controller.extend(bufferedProperty("siteText"), {
this.siteText.set("status", "up_to_date");
})
.catch(popupAjaxError);
},
}
get interpolationKeys() {
return this.siteText.interpolation_keys.join(", ");
},
});
}
}