ensl.org/app/views/forums/show.html.erb

52 lines
1.5 KiB
Text
Raw Normal View History

<div class="breadcrumbs">
<%= link_to "Forums", action: "index" %> <%= icon 'chevron-right' %> <%= namelink @forum %>
</div>
<%= render partial: 'controls', locals: { forum: @forum } %>
<h2><%=h @forum.title %></h2>
<table id="topics">
<tr>
<th class="topic">Topic</th>
<th class="author">Author</th>
<th class="replies">Replies</th>
<th class="views">Views</th>
<th class="last">Last Post</th>
</tr>
<% @forum.topics.basic.ordered.each do |topic| %>
<tr>
<td>
<h5>
<% if topic.state == Topic::STATE_STICKY %>
<b>Sticky: </b>
<% elsif topic.lock %>
<b>Locked: </b>
<% end %>
<%= link_to (h topic), topic, class: ((cuser and !topic.read_by? cuser) ? "unread" : "read") %>
</h5>
<% if topic.posts.count > Topic::POSTS_PAGE %>
Page:
<% (1..((topic.posts.count/Topic::POSTS_PAGE).ceil + 1)).to_a.each do |page| %>
<%= ", " unless page == 1 %>
<%= link_to page, topic_url(topic, page: page) %>
<% end %>
<% end %>
</td>
<td><%= namelink(topic.user) %></td>
<td><%=h topic.posts.count-1 %></td>
<td><%=h topic.view_count %></td>
<td>
<%= link_to lastpost(topic) do %>
<%=h topic.posts.last.user %><br>
<%= shortdate(topic.posts.last.created_at) %>
<% end %>
</td>
</tr>
<% end %>
</table>
<%= render partial: 'controls', locals: { forum: @forum } %>