Files
grecia/app/controllers/budgets_controller.rb
Javi Martín a7bbdb1bd0 Simplify rendering a banner
Now the banner component accepts either a banner or a section and loads
the banner if it's a section, so we don't have to add the `@banners`
variable in several controllers.
2021-01-20 17:22:05 +01:00

28 lines
714 B
Ruby

class BudgetsController < ApplicationController
include FeatureFlags
include BudgetsHelper
feature_flag :budgets
before_action :load_budget, only: :show
load_and_authorize_resource
before_action :set_default_budget_filter, only: :show
has_filters %w[not_unfeasible feasible unfeasible unselected selected winners], only: :show
respond_to :html, :js
def show
raise ActionController::RoutingError, "Not Found" unless budget_published?(@budget)
end
def index
@finished_budgets = @budgets.finished.order(created_at: :desc)
@budgets_coordinates = current_budget_map_locations
end
private
def load_budget
@budget = Budget.find_by_slug_or_id! params[:id]
end
end