rename 'look and feel' -> 'themes and components'

This commit is contained in:
OsamaSayegh
2025-02-02 02:14:45 +03:00
parent 10566d84b9
commit c540132fed
23 changed files with 101 additions and 91 deletions

View File

@@ -7,7 +7,7 @@ import InstallThemeModal from "admin/components/modal/install-theme";
import ThemesGrid from "admin/components/themes-grid";
import { COMPONENTS } from "admin/models/theme";
export default class AdminConfigAreasLookAndFeelComponents extends Component {
export default class AdminConfigAreasComponents extends Component {
@service modal;
@service router;
@service toasts;
@@ -50,7 +50,9 @@ export default class AdminConfigAreasLookAndFeelComponents extends Component {
<template>
<DPageSubheader
@titleLabel={{i18n "admin.config_areas.look_and_feel.components.title"}}
@titleLabel={{i18n
"admin.config_areas.themes_and_components.components.title"
}}
@descriptionLabel={{i18n "admin.customize.theme.components_intro_new"}}
@learnMoreUrl="https://meta.discourse.org/t/93648"
>
@@ -59,7 +61,7 @@ export default class AdminConfigAreasLookAndFeelComponents extends Component {
@action={{this.installModal}}
@label="admin.customize.install"
@icon="upload"
class="admin-look-and-feel__install-theme"
class="admin-themes-and-components__install-theme"
/>
</:actions>
</DPageSubheader>

View File

@@ -7,7 +7,7 @@ import InstallThemeModal from "admin/components/modal/install-theme";
import ThemesGrid from "admin/components/themes-grid";
import { THEMES } from "admin/models/theme";
export default class AdminConfigAreasLookAndFeelThemes extends Component {
export default class AdminConfigAreasThemes extends Component {
@service modal;
@service router;
@service toasts;
@@ -50,7 +50,9 @@ export default class AdminConfigAreasLookAndFeelThemes extends Component {
<template>
<DPageSubheader
@titleLabel={{i18n "admin.config_areas.look_and_feel.themes.title"}}
@titleLabel={{i18n
"admin.config_areas.themes_and_components.themes.title"
}}
@descriptionLabel={{i18n "admin.customize.theme.themes_intro_new"}}
@learnMoreUrl="https://meta.discourse.org/t/93648"
>
@@ -59,7 +61,7 @@ export default class AdminConfigAreasLookAndFeelThemes extends Component {
@action={{this.installModal}}
@label="admin.customize.install"
@icon="upload"
class="admin-look-and-feel__install-theme"
class="admin-themes-and-components__install-theme"
/>
</:actions>
</DPageSubheader>

View File

@@ -1,10 +0,0 @@
import { service } from "@ember/service";
import DiscourseRoute from "discourse/routes/discourse";
export default class AdminConfigLookAndFeelIndexRoute extends DiscourseRoute {
@service router;
beforeModel() {
this.router.replaceWith("adminConfig.lookAndFeel.themes");
}
}

View File

@@ -1,13 +1,13 @@
import DiscourseRoute from "discourse/routes/discourse";
import { i18n } from "discourse-i18n";
export default class AdminConfigLookAndFeelComponentsRoute extends DiscourseRoute {
export default class AdminConfigThemesAndComponentsComponentsRoute extends DiscourseRoute {
async model() {
const themes = await this.store.findAll("theme");
return themes.reject((t) => !t.component);
}
titleToken() {
return i18n("admin.config_areas.look_and_feel.components.title");
return i18n("admin.config_areas.themes_and_components.components.title");
}
}

View File

@@ -0,0 +1,10 @@
import { service } from "@ember/service";
import DiscourseRoute from "discourse/routes/discourse";
export default class AdminConfigThemesAndComponentsIndexRoute extends DiscourseRoute {
@service router;
beforeModel() {
this.router.replaceWith("adminConfig.themesAndComponents.themes");
}
}

View File

@@ -1,13 +1,13 @@
import DiscourseRoute from "discourse/routes/discourse";
import { i18n } from "discourse-i18n";
export default class AdminConfigLookAndFeelThemesRoute extends DiscourseRoute {
export default class AdminConfigThemesAndComponentsThemesRoute extends DiscourseRoute {
async model() {
const themes = await this.store.findAll("theme");
return themes.reject((t) => t.component);
}
titleToken() {
return i18n("admin.config_areas.look_and_feel.themes.title");
return i18n("admin.config_areas.themes_and_components.themes.title");
}
}

View File

@@ -2,10 +2,10 @@ import { service } from "@ember/service";
import DiscourseRoute from "discourse/routes/discourse";
import { i18n } from "discourse-i18n";
export default class AdminConfigLookAndFeelRoute extends DiscourseRoute {
export default class AdminConfigThemesAndComponentsRoute extends DiscourseRoute {
@service router;
titleToken() {
return i18n("admin.config_areas.look_and_feel.title");
return i18n("admin.config_areas.themes_and_components.title");
}
}

View File

@@ -271,10 +271,14 @@ export default function () {
path: "/",
});
});
this.route("lookAndFeel", { path: "/look-and-feel" }, function () {
this.route("themes");
this.route("components");
});
this.route(
"themesAndComponents",
{ path: "/themes-and-components" },
function () {
this.route("themes");
this.route("components");
}
);
this.route(
"adminPermalinks",
{ path: "/permalinks", resetNamespace: true },

View File

@@ -1,6 +0,0 @@
<DBreadcrumbsItem
@path="/admin/config/look-and-feel/components"
@label={{i18n "admin.config_areas.look_and_feel.components.title"}}
/>
<AdminConfigAreas::LookAndFeelComponents @components={{this.model}} />

View File

@@ -1,6 +0,0 @@
<DBreadcrumbsItem
@path="/admin/config/look-and-feel/themes"
@label={{i18n "admin.config_areas.look_and_feel.themes.title"}}
/>
<AdminConfigAreas::LookAndFeelThemes @themes={{this.model}} />

View File

@@ -1,28 +0,0 @@
<DPageHeader
@titleLabel={{i18n "admin.config_areas.look_and_feel.title"}}
@descriptionLabel={{i18n "admin.config_areas.look_and_feel.description"}}
@learnMoreUrl="https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966"
>
<:breadcrumbs>
<DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
<DBreadcrumbsItem
@path="/admin/config/look-and-feel"
@label={{i18n "admin.config_areas.look_and_feel.title"}}
/>
</:breadcrumbs>
<:tabs>
<NavItem
@route="adminConfig.lookAndFeel.themes"
@label="admin.config_areas.look_and_feel.themes.title"
/>
<NavItem
@route="adminConfig.lookAndFeel.components"
@label="admin.config_areas.look_and_feel.components.title"
/>
</:tabs>
</DPageHeader>
<div class="admin-container admin-config-page__main-area">
{{outlet}}
</div>

View File

@@ -0,0 +1,6 @@
<DBreadcrumbsItem
@path="/admin/config/themes-and-components/components"
@label={{i18n "admin.config_areas.themes_and_components.components.title"}}
/>
<AdminConfigAreas::Components @components={{this.model}} />

View File

@@ -0,0 +1,6 @@
<DBreadcrumbsItem
@path="/admin/config/themes-and-components/themes"
@label={{i18n "admin.config_areas.themes_and_components.themes.title"}}
/>
<AdminConfigAreas::Themes @themes={{this.model}} />

View File

@@ -0,0 +1,30 @@
<DPageHeader
@titleLabel={{i18n "admin.config_areas.themes_and_components.title"}}
@descriptionLabel={{i18n
"admin.config_areas.themes_and_components.description"
}}
@learnMoreUrl="https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966"
>
<:breadcrumbs>
<DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
<DBreadcrumbsItem
@path="/admin/config/themes-and-components"
@label={{i18n "admin.config_areas.themes_and_components.title"}}
/>
</:breadcrumbs>
<:tabs>
<NavItem
@route="adminConfig.themesAndComponents.themes"
@label="admin.config_areas.themes_and_components.themes.title"
/>
<NavItem
@route="adminConfig.themesAndComponents.components"
@label="admin.config_areas.themes_and_components.components.title"
/>
</:tabs>
</DPageHeader>
<div class="admin-container admin-config-page__main-area">
{{outlet}}
</div>

View File

@@ -2,20 +2,20 @@
{{outlet}}
{{else}}
{{#if this.currentUser.use_admin_sidebar}}
<div class="back-to-look-and-feel">
<div class="back-to-themes-and-components">
<LinkTo
@route={{if
this.model.component
"adminConfig.lookAndFeel.components"
"adminConfig.lookAndFeel.themes"
"adminConfig.themesAndComponents.components"
"adminConfig.themesAndComponents.themes"
}}
>
{{dIcon "angle-left"}}
{{i18n
(if
this.model.component
"admin.config_areas.look_and_feel.components.back"
"admin.config_areas.look_and_feel.themes.back"
"admin.config_areas.themes_and_components.components.back"
"admin.config_areas.themes_and_components.themes.back"
)
}}
</LinkTo>

View File

@@ -134,9 +134,9 @@ export const ADMIN_NAV_MAP = [
},
{
name: "admin_themes_and_components",
route: "adminConfig.lookAndFeel.themes",
route: "adminConfig.themesAndComponents.themes",
currentWhen:
"adminConfig.lookAndFeel.themes adminConfig.lookAndFeel.components",
"adminConfig.themesAndComponents.themes adminConfig.themesAndComponents.components",
label: "admin.appearance.sidebar_link.themes_and_components.title",
icon: "paintbrush",
keywords:

View File

@@ -18,7 +18,7 @@
width: 28%;
}
.back-to-look-and-feel {
.back-to-themes-and-components {
margin-bottom: 1em;
}
}

View File

@@ -1,6 +1,6 @@
# frozen_string_literal: true
class Admin::Config::LookAndFeelController < Admin::AdminController
class Admin::Config::ThemesAndComponentsController < Admin::AdminController
def themes
end

View File

@@ -5851,8 +5851,8 @@ en:
delete: "Delete"
more_options:
title: "More options"
look_and_feel:
title: "Look and feel"
themes_and_components:
title: "Themes and components"
description: "Customize and brand your Discourse site, giving it a distinctive style."
themes:
title: "Themes"

View File

@@ -418,13 +418,13 @@ Discourse::Application.routes.draw do
collection { put "/" => "about#update" }
end
resources :look_and_feel,
path: "look-and-feel",
resources :themes_and_components,
path: "themes-and-components",
constraints: AdminConstraint.new,
only: %i[index] do
collection do
get "/themes" => "look_and_feel#themes"
get "/components" => "look_and_feel#components"
get "/themes" => "themes_and_components#themes"
get "/components" => "themes_and_components#components"
end
end
end

View File

@@ -205,7 +205,7 @@ describe "Admin Customize Themes", type: :system do
end
context "when visting a theme's page" do
it "has a link to the themes 'look and feel' page" do
it "has a link to the themes page" do
visit("/admin/customize/themes/#{theme.id}")
expect(admin_customize_themes_page).to have_back_button_to_themes_page
end
@@ -214,7 +214,7 @@ describe "Admin Customize Themes", type: :system do
context "when visting a component's page" do
fab!(:component) { Fabricate(:theme, component: true, name: "Cool component 493") }
it "has a link to the components 'look and feel' page" do
it "has a link to the components page" do
visit("/admin/customize/themes/#{component.id}")
expect(admin_customize_themes_page).to have_back_button_to_components_page
end

View File

@@ -311,15 +311,15 @@ describe "Admin | Sidebar Navigation", type: :system do
expect(links.map(&:text)).to eq(["Themes and components"])
end
it "highlights the 'Themes and components' link when the 'Look and feel' themes page is visited" do
visit("/admin/config/look-and-feel/themes")
it "highlights the 'Themes and components' link when the themes page is visited" do
visit("/admin/config/themes-and-components/themes")
expect(page).to have_css(
'.sidebar-section-link-wrapper[data-list-item-name="admin_themes_and_components"] a.active',
)
end
it "highlights the 'Themes and components' link when the 'Look and feel' components page is visited" do
visit("/admin/config/look-and-feel/components")
it "highlights the 'Themes and components' link when the components page is visited" do
visit("/admin/config/themes-and-components/components")
expect(page).to have_css(
'.sidebar-section-link-wrapper[data-list-item-name="admin_themes_and_components"] a.active',
)

View File

@@ -33,15 +33,15 @@ module PageObjects
def has_back_button_to_themes_page?
has_css?(
'.back-to-look-and-feel a[href="/admin/config/look-and-feel/themes"]',
text: I18n.t("admin_js.admin.config_areas.look_and_feel.themes.back"),
'.back-to-themes-and-components a[href="/admin/config/themes-and-components/themes"]',
text: I18n.t("admin_js.admin.config_areas.themes_and_components.themes.back"),
)
end
def has_back_button_to_components_page?
has_css?(
'.back-to-look-and-feel a[href="/admin/config/look-and-feel/components"]',
text: I18n.t("admin_js.admin.config_areas.look_and_feel.components.back"),
'.back-to-themes-and-components a[href="/admin/config/themes-and-components/components"]',
text: I18n.t("admin_js.admin.config_areas.themes_and_components.components.back"),
)
end