feat(templates): Highlight stickied threads in index
This commit is contained in:
parent
d1c45159b9
commit
c6995fcab3
2 changed files with 4 additions and 2 deletions
|
@ -58,6 +58,7 @@ impl Message for IndexPage {
|
||||||
struct IndexThread {
|
struct IndexThread {
|
||||||
id: i32,
|
id: i32,
|
||||||
title: String,
|
title: String,
|
||||||
|
sticky: bool,
|
||||||
posted: FormattedDate,
|
posted: FormattedDate,
|
||||||
author_name: String,
|
author_name: String,
|
||||||
}
|
}
|
||||||
|
@ -71,6 +72,7 @@ impl Handler<IndexPage> for Renderer {
|
||||||
.map(|thread| IndexThread {
|
.map(|thread| IndexThread {
|
||||||
id: thread.thread_id,
|
id: thread.thread_id,
|
||||||
title: escape_html(&thread.title),
|
title: escape_html(&thread.title),
|
||||||
|
sticky: thread.sticky,
|
||||||
posted: thread.posted.into(),
|
posted: thread.posted.into(),
|
||||||
author_name: thread.thread_author,
|
author_name: thread.thread_author,
|
||||||
})
|
})
|
||||||
|
|
|
@ -25,10 +25,10 @@
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="list-group">
|
<div class="list-group">
|
||||||
{% for thread in threads -%}
|
{% for thread in threads -%}
|
||||||
<a href="/thread/{{ thread.id }}" class="list-group-item list-group-item-action flex-column align-items-start">
|
<a href="/thread/{{ thread.id }}" class="list-group-item list-group-item-action flex-column align-items-start {% if thread.sticky %} bg-secondary text-white {% endif %}">
|
||||||
<div class="d-flex w-100 justify-content-between">
|
<div class="d-flex w-100 justify-content-between">
|
||||||
<h5 class="mb-1">{{ thread.title }}</h5>
|
<h5 class="mb-1">{{ thread.title }}</h5>
|
||||||
<small class="text-muted">{{ thread.posted }}</small>
|
<small class="{%if thread.sticky %}text-white{% else %}text-muted{% endif %}">{{ thread.posted }}</small>
|
||||||
</div>
|
</div>
|
||||||
<p class="mb-1">Created by {{ thread.author_name }}</p>
|
<p class="mb-1">Created by {{ thread.author_name }}</p>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue