Sha256: ecd32c9082a312f2ed05f3ed21bd90ec6d1e3c7c8ed331a9a2a8bd94f0dfcac1
Contents?: true
Size: 1.01 KB
Versions: 8
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true module Decidim module Surveys # Exposes the survey resource so users can view and answer them. class SurveysController < Decidim::Surveys::ApplicationController include Decidim::Forms::Concerns::HasQuestionnaire include Decidim::ComponentPathHelper helper Decidim::Surveys::SurveyHelper delegate :allow_unregistered?, to: :current_settings before_action :check_permissions def check_permissions render :no_permission unless action_authorized_to(:answer, resource: survey).ok? end def questionnaire_for survey end protected def allow_answers? !current_component.published? || current_settings.allow_answers? end def form_path main_component_path(current_component) end private def i18n_flashes_scope "decidim.surveys.surveys" end def survey @survey ||= Survey.find_by(component: current_component) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems