From 8d87a69e0fe07f61ff2423014c652b599518d176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Wed, 5 Aug 2015 14:12:58 +0200 Subject: [PATCH] hides comment forms from not logged users Closes #66 --- app/views/comments/_comment.html.erb | 4 +++- app/views/comments/_form.html.erb | 4 ++-- app/views/debates/show.html.erb | 8 +++++++- config/locales/en.yml | 1 + config/locales/es.yml | 1 + spec/features/comments_spec.rb | 17 +++++++++++++++-- 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 0d152d928..31b448088 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -8,7 +8,9 @@ <%= comment.user.name %> • <%= time_ago_in_words(comment.created_at) %>

<%= comment.body %>

-

<%= render 'comments/form', parent: comment %>

+ <% if user_signed_in? %> +

<%= render 'comments/form', {parent: comment, toggeable: true} %>

+ <% end %>
diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index 01661221f..da2b3bb61 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -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 %> -