<%= provide :content_class, 'no-body' %>
<%= render partial: 'breadcrumbs', locals: { topic: @topic } %>

<%= namelink @topic %>

<% if @posts.count > Topic::POSTS_PAGE %> <%= will_paginate @posts %> <% end %>
<% if @newpost.can_create? cuser %> <%= link_to 'Reply', new_post_path(@newpost, id: @topic), class: 'button' %> <% end %> <% if @topic.can_update? cuser %> <%= link_to 'Edit', edit_topic_path(@topic), class: 'button' %> <% end %>
<% @posts.each_with_index do |post, n| %> <%= render partial: "posts/post", locals: { post: post, n: n } %> <% end %> <% if @newpost.errors.count > 0 %>
    <% @newpost.error_messages.each do |m| %>
  • <%= h m %>
  • <% end %>
<% end %>
New Reply
<%= form_for(@newpost, remote: true, html: { class: 'square' }) do |f| %> <%= f.error_messages %> <%= f.hidden_field :topic_id %>
<%= f.label "Enter your post text:" %> <%= f.text_area :text, rows: 10 %>
<%= f.submit 'Post Message' %>
<% end %>
<%= will_paginate @posts %>
<% if @newpost.can_create? cuser %> <%= link_to_function 'Fast Reply', "$('#reply').fadeIn('slow')", class: 'button' %> <%= link_to 'Reply', new_post_path(@newpost, id: @topic), class: 'button' %> <% end %> <% if @topic.can_update? cuser %> <%= link_to 'Edit', edit_topic_path(@topic), class: 'button' %> <% end %> <% if @lock.new_record? and @lock.can_create? cuser %> <%= form_for @lock do |f| %> <%= f.hidden_field :lockable_type %> <%= f.hidden_field :lockable_id %> <%= link_to_function "Lock", "this.parentNode.submit()", class: 'button' %> <% end %> <% elsif @lock.can_destroy? cuser %> <%= link_to 'Unlock', @lock, class: 'button', confirm: 'Are you sure?', method: :delete %> <% end %>
<%= render partial: 'breadcrumbs', locals: { topic: @topic } %>