Class: Decidim::Surveys::SurveysController
- Inherits:
-
ApplicationController
- Object
- DecidimController
- ApplicationController
- Components::BaseController
- ApplicationController
- Decidim::Surveys::SurveysController
- Includes:
- ComponentPathHelper, FilterResource, Forms::Concerns::HasQuestionnaire, Paginable, SurveyHelper
- Defined in:
- decidim-surveys/app/controllers/decidim/surveys/surveys_controller.rb
Overview
Exposes the survey resource so users can view and respond them.
Constant Summary
Constants included from Paginable
Instance Method Summary collapse
Methods included from SurveyHelper
#authorization_action, #authorizations, #authorize_action_path, #current_component, #filter_date_values, #no_permission, #resource
Methods included from ComponentPathHelper
#can_be_managed?, #main_component_path, #main_component_url, #manage_component_path
Methods inherited from Components::BaseController
#current_component, #current_manifest, #current_participatory_space, #permission_class_chain, #permission_scope, #redirect_unless_feature_private, #set_component_breadcrumb_item
Methods included from RegistersPermissions
Methods inherited from ApplicationController
Methods included from UserBlockedChecker
#check_user_block_status, #check_user_not_blocked
Methods included from NeedsSnippets
Methods included from Headers::HttpCachingDisabler
Methods included from HasStoredPath
#skip_store_location?, #store_current_location
Methods included from TranslatableAttributes
#attachment?, #default_locale?
Methods included from NeedsOrganization
enhance_controller, extended, included
Instance Method Details
#check_permissions ⇒ Object
32 33 34 |
# File 'decidim-surveys/app/controllers/decidim/surveys/surveys_controller.rb', line 32 def render :no_permission unless (:response, resource: survey).ok? end |
#edit ⇒ Object
24 25 26 27 28 29 30 |
# File 'decidim-surveys/app/controllers/decidim/surveys/surveys_controller.rb', line 24 def edit @form = form(Decidim::Forms::QuestionnaireForm).from_model(questionnaire) @form.add_responses!(questionnaire:, session_token:, ip_hash:) @form.allow_editing_responses = questionnaire.questionnaire_for&.allow_editing_responses? render template: "decidim/forms/questionnaires/edit" end |
#index ⇒ Object
22 |
# File 'decidim-surveys/app/controllers/decidim/surveys/surveys_controller.rb', line 22 def index; end |
#questionnaire_for ⇒ Object
36 37 38 |
# File 'decidim-surveys/app/controllers/decidim/surveys/surveys_controller.rb', line 36 def questionnaire_for survey end |