43 lines
1.9 KiB
Plaintext
43 lines
1.9 KiB
Plaintext
<% title "Forums" %>
|
|
|
|
<div id="forum_groups">
|
|
<% @groups.each do |group| %>
|
|
<div class="item-group" id="group-<%= group.id %>">
|
|
<div class="header">
|
|
<%= group.name %>
|
|
<%= link_to "edit", edit_forumgroup_path(group), class: "editlink" if admin? %>
|
|
<div class="clear-right"></div>
|
|
</div>
|
|
|
|
<div class="items bold">
|
|
<% group.forums.sort_by{ |f| f.position || 0 }.each do |f| %>
|
|
<% if f.can_read?(current_user) %>
|
|
<div class="item">
|
|
<%= link_to f.name, f, id: "forum-#{f.id}"%>
|
|
<div class="item-info">
|
|
<% if last_thread = f.threads.last %>
|
|
<% last_reply = Threadreply.where(forumthread: f.threads).order(:created_at).last %>
|
|
<% if last_reply && last_reply.created_at > last_thread.created_at %>
|
|
<%= last_reply.author.name %> <%= link_to "replied", forumthread_path(last_reply.thread) + "#reply-#{last_reply.id}" %> <time title="<%= last_reply.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= last_reply.created_at.to_datetime.rfc3339 %>"><%= last_reply.created_at.strftime("%e %b %Y, %H:%M") %></time>.
|
|
<% else %>
|
|
<%= last_thread.author.name %> <%= link_to "posted", forumthread_path(last_thread) %> <time title="<%= last_thread.created_at.strftime("%e %b %Y, %H:%M") %>" datetime="<%= last_thread.created_at.to_datetime.rfc3339 %>"><%= last_thread.created_at.strftime("%e %b %Y, %H:%M") %></time>.
|
|
<% end %>
|
|
<% else %>
|
|
No posts yet.
|
|
<% end %>
|
|
</div>
|
|
<div class="clear"></div>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% if admin? %>
|
|
<%= link_to "New group", new_forumgroup_path, class: "btn blue" %>
|
|
<% elsif mod? %>
|
|
<%= link_to "New group", "#", class: "btn blue", disabled: true %>
|
|
<% end %> |