diff --git a/.gitignore b/.gitignore index a6f2826c3..7bb7a3090 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,6 @@ public/sitemap.xml public/system/ + +#Netbeans projects files +/nbproject diff --git a/app/assets/javascripts/comments.js.coffee b/app/assets/javascripts/comments.js.coffee index fefe85544..94845ca78 100644 --- a/app/assets/javascripts/comments.js.coffee +++ b/app/assets/javascripts/comments.js.coffee @@ -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("
  • ") $("##{parent_id} .comment-children:first").prepend($(response_html)) this.update_comments_count() diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index c22e7aa19..0000f8cc0 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -93,6 +93,7 @@ <% end %> + <% unless child_comments_of(comment).empty? %>
  • + <% end %> <% end %> diff --git a/spec/features/comments/budget_investments_spec.rb b/spec/features/comments/budget_investments_spec.rb index 587a1c517..ae8fc935a 100644 --- a/spec/features/comments/budget_investments_spec.rb +++ b/spec/features/comments/budget_investments_spec.rb @@ -33,6 +33,10 @@ feature 'Commenting Budget::Investments' do expect(page).to have_content second_child.body expect(page).to have_link "Go back to #{investment.title}", href: budget_investment_path(investment.budget, investment) + + 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 diff --git a/spec/features/comments/debates_spec.rb b/spec/features/comments/debates_spec.rb index 76320a848..28166784a 100644 --- a/spec/features/comments/debates_spec.rb +++ b/spec/features/comments/debates_spec.rb @@ -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 diff --git a/spec/features/comments/legislation_annotations_spec.rb b/spec/features/comments/legislation_annotations_spec.rb index 87896df03..aad2b90b2 100644 --- a/spec/features/comments/legislation_annotations_spec.rb +++ b/spec/features/comments/legislation_annotations_spec.rb @@ -38,6 +38,10 @@ feature 'Commenting legislation questions' do expect(page).to have_content second_child.body expect(page).to have_link "Go back to #{legislation_annotation.title}", href: href + + 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 diff --git a/spec/features/comments/legislation_questions_spec.rb b/spec/features/comments/legislation_questions_spec.rb index 50eb60172..d21cefc4e 100644 --- a/spec/features/comments/legislation_questions_spec.rb +++ b/spec/features/comments/legislation_questions_spec.rb @@ -35,6 +35,10 @@ feature 'Commenting legislation questions' do expect(page).to have_content second_child.body expect(page).to have_link "Go back to #{legislation_question.title}", href: href + + 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 diff --git a/spec/features/comments/proposals_spec.rb b/spec/features/comments/proposals_spec.rb index 475e018f3..acba0bec9 100644 --- a/spec/features/comments/proposals_spec.rb +++ b/spec/features/comments/proposals_spec.rb @@ -32,6 +32,10 @@ feature 'Commenting proposals' do expect(page).to have_content first_child.body expect(page).to have_content second_child.body expect(page).to have_link "Go back to #{proposal.title}", href: proposal_path(proposal) + + 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