DEV: Remove extra whitespace from glimmer topic list items (#27225)

This commit is contained in:
Jarek Radosz 2024-05-28 14:23:36 +02:00 committed by GitHub
parent aea1f4417a
commit e02b8b4a83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 52 additions and 58 deletions

View File

@ -1,15 +1,15 @@
{{#if @tagName}}
{{~#if @tagName~}}
{{!
Older outlets have a wrapper tagName. RFC0389 proposes an interface for dynamic tag names, which we may want to use in future.
But for now, this classic component wrapper takes care of the tagName.
}}
<this.wrapperComponent @tagName={{@tagName}}>
{{#each (this.getConnectors) as |c|}}
{{#if c.componentClass}}
{{~#each (this.getConnectors) as |c|~}}
{{~#if c.componentClass~}}
<c.componentClass @outletArgs={{this.outletArgsWithDeprecations}} />
{{else if @defaultGlimmer}}
{{~else if @defaultGlimmer~}}
<c.templateOnly @outletArgs={{this.outletArgsWithDeprecations}} />
{{else}}
{{~else~}}
<PluginConnector
@connector={{c}}
@args={{this.outletArgs}}
@ -19,29 +19,29 @@
@layout={{c.template}}
class={{c.classicClassNames}}
/>
{{/if}}
{{/each}}
{{~/if~}}
{{~/each~}}
</this.wrapperComponent>
{{else if (this.connectorsExist hasBlock=(has-block))}}
{{! The modern path: no wrapper element = no classic component }}
{{~else if (this.connectorsExist hasBlock=(has-block))~}}
{{~! The modern path: no wrapper element = no classic component ~}}
{{#if (has-block)}}
{{~#if (has-block)~}}
<PluginOutlet
@name={{concat @name "__before"}}
@outletArgs={{this.outletArgsWithDeprecations}}
/>
{{/if}}
{{~/if~}}
{{#each (this.getConnectors hasBlock=(has-block)) as |c|}}
{{#if c.componentClass}}
{{~#each (this.getConnectors hasBlock=(has-block)) as |c|~}}
{{~#if c.componentClass~}}
<c.componentClass
@outletArgs={{this.outletArgsWithDeprecations}}
>{{yield}}</c.componentClass>
{{else if @defaultGlimmer}}
{{~else if @defaultGlimmer~}}
<c.templateOnly
@outletArgs={{this.outletArgsWithDeprecations}}
>{{yield}}</c.templateOnly>
{{else}}
{{~else~}}
<PluginConnector
@connector={{c}}
@args={{this.outletArgs}}
@ -51,17 +51,17 @@
@layout={{c.template}}
class={{c.classicClassNames}}
>{{yield}}</PluginConnector>
{{/if}}
{{else}}
{{~/if~}}
{{~else~}}
{{yield}}
{{/each}}
{{~/each~}}
{{#if (has-block)}}
{{~#if (has-block)~}}
<PluginOutlet
@name={{concat @name "__after"}}
@outletArgs={{this.outletArgsWithDeprecations}}
/>
{{/if}}
{{else}}
{{~/if~}}
{{~else~}}
{{yield}}
{{/if}}
{{~/if~}}

View File

@ -9,6 +9,7 @@ export default class TopicLink extends Component {
}
<template>
{{~! no whitespace ~}}
<a
href={{this.url}}
data-topic-id={{@topic.id}}
@ -17,5 +18,6 @@ export default class TopicLink extends Component {
class="title"
...attributes
>{{htmlSafe @topic.fancyTitle}}</a>
{{~! no whitespace ~}}
</template>
}

View File

@ -300,14 +300,13 @@ export default class TopicListItem extends Component {
<td class="main-link clearfix topic-list-data" colspan="1">
<PluginOutlet @name="topic-list-before-link" />
<span class="link-top-line">{{! no whitespace
}}<PluginOutlet
@name="topic-list-before-status"
/>{{! no whitespace
}}<TopicStatus
@topic={{@topic}}
/>{{! no whitespace
}}<TopicLink
<span class="link-top-line">
{{~! no whitespace ~}}
<PluginOutlet @name="topic-list-before-status" />
{{~! no whitespace ~}}
<TopicStatus @topic={{@topic}} />
{{~! no whitespace ~}}
<TopicLink
{{on "focus" this.onTitleFocus}}
{{on "blur" this.onTitleBlur}}
@topic={{@topic}}
@ -317,10 +316,8 @@ export default class TopicListItem extends Component {
&nbsp;
{{~topicFeaturedLink @topic}}
{{~/if~}}
<PluginOutlet
@name="topic-list-after-title"
/>{{! no whitespace
}}
<PluginOutlet @name="topic-list-after-title" />
{{~! no whitespace ~}}
<UnreadIndicator
@includeUnreadIndicator={{this.includeUnreadIndicator}}
@topicId={{@topic.id}}
@ -428,23 +425,17 @@ export default class TopicListItem extends Component {
{{/if}}
</div>
<div
class="topic-item-metadata right"
>{{! no whitespace
}}<PluginOutlet
@name="topic-list-before-link"
/>
<div class="topic-item-metadata right">
{{~! no whitespace ~}}
<PluginOutlet @name="topic-list-before-link" />
<div
class="main-link"
>{{! no whitespace
}}<PluginOutlet
@name="topic-list-before-status"
/>{{! no whitespace
}}<TopicStatus
@topic={{@topic}}
/>{{! no whitespace
}}<TopicLink
<div class="main-link">
{{~! no whitespace ~}}
<PluginOutlet @name="topic-list-before-status" />
{{~! no whitespace ~}}
<TopicStatus @topic={{@topic}} />
{{~! no whitespace ~}}
<TopicLink
{{on "focus" this.onTitleFocus}}
{{on "blur" this.onTitleBlur}}
@topic={{@topic}}
@ -463,10 +454,9 @@ export default class TopicListItem extends Component {
<TopicExcerpt @topic={{@topic}} />
{{~/if~}}
<PluginOutlet @name="topic-list-main-link-bottom" />
</div>{{! no whitespace
}}<PluginOutlet
@name="topic-list-after-main-link"
/>
</div>
{{~! no whitespace ~}}
<PluginOutlet @name="topic-list-after-main-link" />
<div class="pull-right">
<PostCountOrBadges

View File

@ -4,7 +4,7 @@ import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
const UnreadIndicator = <template>
{{#if @includeUnreadIndicator~}}
{{~#if @includeUnreadIndicator~}}
&nbsp;<span
title={{i18n "topic.unread_indicator"}}
class={{concatClass
@ -15,7 +15,7 @@ const UnreadIndicator = <template>
>
{{~icon "asterisk"~}}
</span>
{{~/if}}
{{~/if~}}
</template>;
export default UnreadIndicator;

View File

@ -16,6 +16,7 @@ export default class TopicPostBadges extends Component {
}
<template>
{{~! no whitespace ~}}
<span class="topic-post-badges">
{{~#if this.displayUnreadPosts~}}
&nbsp;<a
@ -23,7 +24,7 @@ export default class TopicPostBadges extends Component {
title={{i18n "topic.unread_posts" count=this.displayUnreadPosts}}
class="badge badge-notification unread-posts"
>{{this.displayUnreadPosts}}</a>
{{/if~}}
{{~/if~}}
{{~#if @unseen~}}
&nbsp;<a
@ -31,7 +32,8 @@ export default class TopicPostBadges extends Component {
title={{i18n "topic.new"}}
class="badge badge-notification new-topic"
>{{this.newDotText}}</a>
{{/if~}}
{{~/if~}}
</span>
{{~! no whitespace ~}}
</template>
}