2019-10-23 12:39:32 -04:00
|
|
|
import Route from "@ember/routing/route";
|
2017-04-12 10:52:52 -04:00
|
|
|
import showModal from "discourse/lib/show-modal";
|
2021-01-11 10:29:12 -05:00
|
|
|
import { showUnassignedComponentWarning } from "admin/routes/admin-customize-themes-show";
|
2017-04-12 10:52:52 -04:00
|
|
|
|
2019-10-23 12:39:32 -04:00
|
|
|
export default Route.extend({
|
2017-04-12 10:52:52 -04:00
|
|
|
model() {
|
|
|
|
return this.store.findAll("theme");
|
|
|
|
},
|
|
|
|
|
|
|
|
setupController(controller, model) {
|
|
|
|
this._super(controller, model);
|
|
|
|
controller.set("editingTheme", false);
|
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
2019-02-20 14:58:31 -05:00
|
|
|
installModal() {
|
2021-01-11 10:29:12 -05:00
|
|
|
const currentTheme = this.controllerFor("adminCustomizeThemes.show")
|
|
|
|
.model;
|
|
|
|
if (currentTheme && currentTheme.warnUnassignedComponent) {
|
|
|
|
showUnassignedComponentWarning(currentTheme, (result) => {
|
|
|
|
if (!result) {
|
|
|
|
showModal("admin-install-theme", { admin: true });
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
showModal("admin-install-theme", { admin: true });
|
|
|
|
}
|
2017-04-12 10:52:52 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
addTheme(theme) {
|
2019-01-31 14:29:09 -05:00
|
|
|
this.refresh();
|
2019-12-09 16:43:26 -05:00
|
|
|
theme.setProperties({ recentlyInstalled: true });
|
2017-04-12 10:52:52 -04:00
|
|
|
this.transitionTo("adminCustomizeThemes.show", theme.get("id"));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|