philomena/lib/philomena_web/templates/forum/index.html.heex
2024-06-01 23:50:36 -04:00

66 lines
2.2 KiB
Text

<h1>
Discussion Forums
</h1>
<div class="block">
<div class="block__header">
<a href={~p"/posts"}>
<i class="fa fa-fw fa-search"></i>
Search Posts
</a>
<span class="block__header__item">
<%= @topic_count %>
topics
</span>
</div>
<div class="block__content">
<table class="table table--communication-list">
<thead>
<tr>
<th class="table--communication-list__name">
Forum
</th>
<th class="table--communication-list__stats hide-mobile">
Topics
</th>
<th class="table--communication-list__stats hide-mobile">
Posts
</th>
<th class="table--communication-list__last-post">
Last Post
</th>
</tr>
</thead>
<tbody>
<%= for forum <- @forums do %>
<tr>
<td class="table--communication-list__name">
<%= link(forum.name, to: ~p"/forums/#{forum}") %>
<div class="small-text">
<%= forum.description %>
</div>
</td>
<td class="table--communication-list__stats hide-mobile">
<%= forum.topic_count %>
</td>
<td class="table--communication-list__stats hide-mobile">
<%= forum.post_count %>
</td>
<td class="table--communication-list__last-post">
<%= if forum.last_post do %>
<strong>
<%= link(forum.last_post.topic.title, to: ~p"/forums/#{forum.last_post.topic.forum}/topics/#{forum.last_post.topic}") %>
</strong>
<br />
<%= link("Go to post", to: ~p"/forums/#{forum.last_post.topic.forum}/topics/#{forum.last_post.topic}?#{[post_id: forum.last_post.id]}" <> "#post_#{forum.last_post.id}") %>
by
<%= render(PhilomenaWeb.UserAttributionView, "_anon_user.html", object: forum.last_post, conn: @conn) %>
<br />
<%= pretty_time(forum.last_post.created_at) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>