Skip to content

A platform for community discussion. Free, open, simple.

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

Jarek Radosze02b8b4a83f4
diff --git a/app/assets/javascripts/discourse/app/components/plugin-outlet.hbs b/app/assets/javascripts/discourse/app/components/plugin-outlet.hbs
index 496e6a6a682..fd84c55acb4 100644
--- a/app/assets/javascripts/discourse/app/components/plugin-outlet.hbs
+++ b/app/assets/javascripts/discourse/app/components/plugin-outlet.hbs
@@ -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}}
\ No newline at end of file
+{{~/if~}}
\ No newline at end of file
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/topic-link.gjs b/app/assets/javascripts/discourse/app/components/topic-list/topic-link.gjs
index 3c8ccfe7dab..2033c31d806 100644
--- a/app/assets/javascripts/discourse/app/components/topic-list/topic-link.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-list/topic-link.gjs
@@ -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>
}
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/topic-list-item.gjs b/app/assets/javascripts/discourse/app/components/topic-list/topic-list-item.gjs
index 8424ea20b7e..238fcf8815d 100644
--- a/app/assets/javascripts/discourse/app/components/topic-list/topic-list-item.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-list/topic-list-item.gjs
@@ -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="main-link"
- >{{! no whitespace
- }}<PluginOutlet
- @name="topic-list-before-status"
- />{{! no whitespace
- }}<TopicStatus
- @topic={{@topic}}
- />{{! no whitespace
- }}<TopicLink
+ <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
{{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
diff --git a/app/assets/javascripts/discourse/app/components/topic-list/unread-indicator.gjs b/app/assets/javascripts/discourse/app/components/topic-list/unread-indicator.gjs
index d18b6563bf8..923f2df4fba 100644
--- a/app/assets/javascripts/discourse/app/components/topic-list/unread-indicator.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-list/unread-indicator.gjs
@@ -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;
diff --git a/app/assets/javascripts/discourse/app/components/topic-post-badges.gjs b/app/assets/javascripts/discourse/app/components/topic-post-badges.gjs
index 271d541b755..16a5b3ddacc 100644
--- a/app/assets/javascripts/discourse/app/components/topic-post-badges.gjs
+++ b/app/assets/javascripts/discourse/app/components/topic-post-badges.gjs
@@ -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>
}