Merge pull request #1862 from wairbut-m2c/iagirre-comments-empty-html

Iagirre comments empty html
This commit is contained in:
BertoCQ
2017-09-13 19:16:25 +02:00
committed by GitHub
8 changed files with 27 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 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

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

View File

@@ -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

View File

@@ -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

View File

@@ -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