hides comment forms from not logged users

Closes #66
This commit is contained in:
Juanjo Bazán
2015-08-05 14:12:58 +02:00
parent e6ac2a4337
commit 8d87a69e0f
6 changed files with 29 additions and 6 deletions

View File

@@ -8,7 +8,9 @@
<%= comment.user.name %>&nbsp;&bullet;&nbsp;<%= time_ago_in_words(comment.created_at) %>
</span>
<p><%= comment.body %></p>
<p class="reply"><%= render 'comments/form', parent: comment %></p>
<% if user_signed_in? %>
<p class="reply"><%= render 'comments/form', {parent: comment, toggeable: true} %></p>
<% end %>
</div>
<div class="comment-children">

View File

@@ -1,6 +1,6 @@
<%= link_to comment_link_text(parent), "", class: "js-add-comment-link", data: {'id': dom_id(parent)} %>
<%= link_to(comment_link_text(parent), "", class: "js-add-comment-link", data: {'id': dom_id(parent)}) if toggeable %>
<div id="js-comment-form-<%= dom_id(parent) %>" style="display:none">
<div id="js-comment-form-<%= dom_id(parent) %>" <%= "style='display:none'".html_safe if toggeable %>>
<%= form_for [@debate, Comment.new], remote: true do |f| %>
<%= f.text_area :body %>
<%= f.hidden_field :commentable_type, value: parent.class %>