Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions app/assets/javascripts/discourse/app/components/topic-list/item.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ export default class Item extends Component {
}
}

get useMobileLayout() {
return applyValueTransformer(
"topic-list-item-mobile-layout",
this.site.mobileView,
{ topic: this.args.topic }
);
}

<template>
<tr
{{! template-lint-disable no-invalid-interactive }}
Expand All @@ -210,28 +218,15 @@ export default class Item extends Component {
(if @topic.closed "closed")
this.tagClassNames
(applyValueTransformer
"topic-list-item-class" (array) (hash topic=@topic)
"topic-list-item-class" (array) (hash topic=@topic index=@index)
)
}}
>
<PluginOutlet
@name="above-topic-list-item"
@outletArgs={{hash topic=@topic}}
/>
{{#if this.site.desktopView}}
{{#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}}
{{else}}
{{#if this.useMobileLayout}}
<td class="topic-list-data">
<div class="pull-left">
{{#if @bulkSelectEnabled}}
Expand Down Expand Up @@ -337,6 +332,19 @@ export default class Item extends Component {
</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}}
</tr>
</template>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import { cached } from "@glimmer/tracking";
import { hash } from "@ember/helper";
import { array, hash } from "@ember/helper";
import { service } from "@ember/service";
import { eq, or } from "truth-helpers";
import PluginOutlet from "discourse/components/plugin-outlet";
Expand Down Expand Up @@ -172,6 +172,7 @@ export default class TopicList extends Component {
class={{concatClass
"topic-list"
(if this.bulkSelectEnabled "sticky-header")
(applyValueTransformer "topic-list-class" (array) (hash topics=@topics))
}}
>
<caption class="sr-only">{{i18n "sr_topic_list_caption"}}</caption>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ export const VALUE_TRANSFORMERS = Object.freeze([
"small-user-attrs",
"topic-list-columns",
"topic-list-header-sortable-column",
"topic-list-class",
"topic-list-item-class",
"topic-list-item-mobile-layout",
]);
Loading