Add comments count on budget investments

This commit is contained in:
decabeza
2022-06-01 18:04:33 +02:00
committed by Javi Martín
parent eb39e8e365
commit 52e65ba031
6 changed files with 23 additions and 1 deletions

View File

@@ -486,6 +486,7 @@
.debate,
.proposal,
.budget-investment,
.budget-investment-show,
.legislation,
.communities-show {
margin: $line-height / 4 0;

View File

@@ -1,5 +1,10 @@
<p class="investment-project-info">
<%= l investment.created_at.to_date %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="icon-comments"></span>&nbsp;
<%= link_to t("shared.comments", count: investment.comments_count),
budget_investment_path(investment.budget, investment, anchor: "comments") %>
<% if investment.author.hidden? || investment.author.erased? %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>

View File

@@ -5,6 +5,9 @@
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= l investment.created_at.to_date %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<span class="icon-comments"></span>&nbsp;
<%= link_to t("shared.comments", count: investment.comments_count), "#comments" %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= investment.heading.name %>
<span class="bullet">&nbsp;&bull;&nbsp;</span>
<% if local_assigns[:preview].nil? %>

View File

@@ -763,6 +763,10 @@ en:
other: "%{count} languages in use"
optional: "Optional fields"
required: "Required fields"
comments:
one: "1 comment"
other: "%{count} comments"
zero: "No comments"
social:
facebook: "%{org} Facebook"
twitter: "%{org} Twitter"

View File

@@ -763,6 +763,10 @@ es:
other: "%{count} idiomas en uso"
optional: "Campos opcionales"
required: "Campos obligatorios"
comments:
one: "1 comentario"
other: "%{count} comentarios"
zero: "Sin comentarios"
social:
facebook: "Facebook de %{org}"
twitter: "Twitter de %{org}"

View File

@@ -62,7 +62,11 @@ describe "Budget Investments" do
investments.each do |investment|
within("#budget-investments") do
expect(page).to have_content investment.title
expect(page).to have_css("a[href='#{budget_investment_path(budget, id: investment.id)}']", text: investment.title)
expect(page).to have_content investment.comments_count
expect(page).to have_link "No comments", href: budget_investment_path(budget, id: investment.id,
anchor: "comments")
expect(page).to have_link investment.title, href: budget_investment_path(budget, id: investment.id)
expect(page).not_to have_content(unfeasible_investment.title)
end
end
@@ -849,6 +853,7 @@ describe "Budget Investments" do
expect(page).to have_content(investment.title)
expect(page).to have_content(investment.description)
expect(page).to have_content(investment.author.name)
expect(page).to have_content(investment.comments_count)
expect(page).to have_content(investment.heading.name)
within("#investment_code") do
expect(page).to have_content(investment.id)