2024-03-13 11:15:12 +08:00
|
|
|
import Component from "@glimmer/component";
|
|
|
|
import { inject as service } from "@ember/service";
|
2024-03-21 11:42:06 +08:00
|
|
|
import HorizontalOverflowNav from "discourse/components/horizontal-overflow-nav";
|
|
|
|
import NavItem from "discourse/components/nav-item";
|
2024-03-13 11:15:12 +08:00
|
|
|
import i18n from "discourse-common/helpers/i18n";
|
|
|
|
import AdminPluginConfigArea from "./admin-plugin-config-area";
|
|
|
|
|
|
|
|
export default class extends Component {
|
|
|
|
@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-03-21 11:42:06 +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-03-21 11:42:06 +08:00
|
|
|
{{#if this.adminPluginNavManager.isTopMode}}
|
|
|
|
<div class="admin-controls">
|
|
|
|
<HorizontalOverflowNav
|
|
|
|
class="nav-pills action-list main-nav nav plugin-nav"
|
|
|
|
>
|
|
|
|
{{#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}}
|
|
|
|
</HorizontalOverflowNav>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
2024-03-13 11:15:12 +08:00
|
|
|
|
2024-03-21 11:42:06 +08:00
|
|
|
<div class="admin-plugin-config-page__metadata">
|
|
|
|
<div class="admin-plugin-config-area__metadata-title">
|
|
|
|
<h2>
|
|
|
|
{{@plugin.nameTitleized}}
|
|
|
|
</h2>
|
|
|
|
<p>
|
|
|
|
{{@plugin.about}}
|
|
|
|
{{#if @plugin.linkUrl}}
|
|
|
|
|
|
|
|
|
<a
|
|
|
|
href={{@plugin.linkUrl}}
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
{{i18n "admin.plugins.learn_more"}}
|
|
|
|
</a>
|
|
|
|
{{/if}}
|
|
|
|
</p>
|
|
|
|
</div>
|
2024-03-13 11:15:12 +08:00
|
|
|
</div>
|
|
|
|
<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>
|
|
|
|
}
|