DEV: Add a context arg to after-topic-status outlet (#30940)

…so that plugins/themes can conditionally conditionally display their
topic-status icon (e.g. just on the topic list, or everywhere but the
header)
This commit is contained in:
Jarek Radosz 2025-01-23 04:21:31 +01:00 committed by GitHub
parent daab816a37
commit 474bfb5757
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 11 additions and 6 deletions

View File

@ -108,6 +108,7 @@ export default class Info extends Component {
<TopicStatus <TopicStatus
@topic={{@topicInfo}} @topic={{@topicInfo}}
@disableActions={{@disableActions}} @disableActions={{@disableActions}}
@context="header"
/> />
<a <a

View File

@ -1,6 +1,10 @@
<span class="topic"> <span class="topic">
<span class="first-line"> <span class="first-line">
<TopicStatus @topic={{@result.topic}} @disableActions={{true}} /> <TopicStatus
@topic={{@result.topic}}
@disableActions={{true}}
@context="topic-view-title"
/>
<span class="topic-title" data-topic-id={{@result.topic.id}}> <span class="topic-title" data-topic-id={{@result.topic.id}}>
{{#if {{#if
(and (and

View File

@ -17,7 +17,7 @@ const onTimestampClick = function (event) {
const FeaturedTopic = <template> const FeaturedTopic = <template>
<div data-topic-id={{@topic.id}} class="featured-topic --glimmer"> <div data-topic-id={{@topic.id}} class="featured-topic --glimmer">
<TopicStatus @topic={{@topic}} /> <TopicStatus @topic={{@topic}} @context="topic-list" />
<a href={{@topic.lastUnreadUrl}} class="title">{{htmlSafe <a href={{@topic.lastUnreadUrl}} class="title">{{htmlSafe
@topic.fancyTitle @topic.fancyTitle

View File

@ -283,7 +283,7 @@ export default class Item extends Component {
@outletArgs={{hash topic=@topic}} @outletArgs={{hash topic=@topic}}
/> />
{{~! no whitespace ~}} {{~! no whitespace ~}}
<TopicStatus @topic={{@topic}} /> <TopicStatus @topic={{@topic}} @context="topic-list" />
{{~! no whitespace ~}} {{~! no whitespace ~}}
<TopicLink <TopicLink
{{on "focus" this.onTitleFocus}} {{on "focus" this.onTitleFocus}}

View File

@ -67,7 +67,7 @@ export default class TopicCell extends Component {
@outletArgs={{hash topic=@topic tagsForUser=@tagsForUser}} @outletArgs={{hash topic=@topic tagsForUser=@tagsForUser}}
> >
{{~! no whitespace ~}} {{~! no whitespace ~}}
<TopicStatus @topic={{@topic}} /> <TopicStatus @topic={{@topic}} @context="topic-list" />
{{~! no whitespace ~}} {{~! no whitespace ~}}
<TopicLink <TopicLink
{{on "focus" this.onTitleFocus}} {{on "focus" this.onTitleFocus}}

View File

@ -62,7 +62,7 @@ export default class LatestTopicListItem extends Component {
<div class="main-link"> <div class="main-link">
<div class="top-row"> <div class="top-row">
<TopicStatus @topic={{@topic}} /> <TopicStatus @topic={{@topic}} @context="topic-list" />
{{topicLink @topic}} {{topicLink @topic}}
{{~#if @topic.featured_link}} {{~#if @topic.featured_link}}

View File

@ -112,7 +112,7 @@ export default class TopicStatus extends Component {
{{~#if this.site.useGlimmerTopicList~}} {{~#if this.site.useGlimmerTopicList~}}
<PluginOutlet <PluginOutlet
@name="after-topic-status" @name="after-topic-status"
@outletArgs={{hash topic=@topic}} @outletArgs={{hash topic=@topic context=@context}}
/> />
{{~else~}} {{~else~}}
{{~#each TopicStatusIcons.entries as |entry|~}} {{~#each TopicStatusIcons.entries as |entry|~}}