Improvements on budget results view & table
This commit is contained in:
@@ -226,6 +226,11 @@ a {
|
|||||||
a {
|
a {
|
||||||
color: $text-medium;
|
color: $text-medium;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
font-weight: bold;
|
||||||
|
color: $brand;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
@@ -236,11 +241,6 @@ a {
|
|||||||
border-bottom: 2px solid $brand;
|
border-bottom: 2px solid $brand;
|
||||||
color: $brand;
|
color: $brand;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.bold {
|
|
||||||
font-weight: bold;
|
|
||||||
color: $brand;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.no-margin-top {
|
&.no-margin-top {
|
||||||
|
|||||||
@@ -7,25 +7,21 @@ module Budgets
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
authorize! :read_results, @budget
|
authorize! :read_results, @budget
|
||||||
@investments = load_result.investments
|
@investments = Budget::Result.new(@budget, @heading).investments
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def load_result
|
|
||||||
Budget::Result.new(@budget, @heading)
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_budget
|
def load_budget
|
||||||
@budget = Budget.find_by(id: params[:budget_id])
|
@budget = Budget.find_by(id: params[:budget_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_heading
|
def load_heading
|
||||||
if params[:heading_id].present?
|
@heading = if params[:heading_id].present?
|
||||||
@heading = @budget.headings.find(params[:heading_id])
|
@budget.headings.find(params[:heading_id])
|
||||||
else
|
else
|
||||||
@heading = @budget.headings.first
|
@budget.headings.first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="small-12 medium-9 column <%= results_type == :compatible ? 'success' : 'js-discarded' %>"
|
<div class="small-12 medium-9 large-10 column <%= results_type == :compatible ? 'success' : 'js-discarded' %>"
|
||||||
style="<%= results_type != :compatible ? 'display: none' : '' %>"
|
style="<%= results_type != :compatible ? 'display: none' : '' %>"
|
||||||
id="<%= results_type %>-container">
|
id="<%= results_type %>-container">
|
||||||
|
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
</th>
|
</th>
|
||||||
<% if results_type == :compatible %>
|
<% if results_type == :compatible %>
|
||||||
<th scope="col" class="text-right">
|
<th scope="col" class="text-right">
|
||||||
|
<small><%= t("budgets.results.amount_available") %></small><br>
|
||||||
<%= format_price(heading_price) %><br>
|
<%= format_price(heading_price) %><br>
|
||||||
<small><%= t("budgets.results.amount_available") %></small>
|
|
||||||
</th>
|
</th>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -10,37 +10,49 @@
|
|||||||
<%= render "shared/canonical", href: budget_results_url(@budget) %>
|
<%= render "shared/canonical", href: budget_results_url(@budget) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="expanded budget no-margin-top">
|
<div class="budgets-stats">
|
||||||
<div class="row">
|
<div class="expanded no-margin-top padding header">
|
||||||
<div class="small-12 column padding text-center">
|
<div class="row">
|
||||||
<%= back_link_to budget_path(@budget) %>
|
<div class="small-12 column text-center">
|
||||||
|
<%= back_link_to budget_path(@budget) %>
|
||||||
<h2 class="title">
|
<h1 class="title"><%= t("budgets.results.heading") %><br><%= @budget.name %></h1>
|
||||||
<%= @budget.name %><br>
|
</div>
|
||||||
<%= t("budgets.results.heading") %>
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row margin-top">
|
<div class="row margin-top">
|
||||||
<div class="small-12 medium-3 column">
|
<div class="small-12 column">
|
||||||
<ul class="menu vertical no-margin-top no-padding-top">
|
<ul class="tabs">
|
||||||
<li>
|
<li class="tabs-title is-active">
|
||||||
<strong>
|
<span class="show-for-sr"><%= t("shared.you_are_in") %></span>
|
||||||
<%= t("budgets.results.geozone_selection_title") %>
|
<%= link_to t("budgets.results.link"), budget_results_path(@budget), class: "is-active" %>
|
||||||
</strong>
|
</li>
|
||||||
|
<li class="tabs-title">
|
||||||
|
<%# link_to t("budgets.stats.link"), budget_stats_path(@budget)%>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<% @budget.headings.each do |heading| %>
|
|
||||||
<% active_class = heading.id.to_s == params[:heading_id] ? 'bold' : '' %>
|
|
||||||
<li class="<%= active_class %>">
|
|
||||||
<%= link_to heading.name,
|
|
||||||
budget_results_path(@budget, heading_id: heading.id) %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="small-12 medium-3 large-2 column">
|
||||||
|
<div class="row">
|
||||||
|
<ul class="menu vertical no-margin-top no-padding-top">
|
||||||
|
<h3>
|
||||||
|
<%= t("budgets.results.heading_selection_title") %>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<% @budget.headings.order('id ASC').each do |heading| %>
|
||||||
|
<li>
|
||||||
|
<%= link_to heading.name,
|
||||||
|
budget_results_path(@budget, heading_id: heading.to_param),
|
||||||
|
class: heading.to_param == @heading.to_param ? 'active' : '' %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<span class="float-right"><%= link_to t("budgets.results.show_all_link"), "#", class: "js-toggle-link button hollow margin-bottom", data: {'toggle-selector' => '.js-discarded', 'toggle-text' => t("budgets.results.hide_discarded_link")} %></span>
|
<span class="float-right"><%= link_to t("budgets.results.show_all_link"), "#", class: "js-toggle-link button hollow margin-bottom", data: {'toggle-selector' => '.js-discarded', 'toggle-text' => t("budgets.results.hide_discarded_link")} %></span>
|
||||||
|
|
||||||
|
|||||||
@@ -125,9 +125,10 @@ en:
|
|||||||
unselected: See investments not selected for balloting phase
|
unselected: See investments not selected for balloting phase
|
||||||
see_results: See results
|
see_results: See results
|
||||||
results:
|
results:
|
||||||
|
link: Results
|
||||||
page_title: "%{budget} - Results"
|
page_title: "%{budget} - Results"
|
||||||
heading: "Participatory budget results"
|
heading: "Participatory budget results"
|
||||||
geozone_selection_title: "By district"
|
heading_selection_title: "By district"
|
||||||
spending_proposal: Proposal title
|
spending_proposal: Proposal title
|
||||||
ballot_lines_count: Times selected
|
ballot_lines_count: Times selected
|
||||||
hide_discarded_link: Hide discarded
|
hide_discarded_link: Hide discarded
|
||||||
|
|||||||
@@ -125,9 +125,10 @@ es:
|
|||||||
unselected: Ver las propuestas no seleccionadas para la votación final
|
unselected: Ver las propuestas no seleccionadas para la votación final
|
||||||
see_results: Ver resultados
|
see_results: Ver resultados
|
||||||
results:
|
results:
|
||||||
|
link: Resultados
|
||||||
page_title: "%{budget} - Resultados"
|
page_title: "%{budget} - Resultados"
|
||||||
heading: "Resultados presupuestos participativos"
|
heading: "Resultados presupuestos participativos"
|
||||||
geozone_selection_title: "Ámbito de actuación"
|
heading_selection_title: "Ámbito de actuación"
|
||||||
spending_proposal: Título
|
spending_proposal: Título
|
||||||
ballot_lines_count: Votos
|
ballot_lines_count: Votos
|
||||||
hide_discarded_link: Ocultar descartadas
|
hide_discarded_link: Ocultar descartadas
|
||||||
@@ -137,4 +138,3 @@ es:
|
|||||||
accepted: "Propuesta de inversión aceptada: "
|
accepted: "Propuesta de inversión aceptada: "
|
||||||
discarded: "Propuesta de inversión descartada: "
|
discarded: "Propuesta de inversión descartada: "
|
||||||
incompatibles: Incompatibles
|
incompatibles: Incompatibles
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,13 @@ feature 'Results' do
|
|||||||
let!(:results) { Budget::Result.new(budget, heading).calculate_winners }
|
let!(:results) { Budget::Result.new(budget, heading).calculate_winners }
|
||||||
|
|
||||||
scenario "Diplays winner investments" do
|
scenario "Diplays winner investments" do
|
||||||
|
create(:budget_heading, group: group)
|
||||||
|
|
||||||
visit budget_path(budget)
|
visit budget_path(budget)
|
||||||
click_link "See results"
|
click_link "See results"
|
||||||
|
|
||||||
|
expect(page).to have_selector('a.active', text: budget.headings.first.name)
|
||||||
|
|
||||||
within("#budget-investments-compatible") do
|
within("#budget-investments-compatible") do
|
||||||
expect(page).to have_content investment1.title
|
expect(page).to have_content investment1.title
|
||||||
expect(page).to have_content investment2.title
|
expect(page).to have_content investment2.title
|
||||||
|
|||||||
Reference in New Issue
Block a user