Skip to content

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

UX: Add subheader to admin themes page (#32987)

Ted Johansson727bd5dcfb25
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 ac355e8a32d..789da1770cd 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
@@ -172,7 +172,6 @@ export default class AdminConfigAreasComponents extends Component {
>
<:actions as |actions|>
<actions.Primary
- disabled={{this.loading}}
@label="admin.config_areas.themes_and_components.components.install"
@action={{this.installModal}}
/>
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 b9944eb8c3a..3af3feee951 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
@@ -3,8 +3,8 @@ import { action } from "@ember/object";
import { next } from "@ember/runloop";
import { service } from "@ember/service";
import { isPresent } from "@ember/utils";
+import DPageSubheader from "discourse/components/d-page-subheader";
import { i18n } from "discourse-i18n";
-import InstallThemeCard from "admin/components/admin-config-area-cards/install-theme-card";
import InstallThemeModal from "admin/components/modal/install-theme";
import ThemesGrid from "admin/components/themes-grid";
import { THEMES } from "admin/models/theme";
@@ -82,12 +82,23 @@ export default class AdminConfigAreasThemes extends Component {
}
<template>
+ <DPageSubheader
+ @titleLabel={{i18n
+ "admin.config_areas.themes_and_components.themes.title"
+ }}
+ @descriptionLabel={{i18n
+ "admin.config_areas.themes_and_components.themes.description"
+ }}
+ >
+ <:actions as |actions|>
+ <actions.Primary
+ @label="admin.config_areas.themes_and_components.themes.install"
+ @action={{this.installModal}}
+ />
+ </:actions>
+ </DPageSubheader>
<div class="admin-detail">
- <ThemesGrid @themes={{@themes}}>
- <:specialCard>
- <InstallThemeCard @openModal={{this.installModal}} />
- </:specialCard>
- </ThemesGrid>
+ <ThemesGrid @themes={{@themes}} />
</div>
</template>
}
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js
index 8f3ec257941..1bd4b0280bf 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js
@@ -86,7 +86,7 @@ acceptance("Admin - Themes - Install modal", function (needs) {
const themeUrl = "[email protected]:discourse/discourse.git";
await visit("/admin/config/customize/themes");
- await click(".theme-install-card__install-button");
+ await click(".d-page-subheader__actions .btn-primary");
await click("#remote");
await fillIn(urlInput, themeUrl);
await click(".install-theme-content .inputs .advanced-repo");
@@ -97,7 +97,7 @@ acceptance("Admin - Themes - Install modal", function (needs) {
await click(".d-modal__footer .d-modal-cancel");
- await click(".theme-install-card__install-button");
+ await click(".d-page-subheader__actions .btn-primary");
await click("#remote");
await click(".install-theme-content .inputs .advanced-repo");
assert.dom(urlInput).hasValue("", "url input is reset");
@@ -114,7 +114,7 @@ acceptance("Admin - Themes - Install modal", function (needs) {
"[email protected]:/TEST_THEME/test-theme.git";
await visit("/admin/customize/themes");
- await click(".theme-install-card__install-button");
+ await click(".d-page-subheader__actions .btn-primary");
await click("#remote");
await fillIn(urlInput, themeUrl);
await click(".install-theme-content .inputs .advanced-repo");
@@ -162,7 +162,7 @@ acceptance("Admin - Themes - Install modal", function (needs) {
test("installed themes are matched with the popular list by URL", async function (assert) {
await visit("/admin/config/customize/themes");
- await click(".theme-install-card__install-button");
+ await click(".d-page-subheader__actions .btn-primary");
assert
.dom(
diff --git a/app/assets/javascripts/discourse/tests/acceptance/themes-test.js b/app/assets/javascripts/discourse/tests/acceptance/themes-test.js
index f9d09125ebd..ce72687ff06 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/themes-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/themes-test.js
@@ -166,7 +166,7 @@ acceptance("Theme", function (needs) {
test("can force install themes", async function (assert) {
await visit("/admin/config/customize/themes");
- await click(".theme-install-card .btn-primary");
+ await click(".d-page-subheader__actions .btn-primary");
await click(".install-theme-items #remote");
await fillIn(
".install-theme-content .repo input",
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 852d5870a88..d10976e1857 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -6339,9 +6339,11 @@ en:
install: "Install"
themes:
title: "Themes"
+ description: "Site-wide themes that change the overall look and feel of your site for all users."
themes_intro: "Install a new theme to get started, or create your own from scratch using these resources."
new_theme: "New theme"
back: "Back to themes"
+ install: "Install"
components:
title: "Components"
description: "Customizations that change surface elements of your forum design, or add extra front-end features"
diff --git a/spec/system/admin_customize_themes_config_area_spec.rb b/spec/system/admin_customize_themes_config_area_spec.rb
index 807d03416e3..dc3699af369 100644
--- a/spec/system/admin_customize_themes_config_area_spec.rb
+++ b/spec/system/admin_customize_themes_config_area_spec.rb
@@ -14,14 +14,10 @@ describe "Admin Customize Themes Config Area Page", type: :system do
before { sign_in(admin) }
- it "has a special card for installing new themes" do
+ it "has an install button in the subheader" do
config_area.visit
- expect(config_area.install_card).to have_text(
- I18n.t("admin_js.admin.config_areas.themes_and_components.themes.new_theme"),
- )
-
- config_area.install_card.find(".btn-primary").click
+ config_area.subheader.find(".btn-primary").click
expect(install_modal).to be_open
expect(install_modal.popular_options.first).to have_text("Air")
end
diff --git a/spec/system/page_objects/pages/admin_customize_themes_config_area.rb b/spec/system/page_objects/pages/admin_customize_themes_config_area.rb
index c21df919c6b..b91d56f86ee 100644
--- a/spec/system/page_objects/pages/admin_customize_themes_config_area.rb
+++ b/spec/system/page_objects/pages/admin_customize_themes_config_area.rb
@@ -11,8 +11,8 @@ module PageObjects
find(".theme-card.#{theme.name.parameterize}")
end
- def install_card
- find(".theme-install-card")
+ def subheader
+ find(".d-page-subheader")
end
def open_theme_menu(theme)