mirror of
https://github.com/discourse/discourse.git
synced 2025-04-25 15:34:31 +08:00
DEV: Add before / after header-buttons plugin outlets (#25887)
This commit is contained in:
parent
e440996aca
commit
8805a34001
@ -17,6 +17,7 @@ import HamburgerDropdownWrapper from "./glimmer-header/hamburger-dropdown-wrappe
|
|||||||
import Icons from "./glimmer-header/icons";
|
import Icons from "./glimmer-header/icons";
|
||||||
import SearchMenuWrapper from "./glimmer-header/search-menu-wrapper";
|
import SearchMenuWrapper from "./glimmer-header/search-menu-wrapper";
|
||||||
import UserMenuWrapper from "./glimmer-header/user-menu-wrapper";
|
import UserMenuWrapper from "./glimmer-header/user-menu-wrapper";
|
||||||
|
import PluginOutlet from "./plugin-outlet";
|
||||||
|
|
||||||
const SEARCH_BUTTON_ID = "search-button";
|
const SEARCH_BUTTON_ID = "search-button";
|
||||||
|
|
||||||
@ -177,6 +178,10 @@ export default class GlimmerHeader extends Component {
|
|||||||
@toggleHamburger={{this.toggleHamburger}}
|
@toggleHamburger={{this.toggleHamburger}}
|
||||||
@showSidebar={{@showSidebar}}
|
@showSidebar={{@showSidebar}}
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<span class="header-buttons">
|
||||||
|
<PluginOutlet @name="before-header-buttons" />
|
||||||
|
|
||||||
{{#unless this.currentUser}}
|
{{#unless this.currentUser}}
|
||||||
<AuthButtons
|
<AuthButtons
|
||||||
@showCreateAccount={{@showCreateAccount}}
|
@showCreateAccount={{@showCreateAccount}}
|
||||||
@ -184,6 +189,10 @@ export default class GlimmerHeader extends Component {
|
|||||||
@canSignUp={{@canSignUp}}
|
@canSignUp={{@canSignUp}}
|
||||||
/>
|
/>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
|
||||||
|
<PluginOutlet @name="after-header-buttons" />
|
||||||
|
</span>
|
||||||
|
|
||||||
{{#if
|
{{#if
|
||||||
(not (and this.siteSettings.login_required (not this.currentUser)))
|
(not (and this.siteSettings.login_required (not this.currentUser)))
|
||||||
}}
|
}}
|
||||||
|
@ -8,7 +8,7 @@ export default class AuthButtons extends Component {
|
|||||||
@service header;
|
@service header;
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<span class="header-buttons">
|
<span class="auth-buttons">
|
||||||
{{#if (and @canSignUp (not this.header.topic))}}
|
{{#if (and @canSignUp (not this.header.topic))}}
|
||||||
<DButton
|
<DButton
|
||||||
class="btn-primary btn-small sign-up-button"
|
class="btn-primary btn-small sign-up-button"
|
||||||
|
@ -300,7 +300,7 @@ createWidget("header-icons", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
createWidget("header-buttons", {
|
createWidget("header-buttons", {
|
||||||
tagName: "span.header-buttons",
|
tagName: "span.auth-buttons",
|
||||||
|
|
||||||
html(attrs) {
|
html(attrs) {
|
||||||
if (this.currentUser) {
|
if (this.currentUser) {
|
||||||
@ -535,7 +535,22 @@ export default createWidget("header", {
|
|||||||
return headerIcons;
|
return headerIcons;
|
||||||
}
|
}
|
||||||
|
|
||||||
const panels = [this.attach("header-buttons", attrs), headerIcons];
|
const panels = [
|
||||||
|
h("span.header-buttons", [
|
||||||
|
new RenderGlimmer(
|
||||||
|
this,
|
||||||
|
"span.before-header-buttons",
|
||||||
|
hbs`<PluginOutlet @name="before-header-buttons"/>`
|
||||||
|
),
|
||||||
|
this.attach("header-buttons", attrs),
|
||||||
|
new RenderGlimmer(
|
||||||
|
this,
|
||||||
|
"span.after-header-buttons",
|
||||||
|
hbs`<PluginOutlet @name="after-header-buttons"/>`
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
headerIcons,
|
||||||
|
];
|
||||||
|
|
||||||
if (this.search.visible) {
|
if (this.search.visible) {
|
||||||
this.search.inTopicContext = this.search.inTopicContext && inTopicRoute;
|
this.search.inTopicContext = this.search.inTopicContext && inTopicRoute;
|
||||||
|
@ -106,6 +106,10 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 0.2em;
|
margin-top: 0.2em;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
||||||
|
.auth-buttons {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-button,
|
.login-button,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user