ensl.org/app/views/forums/index.html.erb
Luke Barratt 644ffb41ef Added forum styling
Improvements to sizing/spacing
2014-05-04 12:53:47 +01:00

69 lines
2.2 KiB
Text

<%= provide :content_class, 'no-body' %>
<div id="categories">
<% @categories.each do |cat| %>
<% forums = cuser ? cat.forums.available_to(cuser, Forumer::ACCESS_READ).ordered : cat.forums.public.ordered %>
<% next if forums.length == 0 %>
<div class="category">
<table class="category striped">
<thead>
<tr>
<th colspan="2" class="category"><%=h cat.name %></th>
<th class="actions"></th>
<th class="topics">Topics</th>
<th class="posts">Posts</th>
<th class="last">Last Post</th>
</tr>
</thead>
<% forums.each do |forum| %>
<tr>
<td class="bullet <%= 'updated' if cuser and !forum.read_by?(cuser) %>"></td>
<td class="forum">
<h5><%= namelink(forum) %></h5>
<%= forum.description %>
</td>
<td class="actions">
<% if forum.can_update? cuser %>
<%= link_to action: "up", id: forum do %>
<% icon 'arrow-up' %>
<% end %>
<%= link_to action: "down", id: forum do %>
<% icon 'arrow-down' %>
<% end %>
<% end %>
</td>
<td class="topics"><%= forum.topics.count %></td>
<td class="posts"><%= forum.posts.count %></td>
<td class="last">
<% if forum.posts.last %>
<%= link_to lastpost(forum.posts.last.topic) do %>
<%=h forum.posts.last.user %><br>
<%= shortdate(forum.posts.last.created_at) %>
<% end %>
<% end %>
</td>
</tr>
<% end %>
</table>
</div>
<% end %>
</div>
<div class="statistics">
<h4>Statistics</h4>
<p>
We have total of <strong><%= Post.count %></strong> posts,
<strong><%= Topic.count %></strong> topics, and <strong><%= User.count %></strong> users.
</p>
<p>
Our newest member is <%= namelink User.last %> and most active member is <%= namelink User.posts_stats.first %>.
</p>
</div>
<% if Forum.new.can_create? cuser %>
<p>
<%= link_to 'New Forum', new_forum_path, class: 'button' %>
</p>
<% end %>