Unify budget landing pages
There was a big difference between the current budget and a specific budget landing page. This didn't really make too much sense. Also, it was not possible to know how a draft participatory budget will look before it was published. By unifying those two views now they will look quite similar and it will be possible for administrators to preview any draft budget and to know how the budget will look like before actually publishing it.
This commit is contained in:
committed by
Javi Martín
parent
6cfb862553
commit
7e3dd47d5a
32
app/components/budgets/budget_component.html.erb
Normal file
32
app/components/budgets/budget_component.html.erb
Normal file
@@ -0,0 +1,32 @@
|
||||
<div class="budget-header">
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<h1><%= budget.name %></h1>
|
||||
<div class="description">
|
||||
<%= auto_link_already_sanitized_html wysiwyg(budget.description) %>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<%= link_to t("budgets.index.section_header.help"), "#section_help" %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render Budgets::SubheaderComponent.new(budget) %>
|
||||
<%= render Budgets::PhasesComponent.new(budget) %>
|
||||
|
||||
<div id="budget_info" class="budget-info">
|
||||
<div class="row margin-top">
|
||||
<div class="small-12 column">
|
||||
<%= render Budgets::GroupsAndHeadingsComponent.new(budget) %>
|
||||
|
||||
<% unless budget.informing? %>
|
||||
<div class="map inline">
|
||||
<h3><%= t("budgets.index.map") %></h3>
|
||||
<%= render_map(nil, "budgets", false, nil, coordinates) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
22
app/components/budgets/budget_component.rb
Normal file
22
app/components/budgets/budget_component.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class Budgets::BudgetComponent < ApplicationComponent
|
||||
delegate :wysiwyg, :auto_link_already_sanitized_html, :render_map, to: :helpers
|
||||
attr_reader :budget
|
||||
|
||||
def initialize(budget)
|
||||
@budget = budget
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def coordinates
|
||||
return unless budget.present?
|
||||
|
||||
if budget.publishing_prices_or_later? && budget.investments.selected.any?
|
||||
investments = budget.investments.selected
|
||||
else
|
||||
investments = budget.investments
|
||||
end
|
||||
|
||||
MapLocation.where(investment_id: investments).map(&:json_data)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user