Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove unused 'advanced' theme editor mode (#31387)

David Taylor90d6747248aa
diff --git a/app/assets/javascripts/admin/addon/components/admin-theme-editor.hbs b/app/assets/javascripts/admin/addon/components/admin-theme-editor.hbs
index effaf57c4ec..366e13b1bef 100644
--- a/app/assets/javascripts/admin/addon/components/admin-theme-editor.hbs
+++ b/app/assets/javascripts/admin/addon/components/admin-theme-editor.hbs
@@ -17,23 +17,6 @@
</li>
{{/each}}
- {{#if this.allowAdvanced}}
- <li>
- <a
- {{on "click" this.toggleShowAdvanced}}
- href
- title={{i18n
- (concat
- "admin.customize.theme."
- (if this.showAdvanced "hide_advanced" "show_advanced")
- )
- }}
- class="no-text"
- >
- {{d-icon (if this.showAdvanced "angles-left" "angles-right")}}
- </a>
- </li>
- {{/if}}
<li class="spacer"></li>
<li>
<label>
@@ -71,33 +54,6 @@
</li>
{{/each}}
- {{#if this.showAddField}}
- <li>
- {{#if this.addingField}}
- <Input
- @type={{this.text}}
- @value={{this.newFieldName}}
- @enter={{this.addField}}
- @escape-press={{this.cancelAddField}}
- />
- <DButton
- @action={{fn this.addField this.newFieldName}}
- @icon="check"
- class="ok"
- />
- <DButton
- @action={{this.cancelAddField}}
- @icon="xmark"
- class="cancel"
- />
- {{else}}
- <a href {{on "click" this.toggleAddField}} class="no-text">
- {{d-icon "plus"}}
- </a>
- {{/if}}
- </li>
- {{/if}}
-
<li class="spacer"></li>
<li>
<a href {{on "click" this.toggleMaximize}} class="no-text">
diff --git a/app/assets/javascripts/admin/addon/components/admin-theme-editor.js b/app/assets/javascripts/admin/addon/components/admin-theme-editor.js
index 174dcf053cb..b21acd4a90f 100644
--- a/app/assets/javascripts/admin/addon/components/admin-theme-editor.js
+++ b/app/assets/javascripts/admin/addon/components/admin-theme-editor.js
@@ -11,12 +11,9 @@ export default class AdminThemeEditor extends Component {
@fmt("fieldName", "currentTargetName", "%@|%@") editorId;
- @discourseComputed("theme.targets", "onlyOverridden", "showAdvanced")
- visibleTargets(targets, onlyOverridden, showAdvanced) {
+ @discourseComputed("theme.targets", "onlyOverridden")
+ visibleTargets(targets, onlyOverridden) {
return targets.filter((target) => {
- if (target.advanced && !showAdvanced) {
- return false;
- }
if (!onlyOverridden) {
return true;
}
@@ -35,12 +32,6 @@ export default class AdminThemeEditor extends Component {
@discourseComputed("currentTargetName", "fieldName")
activeSectionMode(targetName, fieldName) {
- if (["settings", "translations"].includes(targetName)) {
- return "yaml";
- }
- if (["extra_scss"].includes(targetName)) {
- return "scss";
- }
if (["color_definitions"].includes(fieldName)) {
return "scss";
}
@@ -76,11 +67,6 @@ export default class AdminThemeEditor extends Component {
return maximized ? "discourse-compress" : "discourse-expand";
}
- @discourseComputed("currentTargetName", "theme.targets")
- showAddField(currentTargetName, targets) {
- return targets.find((t) => t.name === currentTargetName).customNames;
- }
-
@discourseComputed(
"currentTargetName",
"fieldName",
@@ -90,18 +76,6 @@ export default class AdminThemeEditor extends Component {
return this.theme.getError(target, fieldName);
}
- @action
- toggleShowAdvanced(event) {
- event?.preventDefault();
- this.toggleProperty("showAdvanced");
- }
-
- @action
- toggleAddField(event) {
- event?.preventDefault();
- this.toggleProperty("addingField");
- }
-
@action
toggleMaximize(event) {
event?.preventDefault();
@@ -109,22 +83,6 @@ export default class AdminThemeEditor extends Component {
next(() => this.appEvents.trigger("ace:resize"));
}
- @action
- cancelAddField() {
- this.set("addingField", false);
- }
-
- @action
- addField(name) {
- if (!name) {
- return;
- }
- name = name.replace(/[^a-zA-Z0-9-_/]/g, "");
- this.theme.setField(this.currentTargetName, name, "");
- this.setProperties({ newFieldName: "", addingField: false });
- this.fieldAdded(this.currentTargetName, name);
- }
-
@action
setWarning(message) {
this.set("warning", message);
diff --git a/app/assets/javascripts/admin/addon/models/theme.js b/app/assets/javascripts/admin/addon/models/theme.js
index 9c4c3e3b2aa..e05183a0d4a 100644
--- a/app/assets/javascripts/admin/addon/models/theme.js
+++ b/app/assets/javascripts/admin/addon/models/theme.js
@@ -38,21 +38,6 @@ class Theme extends RestModel {
{ id: 0, name: "common" },
{ id: 1, name: "desktop", icon: "desktop" },
{ id: 2, name: "mobile", icon: "mobile-screen-button" },
- { id: 3, name: "settings", icon: "gear", advanced: true },
- {
- id: 4,
- name: "translations",
- icon: "globe",
- advanced: true,
- customNames: true,
- },
- {
- id: 5,
- name: "extra_scss",
- icon: "paintbrush",
- advanced: true,
- customNames: true,
- },
].map((target) => {
target["edited"] = this.hasEdited(target.name);
target["error"] = this.hasError(target.name);
@@ -71,14 +56,6 @@ class Theme extends RestModel {
"footer",
];
- const scss_fields = (this.theme_fields || [])
- .filter((f) => f.target === "extra_scss" && f.name !== "")
- .map((f) => f.name);
-
- if (scss_fields.length < 1) {
- scss_fields.push("importable_scss");
- }
-
return {
common: [
...common,
@@ -88,14 +65,6 @@ class Theme extends RestModel {
],
desktop: common,
mobile: common,
- settings: ["yaml"],
- translations: [
- "en",
- ...(this.theme_fields || [])
- .filter((f) => f.target === "translations" && f.name !== "en")
- .map((f) => f.name),
- ],
- extra_scss: scss_fields,
};
}
@@ -114,14 +83,8 @@ class Theme extends RestModel {
error: this.hasError(target, fieldName),
};
- if (target === "translations" || target === "extra_scss") {
- field.translatedName = fieldName;
- } else {
- field.translatedName = i18n(
- `admin.customize.theme.${fieldName}.text`
- );
- field.title = i18n(`admin.customize.theme.${fieldName}.title`);
- }
+ field.translatedName = i18n(`admin.customize.theme.${fieldName}.text`);
+ field.title = i18n(`admin.customize.theme.${fieldName}.title`);
if (fieldName.indexOf("_tag") > 0) {
field.icon = "far-file-lines";
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 1bf9c722b2c..9d2cd54cf22 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -6086,16 +6086,11 @@ en:
common: "Common"
desktop: "Desktop"
mobile: "Mobile"
- settings: "Settings"
- translations: "Translations"
- extra_scss: "Extra SCSS"
extra_files: "Extra files"
extra_files_upload: "Export theme to view these files."
extra_files_remote: "Export theme or check the git repository to view these files."
preview: "Preview"
settings_editor: "Settings Editor"
- show_advanced: "Show advanced fields"
- hide_advanced: "Hide advanced fields"
hide_unused_fields: "Hide unused fields"
is_default: "Theme is enabled by default"
user_selectable: "Theme can be selected by users"