Sha256: ed3ffc4d489c921b96fc6f6239787b486e30edd7d2ca91a51d52ffcb968fa4a7

Contents?: true

Size: 844 Bytes

Versions: 16

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Budgets
    module Admin
      # This controller is the abstract class from which all other controllers of
      # this engine inherit.
      #
      # Note that it inherits from `Decidim::Components::BaseController`, which
      # override its layout and provide all kinds of useful methods.
      class ApplicationController < Decidim::Admin::Components::BaseController
        helper_method :budget, :projects, :project

        def budget
          @budget ||= Budget.where(component: current_component).includes(:projects).find_by(id: params[:budget_id])
        end

        def projects
          return unless budget

          @projects ||= budget.projects
        end

        def project
          @project ||= projects.find(params[:id])
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
decidim-budgets-0.28.4 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.27.9 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.28.3 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.27.8 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.28.2 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.27.7 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.28.1 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.27.6 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.26.10 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.26.9 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.28.0 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.27.5 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.28.0.rc5 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.28.0.rc4 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.26.8 app/controllers/decidim/budgets/admin/application_controller.rb
decidim-budgets-0.27.4 app/controllers/decidim/budgets/admin/application_controller.rb