Sha256: 0bfdbf81bf4440e1782361167cb3bf63b25320455bfe25b3dea6054ce9860c2b
Contents?: true
Size: 902 Bytes
Versions: 33
Compression:
Stored size: 902 Bytes
Contents
# frozen_string_literal: true module Decidim module Templates module Admin # Creates a QuestionnaireTemplate. class CreateQuestionnaireTemplate < Rectify::Command # Initializes the command. # # form - The source for this QuestionnaireTemplate. def initialize(form) @form = form end def call return broadcast(:invalid) unless @form.valid? @template = Decidim.traceability.create!( Template, @form.current_user, name: @form.name, description: @form.description, organization: @form.current_organization ) @questionnaire = Decidim::Forms::Questionnaire.create!(questionnaire_for: @template) @template.update!(templatable: @questionnaire) broadcast(:ok, @template) end end end end end
Version data entries
33 entries across 33 versions & 1 rubygems