From d144826fa70a030fe1b95cc9dbdefd32f7693899 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Wed, 15 Jan 2025 16:53:45 +1100 Subject: [PATCH] UX: Use `DPageHeader` on the Email Style page (#30784) Update the header of the admin Email Style page to be more consistent with the rest of the admin UI. The HTML/CSS tabs have also been updated, which required an extra check being added to the NavItem component. --- .../addon/components/email-styles-editor.hbs | 27 --------------- .../addon/templates/customize-email-style.hbs | 34 +++++++++++++++---- .../discourse/app/components/nav-item.gjs | 34 +++++++++++-------- config/locales/client.en.yml | 4 +-- 4 files changed, 49 insertions(+), 50 deletions(-) diff --git a/app/assets/javascripts/admin/addon/components/email-styles-editor.hbs b/app/assets/javascripts/admin/addon/components/email-styles-editor.hbs index b3aec8080c9..152eca1bd2c 100644 --- a/app/assets/javascripts/admin/addon/components/email-styles-editor.hbs +++ b/app/assets/javascripts/admin/addon/components/email-styles-editor.hbs @@ -1,30 +1,3 @@ -
-
- -
-
- -

{{i18n "admin.customize.email_style.heading"}}

+ + <:breadcrumbs> + + + + <:tabs> + + + + -

{{i18n "admin.customize.email_style.instructions"}}

- - -{{outlet}} \ No newline at end of file +
+ {{outlet}} +
\ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/components/nav-item.gjs b/app/assets/javascripts/discourse/app/components/nav-item.gjs index 5ec2772f467..bbe77b49d36 100644 --- a/app/assets/javascripts/discourse/app/components/nav-item.gjs +++ b/app/assets/javascripts/discourse/app/components/nav-item.gjs @@ -24,22 +24,26 @@ export default class NavItem extends Component { return; } - // This is needed because the setting route is underneath /admin/plugins/:plugin_id, - // but is not a child route of the plugin routes themselves. E.g. discourse-ai - // for the plugin ID has its own nested routes defined in the plugin. - if (this.router.currentRoute.name === "adminPlugins.show.settings") { - return ( - this.router.currentRoute.parent.params.plugin_id === - this.args.routeParam - ); - } + if (this.args.routeParam) { + // This is needed because the setting route is underneath /admin/plugins/:plugin_id, + // but is not a child route of the plugin routes themselves. E.g. discourse-ai + // for the plugin ID has its own nested routes defined in the plugin. + if (this.router.currentRoute.name === "adminPlugins.show.settings") { + return ( + this.router.currentRoute.parent.params.plugin_id === + this.args.routeParam + ); + } - if ( - this.args.routeParam && - this.router.currentRoute && - this.router.currentRoute.params.filter - ) { - return this.router.currentRoute.params.filter === this.args.routeParam; + if (this.router.currentRoute.params.filter) { + return this.router.currentRoute.params.filter === this.args.routeParam; + } + + if (this.router.currentRoute.params.field_name) { + return ( + this.router.currentRoute.params.field_name === this.args.routeParam + ); + } } return this.router.isActive(this.args.route); diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 2f92bc409a4..0bf210956e0 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -6324,8 +6324,8 @@ en: overridden: Your site's default robots.txt file is overridden. email_style: title: "Email Style" - heading: "Customize Email Style" - html: "HTML Template" + heading: "Customize email style" + html: "HTML" css: "CSS" reset: "Reset to default" reset_confirm: "Are you sure you want to reset to the default %{fieldName} and lose all your changes?"