Sha256: d52e6ad5b7ea0f66d66b79e06fff767e13b73884b63a65c6418de983c349bd98

Contents?: true

Size: 985 Bytes

Versions: 45

Compression:

Stored size: 985 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Budgets
    # 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::Components::BaseController
      helper_method :current_workflow, :voting_finished?, :voting_open?

      def current_workflow
        @current_workflow ||= Decidim::Budgets.workflows[workflow_name].new(current_component, current_user)
      end

      def voting_open?
        current_settings.votes == "enabled"
      end

      def voting_finished?
        current_settings.votes == "finished"
      end

      def show_votes_count?
        current_settings.show_votes?
      end

      private

      def workflow_name
        @workflow_name ||= current_component.settings.workflow.to_sym
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
decidim-budgets-0.27.9 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.27.8 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.27.7 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.27.6 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.26.10 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.26.9 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.27.5 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.26.8 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.27.4 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.27.3 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.26.7 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.26.5 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.27.2 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.27.1 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.26.4 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.27.0 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.26.3 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.27.0.rc2 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.27.0.rc1 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.26.2 app/controllers/decidim/budgets/application_controller.rb