2014-04-12 01:35:42 +00:00
|
|
|
<div id="topic">
|
|
|
|
<%= render partial: 'breadcrumbs', locals: { topic: @topic } %>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-12 01:35:42 +00:00
|
|
|
<h2><%= namelink @topic %></h2>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-12 01:35:42 +00:00
|
|
|
<% if @posts.count > Topic::POSTS_PAGE %>
|
|
|
|
<%= will_paginate @posts %>
|
|
|
|
<% end %>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-12 01:35:42 +00:00
|
|
|
<div class="controls">
|
|
|
|
<% 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 %>
|
|
|
|
</div>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-12 01:35:42 +00:00
|
|
|
<div id="posts">
|
|
|
|
<% @posts.each_with_index do |post, n| %>
|
|
|
|
<%= render partial: "posts/post", locals: { post: post, n: n } %>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<% if @newpost.errors.count > 0 %>
|
2014-04-13 11:16:51 +00:00
|
|
|
<div class="flash warning">
|
|
|
|
<ul>
|
|
|
|
<% @newpost.error_messages.each do |m| %>
|
|
|
|
<li><%= h m %></li>
|
|
|
|
<% end %>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2014-04-12 01:35:42 +00:00
|
|
|
<% end %>
|
|
|
|
</div>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-12 01:35:42 +00:00
|
|
|
<div id="reply">
|
|
|
|
<h5>New Reply</h5>
|
|
|
|
|
|
|
|
<%= form_for(@newpost, remote: true, html: { class: 'square' }) do |f| %>
|
|
|
|
<%= f.error_messages %>
|
|
|
|
<%= f.hidden_field :topic_id %>
|
|
|
|
<div class="fields horizontal">
|
|
|
|
<%= f.label "Enter your post text:" %>
|
|
|
|
<%= f.text_area :text, rows: 10 %>
|
|
|
|
</div>
|
|
|
|
<div class="controls horizontal">
|
|
|
|
<%= f.submit 'Post Message' %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-12 01:35:42 +00:00
|
|
|
<%= will_paginate @posts %>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-13 11:16:51 +00:00
|
|
|
<div>
|
2014-04-12 01:35:42 +00:00
|
|
|
<% 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 %>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-12 01:35:42 +00:00
|
|
|
<% 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 %>
|
|
|
|
</div>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-12 01:35:42 +00:00
|
|
|
<%= render partial: 'breadcrumbs', locals: { topic: @topic } %>
|
|
|
|
</div>
|