Skip to content

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

DEV: Add various APIs and outlets to the themes config area (#33385)

Osama Sayegh0ccf792b91ec
diff --git a/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs b/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs
index c9f317fa9c9..b1a5d134cb6 100644
--- a/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-config-area-card.gjs
@@ -1,82 +1,3 @@
-import Component from "@glimmer/component";
-import { tracked } from "@glimmer/tracking";
-import { action } from "@ember/object";
-import DButton from "discourse/components/d-button";
-import icon from "discourse/helpers/d-icon";
-import { i18n } from "discourse-i18n";
+import AdminConfigAreaCard from "discourse/components/admin-config-area-card";
-export default class AdminConfigAreaCard extends Component {
- @tracked collapsed = this.args.collapsed;
-
- get computedHeading() {
- if (this.args.heading) {
- return i18n(this.args.heading);
- }
- return this.args.translatedHeading;
- }
-
- get hasHeading() {
- return this.args.heading || this.args.translatedHeading;
- }
-
- get computedDescription() {
- if (this.args.description) {
- return i18n(this.args.description);
- }
- return this.args.translatedDescription;
- }
-
- get hasDescription() {
- return this.args.description || this.args.translatedDescription;
- }
-
- get headerCaretIcon() {
- return this.collapsed ? "angle-right" : "angle-down";
- }
-
- @action
- toggleCardDisplay() {
- this.collapsed = !this.collapsed;
- }
-
- <template>
- <section class="admin-config-area-card" ...attributes>
- <div class="admin-config-area-card__header-wrapper">
- {{#if this.hasHeading}}
- <h3
- class="admin-config-area-card__title"
- >{{this.computedHeading}}</h3>
- {{else}}
- {{#if (has-block "header")}}
- <h3 class="admin-config-area-card__title">{{yield to="header"}}</h3>
- {{/if}}
- {{/if}}
- {{#if (has-block "headerAction")}}
- <div class="admin-config-area-card__header-action">
- {{yield to="headerAction"}}
- </div>
- {{/if}}
-
- {{#if @collapsable}}
- <DButton
- @title="sidebar.toggle_section"
- @action={{this.toggleCardDisplay}}
- class="admin-config-area-card__toggle-button btn-transparent"
- >
- {{icon this.headerCaretIcon}}
- </DButton>
- {{/if}}
- </div>
- {{#unless this.collapsed}}
- <div class="admin-config-area-card__content">
- {{#if this.hasDescription}}
- <p class="admin-config-area-card__description">
- {{this.computedDescription}}
- </p>
- {{/if}}
- {{yield to="content"}}
- </div>
- {{/unless}}
- </section>
- </template>
-}
+export default AdminConfigAreaCard;
diff --git a/app/assets/javascripts/admin/addon/components/admin-config-area-empty-list.gjs b/app/assets/javascripts/admin/addon/components/admin-config-area-empty-list.gjs
index 22e84e6a6e3..bb4b8a2c1e9 100644
--- a/app/assets/javascripts/admin/addon/components/admin-config-area-empty-list.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-config-area-empty-list.gjs
@@ -28,6 +28,7 @@ export default class AdminConfigAreaEmptyList extends Component {
@route={{@ctaRoute}}
/>
{{/if}}
+ {{yield}}
</div>
</template>
}
diff --git a/app/assets/javascripts/admin/addon/components/admin-config-areas/components.gjs b/app/assets/javascripts/admin/addon/components/admin-config-areas/components.gjs
index 41fd80c2007..020955ac504 100644
--- a/app/assets/javascripts/admin/addon/components/admin-config-areas/components.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-config-areas/components.gjs
@@ -12,7 +12,9 @@ import DToggleSwitch from "discourse/components/d-toggle-switch";
import DropdownMenu from "discourse/components/dropdown-menu";
import FilterInput from "discourse/components/filter-input";
import LoadMore from "discourse/components/load-more";
+import PluginOutlet from "discourse/components/plugin-outlet";
import icon from "discourse/helpers/d-icon";
+import lazyHash from "discourse/helpers/lazy-hash";
import { ajax } from "discourse/lib/ajax";
import { extractErrorInfo } from "discourse/lib/ajax-error";
import discourseDebounce from "discourse/lib/debounce";
@@ -184,10 +186,15 @@ export default class AdminConfigAreasComponents extends Component {
}}
>
<:actions as |actions|>
- <actions.Primary
- @label="admin.config_areas.themes_and_components.components.install"
- @action={{this.installModal}}
- />
+ <PluginOutlet
+ @name="admin-config-area-components-new-button"
+ @outletArgs={{lazyHash actions=actions}}
+ >
+ <actions.Primary
+ @label="admin.config_areas.themes_and_components.components.install"
+ @action={{this.installModal}}
+ />
+ </PluginOutlet>
</:actions>
</DPageSubheader>
<div class="container">
@@ -259,7 +266,11 @@ export default class AdminConfigAreasComponents extends Component {
{{else}}
<AdminConfigAreaEmptyList
@emptyLabel="admin.config_areas.themes_and_components.components.no_components"
- />
+ >
+ <PluginOutlet
+ @name="admin-config-area-components-empty-list-bottom"
+ />
+ </AdminConfigAreaEmptyList>
{{/if}}
{{/if}}
</ConditionalLoadingSpinner>
diff --git a/app/assets/javascripts/admin/addon/components/admin-config-areas/themes.gjs b/app/assets/javascripts/admin/addon/components/admin-config-areas/themes.gjs
index 3af3feee951..ffef0bf9593 100644
--- a/app/assets/javascripts/admin/addon/components/admin-config-areas/themes.gjs
+++ b/app/assets/javascripts/admin/addon/components/admin-config-areas/themes.gjs
@@ -4,6 +4,8 @@ import { next } from "@ember/runloop";
import { service } from "@ember/service";
import { isPresent } from "@ember/utils";
import DPageSubheader from "discourse/components/d-page-subheader";
+import PluginOutlet from "discourse/components/plugin-outlet";
+import lazyHash from "discourse/helpers/lazy-hash";
import { i18n } from "discourse-i18n";
import InstallThemeModal from "admin/components/modal/install-theme";
import ThemesGrid from "admin/components/themes-grid";
@@ -91,10 +93,15 @@ export default class AdminConfigAreasThemes extends Component {
}}
>
<:actions as |actions|>
- <actions.Primary
- @label="admin.config_areas.themes_and_components.themes.install"
- @action={{this.installModal}}
- />
+ <PluginOutlet
+ @name="admin-config-area-themes-new-button"
+ @outletArgs={{lazyHash actions=actions}}
+ >
+ <actions.Primary
+ @label="admin.config_areas.themes_and_components.themes.install"
+ @action={{this.installModal}}
+ />
+ </PluginOutlet>
</:actions>
</DPageSubheader>
<div class="admin-detail">
diff --git a/app/assets/javascripts/admin/addon/components/themes-grid.gjs b/app/assets/javascripts/admin/addon/components/themes-grid.gjs
index 49f60d31361..7d52f8ba877 100644
--- a/app/assets/javascripts/admin/addon/components/themes-grid.gjs
+++ b/app/assets/javascripts/admin/addon/components/themes-grid.gjs
@@ -1,5 +1,6 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
+import { getCardsForAdminThemesGrid } from "discourse/lib/admin-custom-themes-grid-cards";
import ThemesGridCard from "./themes-grid-card";
// NOTE (martin): Much of the JS code in this component is placeholder code. Much
@@ -42,9 +43,9 @@ export default class ThemesGrid extends Component {
{{#each @themes as |theme|}}
<ThemesGridCard @theme={{theme}} @allThemes={{@themes}} />
{{/each}}
- {{#if (has-block "specialCard")}}
- {{yield to="specialCard"}}
- {{/if}}
+ {{#each (getCardsForAdminThemesGrid) as |Card|}}
+ <Card />
+ {{/each}}
</div>
</template>
}
diff --git a/app/assets/javascripts/admin/addon/templates/customize-themes-show-index.gjs b/app/assets/javascripts/admin/addon/templates/customize-themes-show-index.gjs
index 385f9552d50..39b0b8ee80e 100644
--- a/app/assets/javascripts/admin/addon/templates/customize-themes-show-index.gjs
+++ b/app/assets/javascripts/admin/addon/templates/customize-themes-show-index.gjs
@@ -179,11 +179,19 @@ export default RouteTemplate(
class="form-horizontal theme settings control-unit relative-theme-selector included-components-setting"
>
<div class="row setting">
- <ThemeSettingRelativesSelector
- @setting={{@controller.relativesSelectorSettingsForTheme}}
- @model={{@controller.model}}
- class="theme-setting"
- />
+ <PluginOutlet
+ @name="admin-customize-theme-included-components-setting"
+ @outletArgs={{lazyHash
+ }}
+ >
+ <ThemeSettingRelativesSelector
+ @setting={{@controller.relativesSelectorSettingsForTheme}}
+ @model={{@controller.model}}
+ class="theme-setting"
+ />
+ </PluginOutlet>
</div>
</section>
{{/if}}
diff --git a/app/assets/javascripts/discourse/app/components/admin-config-area-card.gjs b/app/assets/javascripts/discourse/app/components/admin-config-area-card.gjs
new file mode 100644
index 00000000000..3bf1f45629b
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/admin-config-area-card.gjs
@@ -0,0 +1,94 @@
+import Component from "@glimmer/component";
+import { tracked } from "@glimmer/tracking";
+import { action } from "@ember/object";
+import { or } from "truth-helpers";
+import DButton from "discourse/components/d-button";
+import icon from "discourse/helpers/d-icon";
+import { i18n } from "discourse-i18n";
+
+export default class AdminConfigAreaCard extends Component {
+ @tracked collapsed = this.args.collapsed;
+
+ get computedHeading() {
+ if (this.args.heading) {
+ return i18n(this.args.heading);
+ }
+ return this.args.translatedHeading;
+ }
+
+ get hasHeading() {
+ return this.args.heading || this.args.translatedHeading;
+ }
+
+ get computedDescription() {
+ if (this.args.description) {
+ return i18n(this.args.description);
+ }
+ return this.args.translatedDescription;
+ }
+
+ get hasDescription() {
+ return this.args.description || this.args.translatedDescription;
+ }
+
+ get headerCaretIcon() {
+ return this.collapsed ? "angle-right" : "angle-down";
+ }
+
+ @action
+ toggleCardDisplay() {
+ this.collapsed = !this.collapsed;
+ }
+
+ <template>
+ <section class="admin-config-area-card" ...attributes>
+ {{#if
+ (or
+ this.hasHeading
+ (has-block "header")
+ (has-block "headerAction")
+ @collapsable
+ )
+ }}
+ <div class="admin-config-area-card__header-wrapper">
+ {{#if this.hasHeading}}
+ <h3
+ class="admin-config-area-card__title"
+ >{{this.computedHeading}}</h3>
+ {{else}}
+ {{#if (has-block "header")}}
+ <h3 class="admin-config-area-card__title">{{yield
+ to="header"
+ }}</h3>
+ {{/if}}
+ {{/if}}
+ {{#if (has-block "headerAction")}}
+ <div class="admin-config-area-card__header-action">
+ {{yield to="headerAction"}}
+ </div>
+ {{/if}}
+
+ {{#if @collapsable}}
+ <DButton
+ @title="sidebar.toggle_section"
+ @action={{this.toggleCardDisplay}}
+ class="admin-config-area-card__toggle-button btn-transparent"
+ >
+ {{icon this.headerCaretIcon}}
+ </DButton>
+ {{/if}}
+ </div>
+ {{/if}}
+ {{#unless this.collapsed}}
+ <div class="admin-config-area-card__content">
+ {{#if this.hasDescription}}
+ <p class="admin-config-area-card__description">
+ {{this.computedDescription}}
+ </p>
+ {{/if}}
+ {{yield to="content"}}
+ </div>
+ {{/unless}}
+ </section>
+ </template>
+}
diff --git a/app/assets/javascripts/discourse/app/components/d-page-action-button.gjs b/app/assets/javascripts/discourse/app/components/d-page-action-button.gjs
index 49046fc3fd2..31965e885d5 100644
--- a/app/assets/javascripts/discourse/app/components/d-page-action-button.gjs
+++ b/app/assets/javascripts/discourse/app/components/d-page-action-button.gjs
@@ -9,6 +9,7 @@ export const DPageActionButton = <template>
@route={{@route}}
@routeModels={{@routeModels}}
@label={{@label}}
+ @translatedLabel={{@translatedLabel}}
@title={{@title}}
@icon={{@icon}}
@isLoading={{@isLoading}}
@@ -36,6 +37,7 @@ export const PrimaryButton = <template>
@route={{@route}}
@routeModels={{@routeModels}}
@label={{@label}}
+ @translatedLabel={{@translatedLabel}}
@title={{@title}}
@isLoading={{@isLoading}}
@disabled={{@disabled}}
@@ -51,6 +53,7 @@ export const DangerButton = <template>
@route={{@route}}
@routeModels={{@routeModels}}
@label={{@label}}
+ @translatedLabel={{@translatedLabel}}
@title={{@title}}
@isLoading={{@isLoading}}
/>
@@ -65,6 +68,7 @@ export const DefaultButton = <template>
@route={{@route}}
@routeModels={{@routeModels}}
@label={{@label}}
+ @translatedLabel={{@translatedLabel}}
@title={{@title}}
@isLoading={{@isLoading}}
/>
@@ -79,6 +83,7 @@ export const DPageActionListItem = <template>
@route={{@route}}
@routeModels={{@routeModels}}
@label={{@label}}
+ @translatedLabel={{@translatedLabel}}
@title={{@title}}
@icon={{@icon}}
@isLoading={{@isLoading}}
@@ -109,6 +114,7 @@ export const DefaultActionListItem = <template>
@route={{@route}}
@routeModels={{@routeModels}}
@label={{@label}}
+ @translatedLabel={{@translatedLabel}}
@title={{@title}}
@isLoading={{@isLoading}}
/>
@@ -122,6 +128,7 @@ export const DangerActionListItem = <template>
@route={{@route}}
@routeModels={{@routeModels}}
@label={{@label}}
+ @translatedLabel={{@translatedLabel}}
@title={{@title}}
@icon={{@icon}}
@isLoading={{@isLoading}}
diff --git a/app/assets/javascripts/discourse/app/lib/admin-custom-themes-grid-cards.js b/app/assets/javascripts/discourse/app/lib/admin-custom-themes-grid-cards.js
new file mode 100644
index 00000000000..ee42b736fdb
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/lib/admin-custom-themes-grid-cards.js
@@ -0,0 +1,15 @@
+import AdminConfigAreaCard from "discourse/components/admin-config-area-card";
+
+const COMPONENTS_FOR_CUSTOM_CARDS = [];
+
+export function addCardToAdminThemesGrid(func) {
+ COMPONENTS_FOR_CUSTOM_CARDS.push(func(AdminConfigAreaCard));
+}
+
+export function resetCardsForAdminThemesGrid() {
+ COMPONENTS_FOR_CUSTOM_CARDS.length = 0;
+}
+
+export function getCardsForAdminThemesGrid() {
+ return COMPONENTS_FOR_CUSTOM_CARDS;
+}
diff --git a/app/assets/javascripts/discourse/app/lib/plugin-api.gjs b/app/assets/javascripts/discourse/app/lib/plugin-api.gjs
index 0518fc68a29..7abe9e7fb3d 100644
--- a/app/assets/javascripts/discourse/app/lib/plugin-api.gjs
+++ b/app/assets/javascripts/discourse/app/lib/plugin-api.gjs
@@ -58,6 +58,7 @@ import {
import { addUsernameSelectorDecorator } from "discourse/helpers/decorate-username-selector";
import { registerCustomAvatarHelper } from "discourse/helpers/user-avatar";
import { addBeforeAuthCompleteCallback } from "discourse/instance-initializers/auth-complete";
+import { addCardToAdminThemesGrid } from "discourse/lib/admin-custom-themes-grid-cards";
import { registerAdminPluginConfigNav } from "discourse/lib/admin-plugin-config-nav";
import { registerPluginHeaderActionComponent } from "discourse/lib/admin-plugin-header-actions";
import { registerReportModeComponent } from "discourse/lib/admin-report-additional-modes";
@@ -1288,7 +1289,7 @@ class PluginApi {
* });
* ```
*
- * This API is deprecated. See renderIntoOutlet instead.
+ * This API is deprecated. See renderInOutlet instead.
*
**/
registerConnectorClass(outletName, connectorName, klass) {
@@ -3420,6 +3421,36 @@ class PluginApi {
registerRichEditorExtension(extension);
}
+ /**
+ * Adds a card to the admin themes grid.
+ *
+ * ```js
+ * import Component from "@glimmer/component";
+ *
+ * api.addCardToAdminThemesGrid((adminConfigAreaCardComponent) => {
+ * return <template>
+ * <adminConfigAreaCardComponent class="my-custom-card">
+ * <:content>
+ * <!-- your custom card content goes here -->
+ * </:content>
+ * </adminConfigAreaCardComponent>
+ * </template>;
+ * });
+ * ```
+ *
+ * @param {Function} func - A function that returns a card component class.
+ *
+ * @callback func
+ * @param {AdminConfigAreaCard} adminConfigAreaCardComponent - The
+ * `AdminConfigAreaCard` class from core to be optionally used as a container
+ * for the card content.
+ * @returns {Component} - A Glimmer component class for the card to be added
+ * to the grid.
+ */
+ addCardToAdminThemesGrid(func) {
+ addCardToAdminThemesGrid(func);
+ }
+
#deprecatedWidgetOverride(widgetName, override) {
// insert here the code to handle widget deprecations, e.g. for the header widgets we used:
// if (DEPRECATED_HEADER_WIDGETS.includes(widgetName)) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-customize-components-config-area-test.gjs b/app/assets/javascripts/discourse/tests/acceptance/admin-customize-components-config-area-test.gjs
new file mode 100644
index 00000000000..1da77b87d3f
--- /dev/null
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-customize-components-config-area-test.gjs
@@ -0,0 +1,60 @@
+import { visit } from "@ember/test-helpers";
+import { test } from "qunit";
+import { withPluginApi } from "discourse/lib/plugin-api";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
+
+acceptance("Admin - Config areas - Components", function (needs) {
+ needs.user();
+
+ needs.pretender((server, helper) => {
+ server.get("/admin/config/customize/components", () => {
+ return helper.response({ components: [] });
+ });
+ });
+
+ test("admin-config-area-components-new-button plugin outlet", async function (assert) {
+ withPluginApi("0.1", (api) => {
+ api.renderInOutlet(
+ "admin-config-area-components-new-button",
+ <template>
+ <@actions.Primary
+ class="my-custom-button"
+ @translatedLabel="Hello world"
+ />
+ </template>
+ );
+ });
+
+ await visit("/admin/config/customize/components");
+ assert
+ .dom(".d-page-subheader .my-custom-button")
+ .exists("the custom button is rendered in the subheader actions list");
+ assert
+ .dom(".d-page-subheader .btn")
+ .exists(
+ { count: 1 },
+ "the default button is replaced by the custom button"
+ );
+ });
+
+ test("admin-config-area-components-empty-list-bottom plugin outlet", async function (assert) {
+ withPluginApi("0.1", (api) => {
+ api.renderInOutlet(
+ "admin-config-area-components-empty-list-bottom",
+ <template>
+ <div class="my-custom-empty-list">
+ Additional message shown at the bottom of the empty list.
+ </div>
+ </template>
+ );
+ });
+
+ await visit("/admin/config/customize/components");
+ assert
+ .dom(".my-custom-empty-list")
+ .hasText(
+ "Additional message shown at the bottom of the empty list.",
+ "the custom empty list message is rendered at the bottom"
+ );
+ });
+});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-customize-themes-config-area-test.gjs b/app/assets/javascripts/discourse/tests/acceptance/admin-customize-themes-config-area-test.gjs
new file mode 100644
index 00000000000..5d11a11b0f6
--- /dev/null
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-customize-themes-config-area-test.gjs
@@ -0,0 +1,61 @@
+import { visit } from "@ember/test-helpers";
+import { test } from "qunit";
+import { withPluginApi } from "discourse/lib/plugin-api";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
+
+acceptance("Admin - Config areas - Themes", function (needs) {
+ needs.user();
+
+ needs.pretender((server, helper) => {
+ server.get("/admin/config/customize/themes", () => {
+ return helper.response({ themes: [] });
+ });
+ });
+
+ test("custom cards in themes grid", async function (assert) {
+ withPluginApi("0.1", (api) => {
+ api.addCardToAdminThemesGrid((AdminConfigAreaCardComponent) => {
+ return <template>
+ <AdminConfigAreaCardComponent class="my-test-card">
+ <:content>
+ Hello, this is a test card.
+ </:content>
+ </AdminConfigAreaCardComponent>
+ </template>;
+ });
+ });
+
+ await visit("/admin/config/customize/themes");
+ assert
+ .dom(".my-test-card")
+ .hasText(
+ "Hello, this is a test card.",
+ "the custom card is rendered correctly"
+ );
+ });
+
+ test("admin-config-area-themes-new-button plugin outlet", async function (assert) {
+ withPluginApi("0.1", (api) => {
+ api.renderInOutlet(
+ "admin-config-area-themes-new-button",
+ <template>
+ <@actions.Primary
+ class="my-custom-button"
+ @translatedLabel="Hello world"
+ />
+ </template>
+ );
+ });
+
+ await visit("/admin/config/customize/themes");
+ assert
+ .dom(".d-page-subheader .my-custom-button")
+ .exists("the custom button is rendered in the subheader actions list");
+ assert
+ .dom(".d-page-subheader .btn")
+ .exists(
+ { count: 1 },
+ "the default button is replaced by the custom button"
+ );
+ });
+});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-customize-themes-show-test.gjs b/app/assets/javascripts/discourse/tests/acceptance/admin-customize-themes-show-test.gjs
new file mode 100644
index 00000000000..f09dc13cc57
--- /dev/null
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-customize-themes-show-test.gjs
@@ -0,0 +1,109 @@
+import { visit } from "@ember/test-helpers";
+import { test } from "qunit";
+import { withPluginApi } from "discourse/lib/plugin-api";
+import { acceptance } from "discourse/tests/helpers/qunit-helpers";
+
+acceptance("Admin - Customize - Themes - Show", function (needs) {
+ needs.user();
+
+ needs.pretender((server, helper) => {
+ server.get("/admin/themes", () => {
+ return helper.response({
+ themes: [
+ {
+ id: -1,
+ name: "Foundation",
+ description:
+ "The classic Discourse theme that is well-suited to customization for your community’s specific needs.",
+ created_at: "2025-06-11T23:50:31.187Z",
+ updated_at: "2025-06-12T03:09:26.162Z",
+ default: true,
+ component: false,
+ color_scheme_id: 6,
+ user_selectable: false,
+ auto_update: false,
+ remote_theme_id: null,
+ settings: [],
+ supported: true,
+ enabled: true,
+ theme_fields: [
+ {
+ name: "screenshot_light",
+ target: "common",
+ value: "",
+ type_id: 7,
+ upload_id: 83,
+ url: "/uploads/default/original/1X/f8a61b9a0bfac672daec9e401787812f8c5e28df.png",
+ filename: "light.png",
+ },
+ {
+ name: "screenshot_dark",
+ target: "common",
+ value: "",
+ type_id: 7,
+ upload_id: 84,
+ url: "/uploads/default/original/1X/783d7817fd5e44b15d3532ffb13d2f70174a039f.png",
+ filename: "dark.png",
+ },
+ {
+ name: "en",
+ target: "translations",
+ value:
+ 'en:\n theme_metadata:\n description: "The classic Discourse theme that is well-suited to customization for your community’s specific needs."\n',
+ type_id: 5,
+ },
+ ],
+ screenshot_url:
+ "/uploads/default/original/1X/f8a61b9a0bfac672daec9e401787812f8c5e28df.png",
+ system: true,
+ color_scheme: null,
+ owned_color_palette: null,
+ user: {
+ id: -1,
+ username: "system",
+ name: "system",
+ avatar_template: "/images/discourse-logo-sketch-small.png",
+ title: null,
+ },
+ child_themes: [],
+ parent_themes: [],
+ remote_theme: null,
+ translations: [],
+ },
+ ],
+ });
+ });
+
+ server.get("/admin/config/customize/themes", () => {
+ return helper.response({ themes: [] });
+ });
+ });
+
+ test("admin-customize-theme-included-components-setting plugin outlet", async function (assert) {
+ withPluginApi("0.1", (api) => {
+ api.renderInOutlet(
+ "admin-customize-theme-included-components-setting",
+ <template>
+ <p class="custom-element-in-place-of-included-components">
+ This is a custom element that replaces the included components
+ setting.
+ </p>
+ </template>
+ );
+ });
+
+ await visit("/admin/customize/themes/-1");
+ assert
+ .dom(".included-components-setting .select-kit")
+ .doesNotExist(
+ "the included components setting is replaced by a custom element"
+ );
+ assert
+ .dom(
+ ".included-components-setting .custom-element-in-place-of-included-components"
+ )
+ .hasText(
+ "This is a custom element that replaces the included components setting."
+ );
+ });
+});
diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
index ebcaa91cfd4..77236410062 100644
--- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
+++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
@@ -35,6 +35,7 @@ import { resetCustomPostMessageCallbacks } from "discourse/controllers/topic";
import { clearHTMLCache } from "discourse/helpers/custom-html";
import { resetUsernameDecorators } from "discourse/helpers/decorate-username-selector";
import { resetBeforeAuthCompleteCallbacks } from "discourse/instance-initializers/auth-complete";
+import { resetCardsForAdminThemesGrid } from "discourse/lib/admin-custom-themes-grid-cards";
import { resetAdminPluginConfigNav } from "discourse/lib/admin-plugin-config-nav";
import { clearPluginHeaderActionComponents } from "discourse/lib/admin-plugin-header-actions";
import { resetAdditionalReportModes } from "discourse/lib/admin-report-additional-modes";
@@ -271,6 +272,7 @@ export function testCleanup(container, app) {
resetGroupPostSmallActionCodes();
resetPostSmallActionClassesCallbacks();
resetPostClassesCallback();
+ resetCardsForAdminThemesGrid();
}
function cleanupCssGeneratorTags() {