Add show and collapse text on comments tree
This commit is contained in:
@@ -86,7 +86,9 @@
|
||||
<%= link_to "", class: "js-toggle-children relative", data: {"id": "#{dom_id(comment)}"} do %>
|
||||
<span class="show-for-sr js-child-toggle" style="display: none;"><%= t("shared.show") %></span>
|
||||
<span class="show-for-sr js-child-toggle"><%= t("shared.hide") %></span>
|
||||
<span id="<%= dom_id(comment) %>_children_arrow" class="icon-arrow-down"></span> <%= t("comments.comment.responses", count: comment.children.size) %>
|
||||
<span id="<%= dom_id(comment) %>_children_arrow" class="icon-arrow-down"></span>
|
||||
<span class="js-child-toggle" style="display: none;"><%= t("comments.comment.responses_show", count: comment.children.size) %></span>
|
||||
<span class="js-child-toggle"><%= t("comments.comment.responses_collapse", count: comment.children.size) %></span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= t("comments.comment.responses", count: 0) %>
|
||||
|
||||
@@ -51,6 +51,14 @@ en:
|
||||
one: 1 response
|
||||
other: "%{count} responses"
|
||||
zero: No responses
|
||||
responses_show:
|
||||
one: "1 response (show)"
|
||||
other: "%{count} responses (show)"
|
||||
zero: No responses
|
||||
responses_collapse:
|
||||
one: "1 response (collapse)"
|
||||
other: "%{count} responses (collapse)"
|
||||
zero: No responses
|
||||
user_deleted: User deleted
|
||||
votes:
|
||||
one: 1 vote
|
||||
|
||||
@@ -49,8 +49,16 @@ es:
|
||||
moderator: Moderador
|
||||
responses:
|
||||
zero: Sin respuestas
|
||||
one: 1 Respuesta
|
||||
other: "%{count} Respuestas"
|
||||
one: 1 respuesta
|
||||
other: "%{count} respuestas"
|
||||
responses_show:
|
||||
one: "1 respuesta (mostrar)"
|
||||
other: "%{count} respuestas (mostrar)"
|
||||
zero: Sin respuestas
|
||||
responses_collapse:
|
||||
one: "1 respuesta (colapsar)"
|
||||
other: "%{count} respuestas (colapsar)"
|
||||
zero: Sin respuestas
|
||||
user_deleted: Usuario eliminado
|
||||
votes:
|
||||
zero: Sin votos
|
||||
|
||||
@@ -67,20 +67,25 @@ describe "Commenting Budget::Investments" do
|
||||
visit budget_investment_path(investment.budget, investment)
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 2)
|
||||
expect(page).to have_content("1 response (collapse)")
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
expect(page).to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{parent_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 1)
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content child_comment.body
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
end
|
||||
|
||||
@@ -74,20 +74,25 @@ describe "Internal valuation comments on Budget::Investments" do
|
||||
visit valuation_budget_budget_investment_path(budget, investment)
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 2)
|
||||
expect(page).to have_content("1 response (collapse)")
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
expect(page).to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{parent_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 1)
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content child_comment.body
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
end
|
||||
|
||||
@@ -62,20 +62,25 @@ describe "Commenting debates" do
|
||||
visit debate_path(debate)
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 2)
|
||||
expect(page).to have_content("1 response (collapse)")
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
expect(page).to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{parent_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 1)
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content child_comment.body
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
end
|
||||
|
||||
@@ -70,20 +70,25 @@ describe "Commenting legislation questions" do
|
||||
legislation_annotation)
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 2)
|
||||
expect(page).to have_content("1 response (collapse)")
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
expect(page).to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{parent_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 1)
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content child_comment.body
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
end
|
||||
|
||||
@@ -69,20 +69,25 @@ describe "Commenting legislation questions" do
|
||||
visit legislation_process_question_path(legislation_question.process, legislation_question)
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 2)
|
||||
expect(page).to have_content("1 response (collapse)")
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
expect(page).to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{parent_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 1)
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content child_comment.body
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
end
|
||||
|
||||
@@ -63,20 +63,25 @@ describe "Commenting polls" do
|
||||
visit poll_path(poll)
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 2)
|
||||
expect(page).to have_content("1 response (collapse)")
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
expect(page).to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{parent_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 1)
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content child_comment.body
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
end
|
||||
|
||||
@@ -61,20 +61,25 @@ describe "Commenting proposals" do
|
||||
visit proposal_path(proposal)
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 2)
|
||||
expect(page).to have_content("1 response (collapse)")
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
expect(page).to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{parent_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 1)
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content child_comment.body
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
end
|
||||
|
||||
@@ -66,20 +66,25 @@ describe "Commenting topics from proposals" do
|
||||
visit community_topic_path(community, topic)
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 2)
|
||||
expect(page).to have_content("1 response (collapse)")
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{child_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 3)
|
||||
expect(page).to have_content("1 response (collapse)", count: 2)
|
||||
expect(page).to have_content grandchild_comment.body
|
||||
|
||||
find("#comment_#{parent_comment.id}_children_arrow").click
|
||||
|
||||
expect(page).to have_css(".comment", count: 1)
|
||||
expect(page).to have_content("1 response (show)")
|
||||
expect(page).not_to have_content child_comment.body
|
||||
expect(page).not_to have_content grandchild_comment.body
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user