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, .debate,
.proposal, .proposal,
.budget-investment, .budget-investment,
.budget-investment-show,
.legislation, .legislation,
.communities-show { .communities-show {
margin: $line-height / 4 0; margin: $line-height / 4 0;

View File

@@ -1,5 +1,10 @@
<p class="investment-project-info"> <p class="investment-project-info">
<%= l investment.created_at.to_date %> <%= 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? %> <% if investment.author.hidden? || investment.author.erased? %>
<span class="bullet">&nbsp;&bull;&nbsp;</span> <span class="bullet">&nbsp;&bull;&nbsp;</span>

View File

@@ -5,6 +5,9 @@
<span class="bullet">&nbsp;&bull;&nbsp;</span> <span class="bullet">&nbsp;&bull;&nbsp;</span>
<%= l investment.created_at.to_date %> <%= l investment.created_at.to_date %>
<span class="bullet">&nbsp;&bull;&nbsp;</span> <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 %> <%= investment.heading.name %>
<span class="bullet">&nbsp;&bull;&nbsp;</span> <span class="bullet">&nbsp;&bull;&nbsp;</span>
<% if local_assigns[:preview].nil? %> <% if local_assigns[:preview].nil? %>

View File

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

View File

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

View File

@@ -62,7 +62,11 @@ describe "Budget Investments" do
investments.each do |investment| investments.each do |investment|
within("#budget-investments") do within("#budget-investments") do
expect(page).to have_content investment.title 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) expect(page).not_to have_content(unfeasible_investment.title)
end end
end end
@@ -849,6 +853,7 @@ describe "Budget Investments" do
expect(page).to have_content(investment.title) expect(page).to have_content(investment.title)
expect(page).to have_content(investment.description) expect(page).to have_content(investment.description)
expect(page).to have_content(investment.author.name) expect(page).to have_content(investment.author.name)
expect(page).to have_content(investment.comments_count)
expect(page).to have_content(investment.heading.name) expect(page).to have_content(investment.heading.name)
within("#investment_code") do within("#investment_code") do
expect(page).to have_content(investment.id) expect(page).to have_content(investment.id)