Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Allows display topic thumbnails in kanban cards #55

Merged
merged 2 commits into from
Jul 5, 2024
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
9 changes: 9 additions & 0 deletions common/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ html:has(body.kanban-active) {
}
}

&__thumbnail-row {
margin-top: 5px;
}

.last-post-by,
.topic-title {
flex-grow: 1;
Expand All @@ -162,6 +166,11 @@ html:has(body.kanban-active) {
}
}

.thumbnail {
overflow: hidden;
width: 100%;
}

.last-post-by {
text-align: left;
font-size: $font-down-2;
Expand Down
14 changes: 14 additions & 0 deletions javascripts/discourse/components/kanban/card.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ export default class KanbanCard extends Component {
.map((t) => renderTag(t));
}

get showImage() {
return settings.show_topic_thumbnail && this.imageUrl;
}

get imageUrl() {
return this.args.topic.image_url;
}

get showCategory() {
const definitionCategory = this.args.definition.params.category;
const discoveryCategory = this.kanbanManager.discoveryCategory;
Expand Down Expand Up @@ -176,6 +184,12 @@ export default class KanbanCard extends Component {
</div>
{{/if}}

{{#if this.showImage}}
<div class="card-row card-row__thumbnail-row">
<img class="thumbnail" src={{this.imageUrl}} />
</div>
{{/if}}

<PluginOutlet
@name="kanban-card-bottom"
@outletArgs={{hash topic=@topic}}
Expand Down
4 changes: 4 additions & 0 deletions settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ card_style:
choices:
- simple
- detailed
show_topic_thumbnail:
default: false
description:
en: Display the topic thumbnail at the bottom of the card