Sha256: 0376528a90b079fe1c50144a9878197407ea61f87e90da104c1ec1e033aabeea
Contents?: true
Size: 1.03 KB
Versions: 37
Compression:
Stored size: 1.03 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? && survey.open?) 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
37 entries across 37 versions & 1 rubygems