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

75 lines
2.3 KiB
Text

<br />
<div class="forums">
<% @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="body">
<tr>
<th colspan="5" class="header">
<%= h cat.to_s %>
</th>
</tr>
<tr>
<th colspan="2">Forums</th>
<th class="center" width="10%">Topics</th>
<th class="center" width="10%">Posts</th>
<th class="center" width="15%">Last Post</th>
</tr>
<% forums.each do |forum| %>
<tr>
<td class="bullet <%= "hl" if cuser and !forum.read_by? cuser %>">&nbsp;</td>
<td class="forum">
<div class="left">
<h3 class="desc">
<%= namelink forum %>
</h3>
<%= forum.description %>
</div>
<div class="right minitext">
<% if forum.can_update? cuser %>
<%= link_to "Up", :action => "up", :id => forum %><br />
<%= link_to "Down", :action => "down", :id => forum %>
<% end %>
</div>
<div class="clear"></div>
</td>
<td class="numbers"><%= forum.topics.count %></td>
<td class="numbers"><%= forum.posts.count %></td>
<td>
<% if forum.posts.last %>
<%= link_to raw("#{h forum.posts.last.user} <br />#{shortdate forum.posts.last.created_at}"), lastpost(forum.posts.last.topic) %>
<% end %>
</td>
</tr>
<% end %>
</table>
</div>
<% end %>
<div class="category">
<table class="body">
<tr>
<th colspan="5" class="header">
Statistics
</th>
</tr>
<tr>
<td colspan="5" class="center">
We have total of <b><%= Post.count %></b> posts,
<b><%= Topic.count %></b> topics, and <b><%= User.count %></b> users.
Our newest member is <%= namelink User.last %> and most active member is <%= namelink User.posts_stats.first %>.
</td>
</tr>
</table>
</div>
</div>
<% if Forum.new.can_create? cuser %>
<p>
<%= link_to 'New forum', new_forum_path %>
</p>
<% end %>