2024-09-10 13:16:16 +08:00
|
|
|
import Component from "@glimmer/component";
|
2024-08-20 07:59:43 +08:00
|
|
|
import { hash } from "@ember/helper";
|
2024-10-08 06:28:32 +08:00
|
|
|
import { service } from "@ember/service";
|
2024-08-21 08:42:00 +08:00
|
|
|
import { htmlSafe } from "@ember/template";
|
2024-10-08 06:28:32 +08:00
|
|
|
import DropdownMenu from "discourse/components/dropdown-menu";
|
2024-08-20 07:59:43 +08:00
|
|
|
import i18n from "discourse-common/helpers/i18n";
|
|
|
|
import {
|
2024-10-08 06:28:32 +08:00
|
|
|
DangerActionListItem,
|
2024-08-20 07:59:43 +08:00
|
|
|
DangerButton,
|
2024-10-08 06:28:32 +08:00
|
|
|
DefaultActionListItem,
|
2024-08-20 07:59:43 +08:00
|
|
|
DefaultButton,
|
2024-10-08 06:28:32 +08:00
|
|
|
PrimaryActionListItem,
|
2024-08-20 07:59:43 +08:00
|
|
|
PrimaryButton,
|
2024-10-08 06:28:32 +08:00
|
|
|
WrappedActionListItem,
|
|
|
|
WrappedButton,
|
2024-08-20 07:59:43 +08:00
|
|
|
} from "admin/components/admin-page-action-button";
|
2024-10-08 06:28:32 +08:00
|
|
|
import DMenu from "float-kit/components/d-menu";
|
2024-08-20 07:59:43 +08:00
|
|
|
|
2024-09-10 13:16:16 +08:00
|
|
|
export default class AdminPageSubheader extends Component {
|
2024-10-08 06:28:32 +08:00
|
|
|
@service site;
|
|
|
|
|
2024-09-10 13:16:16 +08:00
|
|
|
get title() {
|
|
|
|
if (this.args.titleLabelTranslated) {
|
|
|
|
return this.args.titleLabelTranslated;
|
|
|
|
} else if (this.args.titleLabel) {
|
|
|
|
return i18n(this.args.titleLabel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
get description() {
|
|
|
|
if (this.args.descriptionLabelTranslated) {
|
|
|
|
return this.args.descriptionLabelTranslated;
|
|
|
|
} else if (this.args.descriptionLabel) {
|
|
|
|
return i18n(this.args.descriptionLabel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="admin-page-subheader">
|
|
|
|
<div class="admin-page-subheader__title-row">
|
2024-10-10 15:18:26 +08:00
|
|
|
<h2 class="admin-page-subheader__title">{{this.title}}</h2>
|
2024-10-08 06:28:32 +08:00
|
|
|
{{#if (has-block "actions")}}
|
|
|
|
<div class="admin-page-subheader__actions">
|
|
|
|
{{#if this.site.mobileView}}
|
|
|
|
<DMenu
|
|
|
|
@identifier="admin-page-subheader-mobile-actions"
|
|
|
|
@title={{i18n "more_options"}}
|
|
|
|
@icon="ellipsis-vertical"
|
|
|
|
class="btn-small"
|
|
|
|
>
|
|
|
|
<:content>
|
|
|
|
<DropdownMenu class="admin-page-subheader__mobile-actions">
|
|
|
|
{{yield
|
|
|
|
(hash
|
|
|
|
Primary=PrimaryActionListItem
|
|
|
|
Default=DefaultActionListItem
|
|
|
|
Danger=DangerActionListItem
|
|
|
|
Wrapped=WrappedActionListItem
|
|
|
|
)
|
|
|
|
to="actions"
|
|
|
|
}}
|
|
|
|
</DropdownMenu>
|
|
|
|
</:content>
|
|
|
|
</DMenu>
|
|
|
|
{{else}}
|
|
|
|
{{yield
|
|
|
|
(hash
|
|
|
|
Primary=PrimaryButton
|
|
|
|
Default=DefaultButton
|
|
|
|
Danger=DangerButton
|
|
|
|
Wrapped=WrappedButton
|
|
|
|
)
|
|
|
|
to="actions"
|
|
|
|
}}
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
2024-08-20 07:59:43 +08:00
|
|
|
</div>
|
2024-08-21 08:42:00 +08:00
|
|
|
|
2024-09-10 13:16:16 +08:00
|
|
|
{{#if this.description}}
|
|
|
|
<p class="admin-page-subheader__description">
|
|
|
|
{{htmlSafe this.description}}
|
2024-08-21 08:42:00 +08:00
|
|
|
{{#if @learnMoreUrl}}
|
2024-09-11 11:27:58 +08:00
|
|
|
<span class="admin-page-subheader__learn-more">
|
|
|
|
{{htmlSafe
|
|
|
|
(i18n "learn_more_with_link" url=@learnMoreUrl)
|
|
|
|
}}</span>
|
2024-08-21 08:42:00 +08:00
|
|
|
{{/if}}
|
|
|
|
</p>
|
|
|
|
{{/if}}
|
2024-08-20 07:59:43 +08:00
|
|
|
</div>
|
2024-09-10 13:16:16 +08:00
|
|
|
</template>
|
|
|
|
}
|