Module: Decidim::Surveys::SurveyHelper

Defined in:
decidim-surveys/app/helpers/decidim/surveys/survey_helper.rb

Instance Method Summary collapse

Instance Method Details

#authorization_actionObject


20
21
22
# File 'decidim-surveys/app/helpers/decidim/surveys/survey_helper.rb', line 20

def authorization_action
  @authorization_action ||= params[:authorization_action]
end

#authorizationsObject


28
29
30
# File 'decidim-surveys/app/helpers/decidim/surveys/survey_helper.rb', line 28

def authorizations
  @authorizations ||= action_authorized_to(:answer, resource: questionnaire_for)
end

#authorize_action_path(handler_name) ⇒ Object


24
25
26
# File 'decidim-surveys/app/helpers/decidim/surveys/survey_helper.rb', line 24

def authorize_action_path(handler_name)
  authorizations.status_for(handler_name).current_path
end

#current_componentObject


16
17
18
# File 'decidim-surveys/app/helpers/decidim/surveys/survey_helper.rb', line 16

def current_component
  @current_component ||= Decidim::Component.find(params[:component_id])
end

#no_permissionObject


6
7
8
9
10
# File 'decidim-surveys/app/helpers/decidim/surveys/survey_helper.rb', line 6

def no_permission
  render(
    partial: "decidim/authorization_modals/content"
  )
end

#resourceObject


12
13
14
# File 'decidim-surveys/app/helpers/decidim/surveys/survey_helper.rb', line 12

def resource
  questionnaire_for
end