Skip to content

Instantly share code, notes, and snippets.

@almaron
Created June 15, 2012 13:49
Show Gist options
  • Save almaron/2936562 to your computer and use it in GitHub Desktop.
Save almaron/2936562 to your computer and use it in GitHub Desktop.
View template for the Forums#show action
#show.html.erb
<table class="forum_list" cellpadding="0" cellspacing="0">
<tr class="forum_th">
<th colspan="2"><%= t "forum.lines.topics" %></th>
<th class="forum_posts"><%= t "forum.lines.posts" %></th>
<th class="forum_last_post"><%= t "forum.lines.last_post" %></th>
<% if user_in?([:admins, :masters]) || user_permitted?(:moderate) %>
<th class="forum_admin"></th>
<th class="forum_admin"></th>
<% end %>
<th class="slide">
<span class="topic_slideToggle t_arr" >&dArr;</span>
<span class="topic_slideToggle t_arr" style="display:none">&uArr;</span>
</th>
</tr>
<% debugger %>
<% if @topics.any? %>
<% @topics.each do |topic| %>
<tr class="forum_list_line topic_line">
<td class="forum_ico">
<% if current_user && current_user.topic_reads.find_by_topic_id(topic.id) && current_user.topic_reads.find_by_topic_id(topic.id).updated_at > topic.posts.last.created_at %>
ico.old
<% else %>
ico.new
<% end %>
</td>
<td><%= link_to topic.head, forum_topic_path(@forum, topic)%></td>
<td class="forum_topics"><%= topic.posts.size %></td>
<td class="forum_last_post">
<% unless topic.posts.empty? %>
<%= topic.posts.last.char.name %> ::
<%= link_to topic.posts.last.created_at.strftime("%d.%m.%Y %H:%M"), forum_topic_last_post_path(@forum, topic) %>
<% end %>
</td>
<% if user_in? :admins %>
<td class="forum_admin">
<%= link_to "&rarr;".html_safe, edit_forum_topic_path(@forum,topic), :remote => true %>
</td>
<td class="forum_admin">
<%= link_to "&times;".html_safe, forum_topic_path(@forum,topic), :method => :delete %>
</td>
<% end %>
<td></td>
</tr>
<% end %>
<% else %>
<tr class="forum_noforums topic_line">
<td colspan="<%= user_in?([:admins, :masters]) || user_permitted?(:moderate) ? 7 : 5 %>">
<span>
<%= t "forum.lines.notopics" %>
</span>
</td>
</tr>
<% end %>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment