mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 11:28:18 +00:00
FIX: Unscoped plugin config page actions outlet
In 61c1d35f17468b3666c966839da911d9f96dad19 I added a PluginOutlet to AdminPluginConfigPage. This was intended to be used as a way to render actions buttons inside the header of a plugin that has a custom admin UI page. This worked, but since the outlet was generically named, as soon as one plugin used it the button would show on all plugins. This fixes the immediate issue by naming the outlet based on the plugin, then having each plugin specify their own outlet to render into. There may be a nicer way to do this, but for now this stops the bleeding.
This commit is contained in:
parent
c5a024f8df
commit
41f6cf0642
@ -24,6 +24,10 @@ export default class AdminPluginConfigPage extends Component {
|
||||
return classes.join(" ");
|
||||
}
|
||||
|
||||
get actionsOutletName() {
|
||||
return `admin-plugin-config-page-actions-${this.args.plugin.kebabCaseName}`;
|
||||
}
|
||||
|
||||
linkText(navLink) {
|
||||
if (navLink.label) {
|
||||
return i18n(navLink.label);
|
||||
@ -68,10 +72,12 @@ export default class AdminPluginConfigPage extends Component {
|
||||
{{/if}}
|
||||
</:tabs>
|
||||
<:actions as |actions|>
|
||||
<div class={{this.actionsOutletName}}>
|
||||
<PluginOutlet
|
||||
@name="admin-plugin-config-page-actions"
|
||||
@name={{this.actionsOutletName}}
|
||||
@outletArgs={{hash plugin=@plugin actions=actions}}
|
||||
/>
|
||||
</div>
|
||||
</:actions>
|
||||
</AdminPageHeader>
|
||||
|
||||
|
@ -24,6 +24,10 @@ export default class AdminPlugin {
|
||||
return this.name.replaceAll("-", "_");
|
||||
}
|
||||
|
||||
get kebabCaseName() {
|
||||
return this.name.replaceAll(" ", "-").replaceAll("_", "-");
|
||||
}
|
||||
|
||||
get translatedCategoryName() {
|
||||
// We do this because the site setting list is grouped by category,
|
||||
// with plugins that have their root site setting key defined as `plugins:`
|
||||
|
@ -20,7 +20,7 @@ export default {
|
||||
]);
|
||||
|
||||
api.renderInOutlet(
|
||||
"admin-plugin-config-page-actions",
|
||||
"admin-plugin-config-page-actions-chat",
|
||||
ChatAdminPluginActions
|
||||
);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user