DEV: Fix passing translatedTitle as argument to flat-button (#29663)

Overriding computed properties with arguments is no longer supported by Ember, so we need to rename this computed property and add fallback logic manually.

This fixes the styleguide 'buttons' page. Ref https://meta.discourse.org/t/styleguide-bugs/335211?u=david
This commit is contained in:
David Taylor
2024-11-08 18:46:05 +00:00
committed by GitHub
parent 698571e24b
commit 3a23ff98bc

View File

@@ -9,12 +9,14 @@ import I18n from "discourse-i18n";
@tagName("button")
@classNames("btn-flat")
@attributeBindings("disabled", "translatedTitle:title")
@attributeBindings("disabled", "resolvedTitle:title")
export default class FlatButton extends Component {
@discourseComputed("title")
translatedTitle(title) {
@discourseComputed("title", "translatedTitle")
resolvedTitle(title, translatedTitle) {
if (title) {
return I18n.t(title);
} else if (translatedTitle) {
return translatedTitle;
}
}