Files
nairobi/app/components/budgets/budget_component.rb
Julian Herrero 7e3dd47d5a 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.
2021-03-18 15:03:21 +01:00

23 lines
554 B
Ruby

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