adds appropriate text for comment replies

This commit is contained in:
rgarcia
2015-07-25 18:56:52 +02:00
parent 3cec9b98f2
commit b674e109a5
2 changed files with 13 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
module CommentsHelper
def comment_link_text(parent)
parent.class == Debate ? "Comentar" : "Responder"
end
def comment_button_text(parent)
parent.class == Debate ? "Publicar comentario" : "Publicar respuesta"
end
end

View File

@@ -1,4 +1,4 @@
<%= link_to "Comentar", "", class: "js-add-comment-link", data: {'id': parent.id} %>
<%= link_to comment_link_text(parent), "", class: "js-add-comment-link", data: {'id': parent.id} %>
<div id="js-comment-form-<%= parent.id %>" style="display:none">
<%= form_for [@debate, Comment.new] do |f| %>
@@ -6,6 +6,6 @@
<%= f.hidden_field :commentable_type, value: parent.class %>
<%= f.hidden_field :commentable_id, value: parent.id %>
<%= f.submit 'Publicar comentario' %>
<%= f.submit comment_button_text(parent) %>
<% end %>
</div>