Sha256: c0aa71545cf27954b955affc76339f9661ec0a1b8c7ea3b951a8793c7afb5f5e

Contents?: true

Size: 974 Bytes

Versions: 13

Compression:

Stored size: 974 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Budgets
    # Exposes the budget resources so users can participate on them
    class BudgetsController < Decidim::Budgets::ApplicationController
      helper_method :announcement_body

      include Decidim::Budgets::Orderable
      include Decidim::TranslatableAttributes

      def index
        redirect_to budget_projects_path(current_workflow.single) if current_workflow.single?
      end

      def show
        raise ActionController::RoutingError, "Not Found" unless budget

        redirect_to budget_projects_path(budget)
      end

      private

      def announcement_body
        @announcement_body ||= [translated_attribute(current_settings.announcement), translated_attribute(component_settings.announcement)].find(&:present?)&.html_safe
      end

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-budgets-0.29.1 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.28.4 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.29.0 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.28.3 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.29.0.rc4 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.29.0.rc3 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.29.0.rc2 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.29.0.rc1 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.28.2 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.28.1 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.28.0 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.28.0.rc5 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.28.0.rc4 app/controllers/decidim/budgets/budgets_controller.rb