diff --git a/app/assets/javascripts/comments.js.coffee b/app/assets/javascripts/comments.js.coffee new file mode 100644 index 000000000..a1635b42c --- /dev/null +++ b/app/assets/javascripts/comments.js.coffee @@ -0,0 +1,9 @@ +jQuery -> + + toggle_comment = (id) -> + $("#js-comment-form-#{id}").toggle() + + $('.js-add-comment-link').click -> + id = $(this).data().id + toggle_comment(id) + false \ No newline at end of file diff --git a/app/views/comments/_form.html.erb b/app/views/comments/_form.html.erb index 4ef99b4b0..fbe743f88 100644 --- a/app/views/comments/_form.html.erb +++ b/app/views/comments/_form.html.erb @@ -1,7 +1,11 @@ -<%= form_for [@debate, Comment.new] do |f| %> - <%= f.text_area :body %> - <%= f.hidden_field :commentable_type, value: parent.class %> - <%= f.hidden_field :commentable_id, value: parent.id %> - - <%= f.submit 'Publicar comentario' %> -<% end %> \ No newline at end of file +<%= link_to "Comentar", "", class: "js-add-comment-link", data: {'id': parent.id} %> + +
\ No newline at end of file