DEV: Add additional hook for theme-creator

This commit is contained in:
David Taylor 2019-02-28 10:48:30 +00:00
parent 0cc636f648
commit 6296554ed1

View File

@ -114,6 +114,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
loading: false, loading: false,
keyGenUrl: "/admin/themes/generate_key_pair", keyGenUrl: "/admin/themes/generate_key_pair",
importUrl: "/admin/themes/import", importUrl: "/admin/themes/import",
recordType: "theme",
checkPrivate: Ember.computed.match("uploadUrl", /^git/), checkPrivate: Ember.computed.match("uploadUrl", /^git/),
localFile: null, localFile: null,
uploadUrl: null, uploadUrl: null,
@ -229,7 +230,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
installTheme() { installTheme() {
if (this.get("create")) { if (this.get("create")) {
this.set("loading", true); this.set("loading", true);
const theme = this.store.createRecord("theme"); const theme = this.store.createRecord(this.get("recordType"));
theme theme
.save({ name: this.get("name"), component: this.get("component") }) .save({ name: this.get("name"), component: this.get("component") })
.then(() => { .then(() => {
@ -272,7 +273,10 @@ export default Ember.Controller.extend(ModalFunctionality, {
this.set("loading", true); this.set("loading", true);
ajax(this.get("importUrl"), options) ajax(this.get("importUrl"), options)
.then(result => { .then(result => {
const theme = this.store.createRecord("theme", result.theme); const theme = this.store.createRecord(
this.get("recordType"),
result.theme
);
this.get("adminCustomizeThemes").send("addTheme", theme); this.get("adminCustomizeThemes").send("addTheme", theme);
this.send("closeModal"); this.send("closeModal");
}) })