mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 03:19:10 +00:00
UX: Always show confirmation dialog when converting themes/components (#11953)
This commit is contained in:
parent
93c25070fa
commit
04dd4a75af
@ -369,25 +369,29 @@ export default Controller.extend({
|
||||
|
||||
switchType() {
|
||||
const relatives = this.get("model.component")
|
||||
? this.parentThemes
|
||||
? this.get("model.parentThemes")
|
||||
: this.get("model.childThemes");
|
||||
|
||||
let message = I18n.t(`${this.convertKey}_alert_generic`);
|
||||
|
||||
if (relatives && relatives.length > 0) {
|
||||
const names = relatives.map((relative) => relative.get("name"));
|
||||
bootbox.confirm(
|
||||
I18n.t(`${this.convertKey}_alert`, {
|
||||
relatives: names.join(", "),
|
||||
}),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
(result) => {
|
||||
if (result) {
|
||||
this.commitSwitchType();
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.commitSwitchType();
|
||||
message = I18n.t(`${this.convertKey}_alert`, {
|
||||
relatives: relatives
|
||||
.map((relative) => relative.get("name"))
|
||||
.join(", "),
|
||||
});
|
||||
}
|
||||
|
||||
bootbox.confirm(
|
||||
message,
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
(result) => {
|
||||
if (result) {
|
||||
this.commitSwitchType();
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
enableComponent() {
|
||||
|
@ -4127,7 +4127,9 @@ en:
|
||||
convert: "Convert"
|
||||
convert_component_alert: "Are you sure you want to convert this component to theme? It will be removed as a component from %{relatives}."
|
||||
convert_component_tooltip: "Convert this component to theme"
|
||||
convert_component_alert_generic: "Are you sure you want to convert this component to theme?"
|
||||
convert_theme_alert: "Are you sure you want to convert this theme to component? It will be removed as a parent from %{relatives}."
|
||||
convert_theme_alert_generic: "Are you sure you want to convert this theme to component?"
|
||||
convert_theme_tooltip: "Convert this theme to component"
|
||||
inactive_themes: "Inactive themes:"
|
||||
inactive_components: "Unused components:"
|
||||
|
Loading…
x
Reference in New Issue
Block a user