ensl.org/app/views/forums/show.html.erb
Luke Barratt 3e757e2d76 New header layout
Improves spacing
Improves button layout on forums
2014-04-30 00:34:48 +01:00

57 lines
1.6 KiB
Text

<div class="breadcrumbs">
<%= link_to "Forums", action: "index" %> <%= icon 'chevron-right' %> <%= namelink @forum %>
</div>
<div class="topic-controls">
<%= render partial: 'controls', locals: { forum: @forum } %>
</div>
<h2><%=h @forum.title %></h2>
<%= will_paginate @topics %>
<table id="topics" class="striped">
<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>
<% @topics.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.cached_posts_count %></td>
<td><%=h topic.cached_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>
<%= will_paginate @topics %>
<%= render partial: 'controls', locals: { forum: @forum } %>