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

63 lines
1.7 KiB
Text
Raw Normal View History

<%= provide :content_class, 'no-body' %>
<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>
2014-04-13 11:16:51 +00:00
<%= will_paginate @topics %>
<table id="topics" class="striped">
<thead>
<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>
</thead>
2014-04-13 11:16:51 +00:00
<% @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>
2014-04-13 11:16:51 +00:00
<td><%=h topic.cached_posts_count %></td>
<td><%=h topic.cached_view_count %></td>
<td>
<%= link_to lastpost(topic) do %>
<%=h topic.latest.user %><br>
<%= shortdate(topic.latest.created_at) %>
<% end %>
</td>
</tr>
<% end %>
</table>
2014-04-13 11:16:51 +00:00
<%= will_paginate @topics %>
<%= render partial: 'controls', locals: { forum: @forum } %>