This repository has been archived on 2024-08-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
redstoner.com/app/views/forums/index.html.erb
jomo 55f92fe45a enable write-only forums
when the role-write is lower than the role-read, a forum is considered write-only
for anyone who can write, but not read, they can create posts, but they can only see and reply to their own posts.

users who can read are able to see and reply to all posts in the forum.
2015-01-17 19:40:57 +01:00

55 lines
2.0 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_view?(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 %>
<% if last_reply.thread.can_read?(current_user) %>
<%= last_reply.author.name %>
<%= link_to "replied", forumthread_path(last_reply.thread) + "#reply-#{last_reply.id}" %>
<%= ago last_reply.created_at %>.
<% else %>
Hidden
<% end %>
<% else %>
<% if last_thread.can_read?(current_user) %>
<%= last_thread.author.name %>
<%= link_to "posted", forumthread_path(last_thread) %>
<%= ago last_thread.created_at %>.
<% else %>
Hidden
<% end %>
<% 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 %>