A platform for community discussion. Free, open, simple.
FEATURE: Warning when component is added and not assigned (#8482)
Krzysztof Kotlarek5e29ae3ef5f7
diff --git a/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6index b9712761e5b..cebdb192350 100644--- a/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6+++ b/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6@@ -324,6 +324,7 @@ export default Controller.extend({result => {if (result) {const model = this.model;+ model.setProperties({ recentlyInstalled: false });model.destroyRecord().then(() => {this.allThemes.removeObject(model);this.transitionToRoute("adminCustomizeThemes");diff --git a/app/assets/javascripts/admin/routes/admin-customize-themes-show.js.es6 b/app/assets/javascripts/admin/routes/admin-customize-themes-show.js.es6index 408917b57a7..5b9ce251697 100644--- a/app/assets/javascripts/admin/routes/admin-customize-themes-show.js.es6+++ b/app/assets/javascripts/admin/routes/admin-customize-themes-show.js.es6@@ -51,6 +51,23 @@ export default Route.extend({actions: {didTransition() {scrollTop();+ },+ willTransition(transition) {+ const model = this.controller.model;+ if (model.recentlyInstalled && !model.hasParents && model.component) {+ transition.abort();+ bootbox.confirm(+ I18n.t("admin.customize.theme.unsaved_parent_themes"),+ I18n.t("admin.customize.theme.discard"),+ I18n.t("admin.customize.theme.stay"),+ result => {+ if (!result) {+ this.controller.model.setProperties({ recentlyInstalled: false });+ transition.retry();+ }+ }+ );+ }}}});diff --git a/app/assets/javascripts/admin/routes/admin-customize-themes.js.es6 b/app/assets/javascripts/admin/routes/admin-customize-themes.js.es6index 7f7274ee0e2..7413057253c 100644--- a/app/assets/javascripts/admin/routes/admin-customize-themes.js.es6+++ b/app/assets/javascripts/admin/routes/admin-customize-themes.js.es6@@ -18,6 +18,7 @@ export default Route.extend({addTheme(theme) {this.refresh();+ theme.setProperties({ recentlyInstalled: true });this.transitionTo("adminCustomizeThemes.show", theme.get("id"));}}diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 148d47de8ee..1db21152703 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -3648,6 +3648,7 @@ en:upload: "Upload"select_component: "Select a component..."unsaved_changes_alert: "You haven't saved your changes yet, do you want to discard them and move on?"+ unsaved_parent_themes: "You haven't assigned the component to themes, do you want to move on?"discard: "Discard"stay: "Stay"css_html: "Custom CSS/HTML"