feedback (see commit description for details)

* fill blank space when no theme is selected
* animate row's height in themes/components list when selecting, and hide children list
* show warning when you move to a different page and have unsaved changes
* refactor `adminCustomizeThemes.show` controller
* allow collapsing/expanding children lists
* fix a bug when adding components to a theme (changed the way it works slightly)
* a bunch of other minor things
This commit is contained in:
OsamaSayegh
2018-09-06 21:56:00 +03:00
committed by Sam
parent a4f057a589
commit ca28548762
15 changed files with 372 additions and 208 deletions

View File

@@ -35,5 +35,29 @@ export default Ember.Route.extend({
controller.setTargetName(wrapper.target || "common");
controller.set("fieldName", wrapper.field_name || "scss");
this.controllerFor("adminCustomizeThemes").set("editingTheme", true);
this.set("shouldAlertUnsavedChanges", true);
},
actions: {
willTransition(transition) {
if (
this.get("controller.model.changed") &&
this.get("shouldAlertUnsavedChanges") &&
transition.intent.name !== this.routeName
) {
transition.abort();
bootbox.confirm(
I18n.t("admin.customize.theme.unsaved_changes_alert"),
I18n.t("admin.customize.theme.discard"),
I18n.t("admin.customize.theme.stay"),
result => {
if (!result) {
this.set("shouldAlertUnsavedChanges", false);
transition.retry();
}
}
);
}
}
}
});

View File

@@ -1,5 +1,25 @@
const externalResources = [
{
key: "admin.customize.theme.beginners_guide_title",
link: "https://meta.discourse.org/t/91966",
icon: "book"
},
{
key: "admin.customize.theme.developers_guide_title",
link: "https://meta.discourse.org/t/93648",
icon: "book"
},
{
key: "admin.customize.theme.browse_themes",
link: "https://meta.discourse.org/c/theme",
icon: "paint-brush"
}
];
export default Ember.Route.extend({
setupController() {
setupController(controller, model) {
this._super(...arguments);
this.controllerFor("adminCustomizeThemes").set("editingTheme", false);
controller.set("externalResources", externalResources);
}
});

View File

@@ -37,9 +37,11 @@ export default Ember.Route.extend({
},
handleHighlight(theme) {
this.get("controller.allThemes").forEach(t => t.set("active", false));
this.get("controller.allThemes")
.filter(t => t.get("selected"))
.forEach(t => t.set("selected", false));
if (theme) {
theme.set("active", true);
theme.set("selected", true);
}
},