DEV: Add outlets around the topic item and latest topic item poster (#30776)

This commit is contained in:
Sérgio Saquetim 2025-01-15 13:38:06 -03:00 committed by GitHub
parent a647031171
commit 34acc9fe54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 147 additions and 125 deletions

View File

@ -220,131 +220,148 @@ export default class Item extends Component {
@name="above-topic-list-item"
@outletArgs={{hash topic=@topic}}
/>
{{#if this.useMobileLayout}}
<td class="topic-list-data">
<div class="pull-left">
{{#if @bulkSelectEnabled}}
<label for="bulk-select-{{@topic.id}}">
<input
{{on "click" this.onBulkSelectToggle}}
checked={{this.isSelected}}
type="checkbox"
id="bulk-select-{{@topic.id}}"
class="bulk-select"
/>
</label>
{{else}}
<PluginOutlet
@name="topic-list-item-mobile-avatar"
@outletArgs={{hash topic=@topic}}
>
<a
href={{@topic.lastPostUrl}}
aria-label={{i18n
"latest_poster_link"
username=@topic.lastPosterUser.username
}}
data-user-card={{@topic.lastPosterUser.username}}
>{{avatar @topic.lastPosterUser imageSize="large"}}</a>
</PluginOutlet>
{{/if}}
</div>
<div class="topic-item-metadata right">
{{~! no whitespace ~}}
<PluginOutlet
@name="topic-list-before-link"
@outletArgs={{hash topic=@topic}}
/>
<div class="main-link">
{{~! no whitespace ~}}
<PluginOutlet
@name="topic-list-before-status"
@outletArgs={{hash topic=@topic}}
/>
{{~! no whitespace ~}}
<TopicStatus @topic={{@topic}} />
{{~! no whitespace ~}}
<TopicLink
{{on "focus" this.onTitleFocus}}
{{on "blur" this.onTitleBlur}}
@topic={{@topic}}
class="raw-link raw-topic-link"
/>
{{~#if @topic.featured_link~}}
&nbsp;
{{~topicFeaturedLink @topic}}
{{~/if~}}
<PluginOutlet
@name="topic-list-after-title"
@outletArgs={{hash topic=@topic}}
/>
{{~#if @topic.unseen~}}
<span class="topic-post-badges">&nbsp;<span
class="badge-notification new-topic"
></span></span>
{{~/if~}}
{{~#if this.expandPinned~}}
<TopicExcerpt @topic={{@topic}} />
{{~/if~}}
<PluginOutlet
@name="topic-list-main-link-bottom"
@outletArgs={{hash topic=@topic}}
/>
</div>
{{~! no whitespace ~}}
<PluginOutlet
@name="topic-list-after-main-link"
@outletArgs={{hash topic=@topic}}
/>
<div class="pull-right">
<PostCountOrBadges
@topic={{@topic}}
@postBadgesEnabled={{@showTopicPostBadges}}
/>
</div>
<div class="topic-item-stats clearfix">
<span class="topic-item-stats__category-tags">
{{#unless @hideCategory}}
<PluginOutlet
@name="topic-list-before-category"
@outletArgs={{hash topic=@topic}}
{{! Do not include @columns as argument to the wrapper outlet below ~}}
{{! We don't want it to be able to override core behavior just copy/pasting the code ~}}
<PluginOutlet
@name="topic-list-item"
@outletArgs={{hash
topic=@topic
bulkSelectEnabled=@bulkSelectEnabled
onBulkSelectToggle=this.onBulkSelectToggle
isSelected=this.isSelected
}}
>
{{#if this.useMobileLayout}}
<td
class={{concatClass
"topic-list-data"
(if @bulkSelectEnabled "bulk-select-enabled")
}}
>
<div class="pull-left">
{{#if @bulkSelectEnabled}}
<label for="bulk-select-{{@topic.id}}">
<input
{{on "click" this.onBulkSelectToggle}}
checked={{this.isSelected}}
type="checkbox"
id="bulk-select-{{@topic.id}}"
class="bulk-select"
/>
{{categoryLink @topic.category}}
{{/unless}}
</label>
{{else}}
<PluginOutlet
@name="topic-list-item-mobile-avatar"
@outletArgs={{hash topic=@topic}}
>
<a
href={{@topic.lastPostUrl}}
aria-label={{i18n
"latest_poster_link"
username=@topic.lastPosterUser.username
}}
data-user-card={{@topic.lastPosterUser.username}}
>{{avatar @topic.lastPosterUser imageSize="large"}}</a>
</PluginOutlet>
{{/if}}
</div>
{{discourseTags @topic mode="list"}}
</span>
<div class="topic-item-metadata right">
{{~! no whitespace ~}}
<PluginOutlet
@name="topic-list-before-link"
@outletArgs={{hash topic=@topic}}
/>
<div class="num activity last">
<span title={{@topic.bumpedAtTitle}} class="age activity">
<a href={{@topic.lastPostUrl}}>{{formatDate
@topic.bumpedAt
format="tiny"
noTitle="true"
}}</a>
<div class="main-link">
{{~! no whitespace ~}}
<PluginOutlet
@name="topic-list-before-status"
@outletArgs={{hash topic=@topic}}
/>
{{~! no whitespace ~}}
<TopicStatus @topic={{@topic}} />
{{~! no whitespace ~}}
<TopicLink
{{on "focus" this.onTitleFocus}}
{{on "blur" this.onTitleBlur}}
@topic={{@topic}}
class="raw-link raw-topic-link"
/>
{{~#if @topic.featured_link~}}
&nbsp;
{{~topicFeaturedLink @topic}}
{{~/if~}}
<PluginOutlet
@name="topic-list-after-title"
@outletArgs={{hash topic=@topic}}
/>
{{~#if @topic.unseen~}}
<span class="topic-post-badges">&nbsp;<span
class="badge-notification new-topic"
></span></span>
{{~/if~}}
{{~#if this.expandPinned~}}
<TopicExcerpt @topic={{@topic}} />
{{~/if~}}
<PluginOutlet
@name="topic-list-main-link-bottom"
@outletArgs={{hash topic=@topic}}
/>
</div>
{{~! no whitespace ~}}
<PluginOutlet
@name="topic-list-after-main-link"
@outletArgs={{hash topic=@topic}}
/>
<div class="pull-right">
<PostCountOrBadges
@topic={{@topic}}
@postBadgesEnabled={{@showTopicPostBadges}}
/>
</div>
<div class="topic-item-stats clearfix">
<span class="topic-item-stats__category-tags">
{{#unless @hideCategory}}
<PluginOutlet
@name="topic-list-before-category"
@outletArgs={{hash topic=@topic}}
/>
{{categoryLink @topic.category}}
{{/unless}}
{{discourseTags @topic mode="list"}}
</span>
<div class="num activity last">
<span title={{@topic.bumpedAtTitle}} class="age activity">
<a href={{@topic.lastPostUrl}}>{{formatDate
@topic.bumpedAt
format="tiny"
noTitle="true"
}}</a>
</span>
</div>
</div>
</div>
</div>
</td>
{{else}}
{{#each @columns as |entry|}}
<entry.value.item
@topic={{@topic}}
@bulkSelectEnabled={{@bulkSelectEnabled}}
@onBulkSelectToggle={{this.onBulkSelectToggle}}
@isSelected={{this.isSelected}}
@showTopicPostBadges={{@showTopicPostBadges}}
@hideCategory={{@hideCategory}}
@tagsForUser={{@tagsForUser}}
@expandPinned={{this.expandPinned}}
/>
{{/each}}
{{/if}}
</td>
{{else}}
{{#each @columns as |entry|}}
<entry.value.item
@topic={{@topic}}
@bulkSelectEnabled={{@bulkSelectEnabled}}
@onBulkSelectToggle={{this.onBulkSelectToggle}}
@isSelected={{this.isSelected}}
@showTopicPostBadges={{@showTopicPostBadges}}
@hideCategory={{@hideCategory}}
@tagsForUser={{@tagsForUser}}
@expandPinned={{this.expandPinned}}
/>
{{/each}}
{{/if}}
</PluginOutlet>
</tr>
</template>
}

View File

@ -48,12 +48,17 @@ export default class LatestTopicListItem extends Component {
@outletArgs={{hash topic=@topic}}
/>
<div class="topic-poster">
<UserLink @user={{@topic.lastPosterUser}}>
{{avatar @topic.lastPosterUser imageSize="large"}}
</UserLink>
<UserAvatarFlair @user={{@topic.lastPosterUser}} />
</div>
<PluginOutlet
@name="latest-topic-list-item-topic-poster"
@outletArgs={{hash topic=@topic}}
>
<div class="topic-poster">
<UserLink @user={{@topic.lastPosterUser}}>
{{avatar @topic.lastPosterUser imageSize="large"}}
</UserLink>
<UserAvatarFlair @user={{@topic.lastPosterUser}} />
</div>
</PluginOutlet>
<div class="main-link">
<div class="top-row">