Erased extra empty HTML for comments without replies. Added .gitignore rules for Netbeans projects

Cambios para hacer commit:
	modificado:    .gitignore
	modificado:    app/assets/javascripts/comments.js.coffee
	modificado:    app/views/comments/_comment.html.erb
	modificado:    spec/features/comments/debates_spec.rb
This commit is contained in:
iagirre
2017-09-13 13:30:37 +02:00
parent a5b6620537
commit 1356ea217b
4 changed files with 11 additions and 0 deletions

3
.gitignore vendored
View File

@@ -32,3 +32,6 @@
public/sitemap.xml
public/system/
#Netbeans projects files
/nbproject

View File

@@ -5,6 +5,8 @@ App.Comments =
this.update_comments_count()
add_reply: (parent_id, response_html) ->
if $("##{parent_id} .comment-children").length == 0
$("##{parent_id}").append("<li><ul id='#{parent_id}_children' class='no-bullet comment-children'></ul></li>")
$("##{parent_id} .comment-children:first").prepend($(response_html))
this.update_comments_count()

View File

@@ -93,6 +93,7 @@
</div>
<% end %>
</li>
<%unless child_comments_of(comment).empty?%>
<li>
<ul id="<%= dom_id(comment) %>_children" class="no-bullet comment-children">
<% child_comments_of(comment).each do |child| %>
@@ -102,5 +103,6 @@
<% end %>
</ul>
</li>
<%end%>
</ul>
<% end %>

View File

@@ -33,6 +33,10 @@ feature 'Commenting debates' do
expect(page).to have_content second_child.body
expect(page).to have_link "Go back to #{debate.title}", href: debate_path(debate)
expect(page).to have_selector("ul#comment_#{parent_comment.id}>li", count: 2)
expect(page).to have_selector("ul#comment_#{first_child.id}>li", count: 1)
expect(page).to have_selector("ul#comment_#{second_child.id}>li", count: 1)
end
scenario 'Collapsable comments', :js do