2020-05-14 04:23:41 +08:00
|
|
|
import I18n from "I18n";
|
2019-11-02 01:06:50 +08:00
|
|
|
import { makeArray } from "discourse-common/lib/helpers";
|
2019-11-28 13:19:01 +08:00
|
|
|
import {
|
|
|
|
empty,
|
|
|
|
filterBy,
|
|
|
|
match,
|
|
|
|
mapBy,
|
|
|
|
notEmpty,
|
|
|
|
} from "@ember/object/computed";
|
2019-10-24 01:06:54 +08:00
|
|
|
import Controller from "@ember/controller";
|
2020-01-17 01:56:53 +08:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2017-04-12 22:52:52 +08:00
|
|
|
import { url } from "discourse/lib/computed";
|
2017-04-18 04:55:53 +08:00
|
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
2017-05-10 05:20:28 +08:00
|
|
|
import showModal from "discourse/lib/show-modal";
|
2018-03-05 08:04:23 +08:00
|
|
|
import ThemeSettings from "admin/models/theme-settings";
|
2018-08-31 03:23:15 +08:00
|
|
|
import { THEMES, COMPONENTS } from "admin/models/theme";
|
2020-02-06 00:14:42 +08:00
|
|
|
import EmberObject from "@ember/object";
|
2020-08-27 00:57:13 +08:00
|
|
|
import bootbox from "bootbox";
|
2017-05-10 05:20:28 +08:00
|
|
|
|
|
|
|
const THEME_UPLOAD_VAR = 2;
|
2017-04-12 22:52:52 +08:00
|
|
|
|
2019-10-24 01:06:54 +08:00
|
|
|
export default Controller.extend({
|
2019-01-23 22:40:21 +08:00
|
|
|
downloadUrl: url("model.id", "/admin/customize/themes/%@/export"),
|
2018-09-07 02:56:00 +08:00
|
|
|
previewUrl: url("model.id", "/admin/themes/%@/preview"),
|
2019-10-31 04:28:29 +08:00
|
|
|
addButtonDisabled: empty("selectedChildThemeId"),
|
2018-10-11 20:20:04 +08:00
|
|
|
editRouteName: "adminCustomizeThemes.edit",
|
2019-11-28 13:19:01 +08:00
|
|
|
parentThemesNames: mapBy("model.parentThemes", "name"),
|
|
|
|
availableParentThemes: filterBy("allThemes", "component", false),
|
2019-12-04 14:13:41 +08:00
|
|
|
availableActiveParentThemes: filterBy("availableParentThemes", "isActive"),
|
2019-11-28 13:19:01 +08:00
|
|
|
availableThemesNames: mapBy("availableParentThemes", "name"),
|
2019-12-04 14:13:41 +08:00
|
|
|
availableActiveThemesNames: mapBy("availableActiveParentThemes", "name"),
|
|
|
|
availableActiveChildThemes: filterBy("availableChildThemes", "hasParents"),
|
|
|
|
availableComponentsNames: mapBy("availableChildThemes", "name"),
|
|
|
|
availableActiveComponentsNames: mapBy("availableActiveChildThemes", "name"),
|
|
|
|
childThemesNames: mapBy("model.childThemes", "name"),
|
2020-04-30 22:02:38 +08:00
|
|
|
extraFiles: filterBy("model.theme_fields", "target", "extra_js"),
|
2018-08-08 12:46:34 +08:00
|
|
|
|
2020-11-16 20:44:09 +08:00
|
|
|
@discourseComputed("model.component", "model.remote_theme")
|
|
|
|
showCheckboxes() {
|
|
|
|
return !this.model.component || this.model.remote_theme;
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("model.editedFields")
|
2018-09-08 21:24:11 +08:00
|
|
|
editedFieldsFormatted() {
|
2018-09-07 02:56:00 +08:00
|
|
|
const descriptions = [];
|
2018-03-06 06:26:50 +08:00
|
|
|
["common", "desktop", "mobile"].forEach((target) => {
|
2018-09-07 02:56:00 +08:00
|
|
|
const fields = this.editedFieldsForTarget(target);
|
|
|
|
if (fields.length < 1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let resultString = I18n.t("admin.customize.theme." + target);
|
|
|
|
const formattedFields = fields
|
|
|
|
.map((f) => I18n.t("admin.customize.theme." + f.name + ".text"))
|
|
|
|
.join(" , ");
|
|
|
|
resultString += `: ${formattedFields}`;
|
|
|
|
descriptions.push(resultString);
|
2017-04-12 22:52:52 +08:00
|
|
|
});
|
2018-09-07 02:56:00 +08:00
|
|
|
return descriptions;
|
2017-04-12 22:52:52 +08:00
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("colorSchemeId", "model.color_scheme_id")
|
2017-04-12 22:52:52 +08:00
|
|
|
colorSchemeChanged(colorSchemeId, existingId) {
|
2019-11-12 17:47:42 +08:00
|
|
|
colorSchemeId = colorSchemeId === null ? null : parseInt(colorSchemeId, 10);
|
2017-04-12 22:52:52 +08:00
|
|
|
return colorSchemeId !== existingId;
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("availableChildThemes", "model.childThemes.[]", "model")
|
2018-09-07 02:56:00 +08:00
|
|
|
selectableChildThemes(available, childThemes) {
|
|
|
|
if (available) {
|
|
|
|
const themes = !childThemes
|
|
|
|
? available
|
|
|
|
: available.filter((theme) => childThemes.indexOf(theme) === -1);
|
|
|
|
return themes.length === 0 ? null : themes;
|
2017-04-12 22:52:52 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-11-28 13:19:01 +08:00
|
|
|
@discourseComputed("model.parentThemes.[]")
|
2019-12-04 14:13:41 +08:00
|
|
|
relativesSelectorSettingsForComponent() {
|
2020-02-06 00:14:42 +08:00
|
|
|
return EmberObject.create({
|
2019-11-28 13:19:01 +08:00
|
|
|
list_type: "compact",
|
|
|
|
type: "list",
|
|
|
|
preview: null,
|
|
|
|
anyValue: false,
|
|
|
|
setting: "parent_theme_ids",
|
|
|
|
label: I18n.t("admin.customize.theme.component_on_themes"),
|
|
|
|
choices: this.availableThemesNames,
|
|
|
|
default: this.parentThemesNames.join("|"),
|
|
|
|
value: this.parentThemesNames.join("|"),
|
2019-12-04 14:13:41 +08:00
|
|
|
defaultValues: this.availableActiveThemesNames.join("|"),
|
2019-11-28 13:19:01 +08:00
|
|
|
allThemes: this.allThemes,
|
|
|
|
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all_themes"),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2019-12-04 14:13:41 +08:00
|
|
|
@discourseComputed("model.parentThemes.[]")
|
|
|
|
relativesSelectorSettingsForTheme() {
|
2020-02-06 00:14:42 +08:00
|
|
|
return EmberObject.create({
|
2019-12-04 14:13:41 +08:00
|
|
|
list_type: "compact",
|
|
|
|
type: "list",
|
|
|
|
preview: null,
|
|
|
|
anyValue: false,
|
|
|
|
setting: "child_theme_ids",
|
|
|
|
label: I18n.t("admin.customize.theme.included_components"),
|
|
|
|
choices: this.availableComponentsNames,
|
|
|
|
default: this.childThemesNames.join("|"),
|
|
|
|
value: this.childThemesNames.join("|"),
|
|
|
|
defaultValues: this.availableActiveComponentsNames.join("|"),
|
|
|
|
allThemes: this.allThemes,
|
|
|
|
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all"),
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("allThemes", "model.component", "model")
|
2018-09-07 02:56:00 +08:00
|
|
|
availableChildThemes(allThemes) {
|
|
|
|
if (!this.get("model.component")) {
|
|
|
|
const themeId = this.get("model.id");
|
|
|
|
return allThemes.filter(
|
|
|
|
(theme) => theme.get("id") !== themeId && theme.get("component")
|
|
|
|
);
|
2017-04-12 22:52:52 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("model.component")
|
2018-08-31 03:23:15 +08:00
|
|
|
convertKey(component) {
|
2018-08-24 09:30:00 +08:00
|
|
|
const type = component ? "component" : "theme";
|
2018-08-31 03:23:15 +08:00
|
|
|
return `admin.customize.theme.convert_${type}`;
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("model.component")
|
2018-08-31 03:23:15 +08:00
|
|
|
convertIcon(component) {
|
|
|
|
return component ? "cube" : "";
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("model.component")
|
2018-08-31 03:23:15 +08:00
|
|
|
convertTooltip(component) {
|
|
|
|
const type = component ? "component" : "theme";
|
|
|
|
return `admin.customize.theme.convert_${type}_tooltip`;
|
2018-08-24 09:30:00 +08:00
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("model.settings")
|
2018-03-05 08:04:23 +08:00
|
|
|
settings(settings) {
|
|
|
|
return settings.map((setting) => ThemeSettings.create(setting));
|
|
|
|
},
|
|
|
|
|
2019-10-31 04:28:29 +08:00
|
|
|
hasSettings: notEmpty("settings"),
|
2019-01-17 19:46:11 +08:00
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("model.translations")
|
2019-01-17 19:46:11 +08:00
|
|
|
translations(translations) {
|
|
|
|
return translations.map((setting) => ThemeSettings.create(setting));
|
2018-03-05 08:04:23 +08:00
|
|
|
},
|
2018-09-08 21:24:11 +08:00
|
|
|
|
2019-10-31 04:28:29 +08:00
|
|
|
hasTranslations: notEmpty("translations"),
|
2019-01-17 19:46:11 +08:00
|
|
|
|
2020-11-23 21:29:22 +08:00
|
|
|
@discourseComputed(
|
|
|
|
"model.remote_theme.local_version",
|
|
|
|
"model.remote_theme.remote_version",
|
|
|
|
"model.remote_theme.commits_behind"
|
|
|
|
)
|
|
|
|
hasOverwrittenHistory(localVersion, remoteVersion, commitsBehind) {
|
|
|
|
return localVersion !== remoteVersion && commitsBehind === -1;
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("model.remoteError", "updatingRemote")
|
2018-09-08 21:24:11 +08:00
|
|
|
showRemoteError(errorMessage, updating) {
|
|
|
|
return errorMessage && !updating;
|
|
|
|
},
|
|
|
|
|
2018-09-07 02:56:00 +08:00
|
|
|
editedFieldsForTarget(target) {
|
|
|
|
return this.get("model.editedFields").filter(
|
|
|
|
(field) => field.target === target
|
|
|
|
);
|
|
|
|
},
|
2017-04-12 22:52:52 +08:00
|
|
|
|
2018-08-31 03:23:15 +08:00
|
|
|
commitSwitchType() {
|
2019-05-27 16:15:39 +08:00
|
|
|
const model = this.model;
|
2018-08-31 03:23:15 +08:00
|
|
|
const newValue = !model.get("component");
|
|
|
|
model.set("component", newValue);
|
|
|
|
|
|
|
|
if (newValue) {
|
|
|
|
this.set("parentController.currentTab", COMPONENTS);
|
|
|
|
} else {
|
|
|
|
this.set("parentController.currentTab", THEMES);
|
|
|
|
}
|
|
|
|
|
|
|
|
model
|
|
|
|
.saveChanges("component")
|
|
|
|
.then(() => {
|
|
|
|
this.set("colorSchemeId", null);
|
|
|
|
|
|
|
|
model.setProperties({
|
|
|
|
default: false,
|
|
|
|
color_scheme_id: null,
|
|
|
|
user_selectable: false,
|
|
|
|
child_themes: [],
|
|
|
|
childThemes: [],
|
|
|
|
});
|
|
|
|
|
|
|
|
this.get("parentController.model.content").forEach((theme) => {
|
2019-11-01 01:55:01 +08:00
|
|
|
const children = makeArray(theme.get("childThemes"));
|
|
|
|
const rawChildren = makeArray(theme.get("child_themes"));
|
2018-08-31 03:23:15 +08:00
|
|
|
const index = children ? children.indexOf(model) : -1;
|
|
|
|
if (index > -1) {
|
|
|
|
children.splice(index, 1);
|
|
|
|
rawChildren.splice(index, 1);
|
|
|
|
theme.setProperties({
|
|
|
|
childThemes: children,
|
|
|
|
child_themes: rawChildren,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(popupAjaxError);
|
|
|
|
},
|
2018-09-07 02:56:00 +08:00
|
|
|
transitionToEditRoute() {
|
|
|
|
this.transitionToRoute(
|
2019-05-27 16:15:39 +08:00
|
|
|
this.editRouteName,
|
2018-09-07 02:56:00 +08:00
|
|
|
this.get("model.id"),
|
|
|
|
"common",
|
|
|
|
"scss"
|
|
|
|
);
|
|
|
|
},
|
2019-10-31 07:18:29 +08:00
|
|
|
sourceIsHttp: match("model.remote_theme.remote_url", /^http(s)?:\/\//),
|
2020-03-18 06:27:54 +08:00
|
|
|
|
|
|
|
@discourseComputed(
|
|
|
|
"model.remote_theme.remote_url",
|
|
|
|
"model.remote_theme.branch"
|
|
|
|
)
|
|
|
|
remoteThemeLink(remoteThemeUrl, remoteThemeBranch) {
|
|
|
|
return remoteThemeBranch
|
|
|
|
? `${remoteThemeUrl.replace(/\.git$/, "")}/tree/${remoteThemeBranch}`
|
|
|
|
: remoteThemeUrl;
|
|
|
|
},
|
|
|
|
|
2017-04-12 22:52:52 +08:00
|
|
|
actions: {
|
|
|
|
updateToLatest() {
|
|
|
|
this.set("updatingRemote", true);
|
2019-05-27 16:15:39 +08:00
|
|
|
this.model
|
2017-04-18 04:55:53 +08:00
|
|
|
.updateToLatest()
|
|
|
|
.catch(popupAjaxError)
|
|
|
|
.finally(() => {
|
|
|
|
this.set("updatingRemote", false);
|
|
|
|
});
|
2017-04-12 22:52:52 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
checkForThemeUpdates() {
|
|
|
|
this.set("updatingRemote", true);
|
2019-05-27 16:15:39 +08:00
|
|
|
this.model
|
2017-04-18 04:55:53 +08:00
|
|
|
.checkForUpdates()
|
|
|
|
.catch(popupAjaxError)
|
|
|
|
.finally(() => {
|
|
|
|
this.set("updatingRemote", false);
|
|
|
|
});
|
2017-04-12 22:52:52 +08:00
|
|
|
},
|
|
|
|
|
2017-05-10 05:20:28 +08:00
|
|
|
addUploadModal() {
|
|
|
|
showModal("admin-add-upload", { admin: true, name: "" });
|
|
|
|
},
|
|
|
|
|
|
|
|
addUpload(info) {
|
2019-05-27 16:15:39 +08:00
|
|
|
let model = this.model;
|
2017-05-10 05:20:28 +08:00
|
|
|
model.setField("common", info.name, "", info.upload_id, THEME_UPLOAD_VAR);
|
|
|
|
model.saveChanges("theme_fields").catch((e) => popupAjaxError(e));
|
|
|
|
},
|
|
|
|
|
2017-04-12 22:52:52 +08:00
|
|
|
cancelChangeScheme() {
|
|
|
|
this.set("colorSchemeId", this.get("model.color_scheme_id"));
|
|
|
|
},
|
|
|
|
changeScheme() {
|
2019-05-27 16:15:39 +08:00
|
|
|
let schemeId = this.colorSchemeId;
|
2017-04-12 22:52:52 +08:00
|
|
|
this.set(
|
|
|
|
"model.color_scheme_id",
|
2019-11-12 17:47:42 +08:00
|
|
|
schemeId === null ? null : parseInt(schemeId, 10)
|
2017-04-12 22:52:52 +08:00
|
|
|
);
|
2019-05-27 16:15:39 +08:00
|
|
|
this.model.saveChanges("color_scheme_id");
|
2017-04-12 22:52:52 +08:00
|
|
|
},
|
|
|
|
startEditingName() {
|
|
|
|
this.set("oldName", this.get("model.name"));
|
|
|
|
this.set("editingName", true);
|
|
|
|
},
|
|
|
|
cancelEditingName() {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.set("model.name", this.oldName);
|
2017-04-12 22:52:52 +08:00
|
|
|
this.set("editingName", false);
|
|
|
|
},
|
|
|
|
finishedEditingName() {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.model.saveChanges("name");
|
2017-04-12 22:52:52 +08:00
|
|
|
this.set("editingName", false);
|
|
|
|
},
|
|
|
|
|
|
|
|
editTheme() {
|
2019-01-23 22:40:21 +08:00
|
|
|
if (this.get("model.remote_theme.is_git")) {
|
2017-04-12 22:52:52 +08:00
|
|
|
bootbox.confirm(
|
|
|
|
I18n.t("admin.customize.theme.edit_confirm"),
|
|
|
|
(result) => {
|
|
|
|
if (result) {
|
2018-09-07 02:56:00 +08:00
|
|
|
this.transitionToEditRoute();
|
2017-04-12 22:52:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
} else {
|
2018-09-07 02:56:00 +08:00
|
|
|
this.transitionToEditRoute();
|
2017-04-12 22:52:52 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
applyDefault() {
|
2019-05-27 16:15:39 +08:00
|
|
|
const model = this.model;
|
2017-04-12 22:52:52 +08:00
|
|
|
model.saveChanges("default").then(() => {
|
|
|
|
if (model.get("default")) {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.allThemes.forEach((theme) => {
|
2017-04-12 22:52:52 +08:00
|
|
|
if (theme !== model && theme.get("default")) {
|
|
|
|
theme.set("default", false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
applyUserSelectable() {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.model.saveChanges("user_selectable");
|
2017-04-12 22:52:52 +08:00
|
|
|
},
|
|
|
|
|
2020-11-16 20:44:09 +08:00
|
|
|
applyAutoUpdateable() {
|
|
|
|
this.model.saveChanges("auto_update");
|
|
|
|
},
|
|
|
|
|
2017-04-12 22:52:52 +08:00
|
|
|
addChildTheme() {
|
2019-11-12 17:47:42 +08:00
|
|
|
let themeId = parseInt(this.selectedChildThemeId, 10);
|
2019-05-27 16:15:39 +08:00
|
|
|
let theme = this.allThemes.findBy("id", themeId);
|
2019-11-28 13:19:01 +08:00
|
|
|
this.model.addChildTheme(theme).then(() => this.store.findAll("theme"));
|
2017-04-12 22:52:52 +08:00
|
|
|
},
|
|
|
|
|
2017-05-10 05:20:28 +08:00
|
|
|
removeUpload(upload) {
|
2017-05-11 02:43:05 +08:00
|
|
|
return bootbox.confirm(
|
|
|
|
I18n.t("admin.customize.theme.delete_upload_confirm"),
|
|
|
|
I18n.t("no_value"),
|
|
|
|
I18n.t("yes_value"),
|
|
|
|
(result) => {
|
|
|
|
if (result) {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.model.removeField(upload);
|
2017-05-11 02:43:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2017-05-10 05:20:28 +08:00
|
|
|
},
|
|
|
|
|
2017-04-12 22:52:52 +08:00
|
|
|
removeChildTheme(theme) {
|
2019-11-28 13:19:01 +08:00
|
|
|
this.model
|
|
|
|
.removeChildTheme(theme)
|
|
|
|
.then(() => this.store.findAll("theme"));
|
2017-04-12 22:52:52 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
destroy() {
|
|
|
|
return bootbox.confirm(
|
2019-05-11 02:14:12 +08:00
|
|
|
I18n.t("admin.customize.delete_confirm", {
|
|
|
|
theme_name: this.get("model.name"),
|
|
|
|
}),
|
2017-04-12 22:52:52 +08:00
|
|
|
I18n.t("no_value"),
|
|
|
|
I18n.t("yes_value"),
|
|
|
|
(result) => {
|
|
|
|
if (result) {
|
2019-05-27 16:15:39 +08:00
|
|
|
const model = this.model;
|
2019-12-10 05:43:26 +08:00
|
|
|
model.setProperties({ recentlyInstalled: false });
|
2017-04-12 22:52:52 +08:00
|
|
|
model.destroyRecord().then(() => {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.allThemes.removeObject(model);
|
2017-04-12 22:52:52 +08:00
|
|
|
this.transitionToRoute("adminCustomizeThemes");
|
|
|
|
});
|
2018-06-15 23:03:24 +08:00
|
|
|
}
|
2017-04-12 22:52:52 +08:00
|
|
|
}
|
|
|
|
);
|
2018-08-24 09:30:00 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
switchType() {
|
2018-08-31 03:23:15 +08:00
|
|
|
const relatives = this.get("model.component")
|
2019-05-27 16:15:39 +08:00
|
|
|
? this.parentThemes
|
2018-08-31 03:23:15 +08:00
|
|
|
: this.get("model.childThemes");
|
|
|
|
if (relatives && relatives.length > 0) {
|
|
|
|
const names = relatives.map((relative) => relative.get("name"));
|
|
|
|
bootbox.confirm(
|
2019-05-27 16:15:39 +08:00
|
|
|
I18n.t(`${this.convertKey}_alert`, {
|
2018-08-31 03:23:15 +08:00
|
|
|
relatives: names.join(", "),
|
|
|
|
}),
|
|
|
|
I18n.t("no_value"),
|
|
|
|
I18n.t("yes_value"),
|
|
|
|
(result) => {
|
|
|
|
if (result) {
|
|
|
|
this.commitSwitchType();
|
|
|
|
}
|
2018-08-24 09:30:00 +08:00
|
|
|
}
|
2018-08-31 03:23:15 +08:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
this.commitSwitchType();
|
|
|
|
}
|
2019-07-03 16:18:11 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
enableComponent() {
|
|
|
|
this.model.set("enabled", true);
|
|
|
|
this.model
|
|
|
|
.saveChanges("enabled")
|
|
|
|
.catch(() => this.model.set("enabled", false));
|
|
|
|
},
|
|
|
|
|
|
|
|
disableComponent() {
|
|
|
|
this.model.set("enabled", false);
|
|
|
|
this.model
|
|
|
|
.saveChanges("enabled")
|
|
|
|
.catch(() => this.model.set("enabled", true));
|
2017-04-12 22:52:52 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|