FEATURE: add plugin outlets for topic title suffix (#24215)

This commit is contained in:
Arpit Jalan 2023-11-02 17:16:58 +05:30 committed by GitHub
parent 65759c126b
commit a38b80a0ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 0 deletions

View File

@ -12,6 +12,10 @@
{{else}}
<SearchMenu::HighlightedSearch @string={{@result.topic.fancyTitle}} />
{{/if}}
<PluginOutlet
@name="search-menu-results-topic-title-suffix"
@outletArgs={{hash topic=@result.topic}}
/>
</span>
</span>
<span class="second-line">

View File

@ -31,6 +31,10 @@
</HighlightSearch>
{{/if}}
</span>
<PluginOutlet
@name="search-results-topic-title-suffix"
@outletArgs={{hash topic=this.post.topic}}
/>
</a>
<div class="search-category">

View File

@ -1,9 +1,11 @@
import { hbs } from "ember-cli-htmlbars";
import { h } from "virtual-dom";
import renderTags from "discourse/lib/render-tags";
import { topicFeaturedLinkNode } from "discourse/lib/render-topic-featured-link";
import DiscourseURL from "discourse/lib/url";
import { avatarImg } from "discourse/widgets/post";
import RawHtml from "discourse/widgets/raw-html";
import RenderGlimmer from "discourse/widgets/render-glimmer";
import { applyDecorators, createWidget } from "discourse/widgets/widget";
import getURL from "discourse-common/lib/get-url";
import { iconNode } from "discourse-common/lib/icon-library";
@ -111,6 +113,19 @@ export default createWidget("header-topic-info", {
contents: () => titleHTML,
})
);
heading.push(
new RenderGlimmer(
this,
"div",
hbs`<PluginOutlet @name="header-topic-title-suffix" @outletArgs={{@data.outletArgs}}/>`,
{
outletArgs: {
topic,
},
}
)
);
}
this.headerElements = [h("h1.header-title", heading)];