Module: Decidim::Consultations::NeedsQuestion

Included in:
AuthorizationVoteModalsController, QuestionMultipleVotesController, QuestionVotesController, QuestionWidgetsController, QuestionsController
Defined in:
app/controllers/concerns/decidim/consultations/needs_question.rb

Overview

This module, when injected into a controller, ensures there’s a question available and deducts it from the context.

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.enhance_controller(instance_or_module) ⇒ Object



8
9
10
11
12
13
14
15
# File 'app/controllers/concerns/decidim/consultations/needs_question.rb', line 8

def self.enhance_controller(instance_or_module)
  instance_or_module.class_eval do
    helper_method :current_question, :previous_question, :next_question, :previous_published_question, :next_published_question,
                  :current_consultation, :current_participatory_space, :stats, :sorted_results

    helper Decidim::WidgetUrlsHelper
  end
end

.extended(base) ⇒ Object



17
18
19
20
21
# File 'app/controllers/concerns/decidim/consultations/needs_question.rb', line 17

def self.extended(base)
  base.extend Decidim::NeedsOrganization, InstanceMethods

  enhance_controller(base)
end

.included(base) ⇒ Object



23
24
25
26
27
# File 'app/controllers/concerns/decidim/consultations/needs_question.rb', line 23

def self.included(base)
  base.include Decidim::NeedsOrganization, InstanceMethods

  enhance_controller(base)
end