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.26.1 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.26.0 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.26.0.rc2 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.26.0.rc1 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.25.2 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.25.1 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.25.0 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.25.0.rc4 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.25.0.rc3 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.25.0.rc2 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.25.0.rc1 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.24.3 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.23.6 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.24.2 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.23.5 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.24.1 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.24.0 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.24.0.rc2 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.23.4 app/controllers/decidim/budgets/application_controller.rb
decidim-budgets-0.24.0.rc1 app/controllers/decidim/budgets/application_controller.rb