2024-03-13 11:15:12 +08:00
|
|
|
import Component from "@glimmer/component";
|
2024-06-07 09:31:46 +08:00
|
|
|
import { service } from "@ember/service";
|
2024-05-20 12:25:54 +08:00
|
|
|
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
|
2024-09-10 13:16:16 +08:00
|
|
|
import NavItem from "discourse/components/nav-item";
|
2024-10-08 06:28:32 +08:00
|
|
|
import { headerActionComponentForPlugin } from "discourse/lib/admin-plugin-header-actions";
|
2024-05-20 12:25:54 +08:00
|
|
|
import i18n from "discourse-common/helpers/i18n";
|
2024-09-10 13:16:16 +08:00
|
|
|
import AdminPageHeader from "./admin-page-header";
|
2024-03-13 11:15:12 +08:00
|
|
|
import AdminPluginConfigArea from "./admin-plugin-config-area";
|
|
|
|
|
2024-05-02 09:36:46 +08:00
|
|
|
export default class AdminPluginConfigPage extends Component {
|
2024-03-13 11:15:12 +08:00
|
|
|
@service currentUser;
|
2024-03-21 11:42:06 +08:00
|
|
|
@service adminPluginNavManager;
|
2024-03-13 11:15:12 +08:00
|
|
|
|
|
|
|
get mainAreaClasses() {
|
|
|
|
let classes = ["admin-plugin-config-page__main-area"];
|
|
|
|
|
2024-03-21 11:42:06 +08:00
|
|
|
if (this.adminPluginNavManager.isSidebarMode) {
|
2024-03-13 11:15:12 +08:00
|
|
|
classes.push("-with-inner-sidebar");
|
|
|
|
} else {
|
|
|
|
classes.push("-without-inner-sidebar");
|
|
|
|
}
|
|
|
|
|
|
|
|
return classes.join(" ");
|
|
|
|
}
|
|
|
|
|
2024-09-30 12:35:23 +08:00
|
|
|
get actionsOutletName() {
|
2024-10-08 06:28:32 +08:00
|
|
|
return `admin-plugin-config-page-actions-${this.args.plugin.dasherizedName}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
get headerActionComponent() {
|
|
|
|
return headerActionComponentForPlugin(this.args.plugin.dasherizedName);
|
2024-09-30 12:35:23 +08:00
|
|
|
}
|
|
|
|
|
2024-09-10 13:16:16 +08:00
|
|
|
linkText(navLink) {
|
|
|
|
if (navLink.label) {
|
|
|
|
return i18n(navLink.label);
|
|
|
|
} else {
|
|
|
|
return navLink.text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-13 11:15:12 +08:00
|
|
|
<template>
|
|
|
|
<div class="admin-plugin-config-page">
|
2024-09-10 13:16:16 +08:00
|
|
|
<AdminPageHeader
|
|
|
|
@titleLabelTranslated={{@plugin.nameTitleized}}
|
|
|
|
@descriptionLabelTranslated={{@plugin.about}}
|
|
|
|
@learnMoreUrl={{@plugin.linkUrl}}
|
2024-10-08 06:28:32 +08:00
|
|
|
@headerActionComponent={{this.headerActionComponent}}
|
2024-09-10 13:16:16 +08:00
|
|
|
>
|
|
|
|
<:breadcrumbs>
|
|
|
|
|
|
|
|
<DBreadcrumbsItem
|
|
|
|
@path="/admin/plugins"
|
|
|
|
@label={{i18n "admin.plugins.title"}}
|
|
|
|
/>
|
|
|
|
<DBreadcrumbsItem
|
|
|
|
@path="/admin/plugins/{{@plugin.name}}"
|
|
|
|
@label={{@plugin.nameTitleized}}
|
|
|
|
/>
|
|
|
|
</:breadcrumbs>
|
|
|
|
<:tabs>
|
|
|
|
{{#if this.adminPluginNavManager.isTopMode}}
|
|
|
|
{{#each
|
|
|
|
this.adminPluginNavManager.currentConfigNav.links
|
|
|
|
as |navLink|
|
|
|
|
}}
|
|
|
|
<NavItem
|
|
|
|
@route={{navLink.route}}
|
|
|
|
@i18nLabel={{this.linkText navLink}}
|
|
|
|
title={{this.linkText navLink}}
|
|
|
|
class="admin-plugin-config-page__top-nav-item"
|
|
|
|
>
|
|
|
|
{{this.linkText navLink}}
|
|
|
|
</NavItem>
|
|
|
|
{{/each}}
|
|
|
|
{{/if}}
|
|
|
|
</:tabs>
|
|
|
|
</AdminPageHeader>
|
2024-05-29 10:20:55 +08:00
|
|
|
|
2024-03-13 11:15:12 +08:00
|
|
|
<div class="admin-plugin-config-page__content">
|
|
|
|
<div class={{this.mainAreaClasses}}>
|
2024-03-21 11:42:06 +08:00
|
|
|
<AdminPluginConfigArea>
|
2024-03-13 11:15:12 +08:00
|
|
|
{{yield}}
|
|
|
|
</AdminPluginConfigArea>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
}
|