UX: Always show confirmation dialog when converting themes/components (#11953)

This commit is contained in:
Penar Musaraj 2021-02-03 11:45:25 -05:00 committed by GitHub
parent 93c25070fa
commit 04dd4a75af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 16 deletions

View File

@ -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() {

View File

@ -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:"