Sha256: 295030dd6449b6ce5cd9cb7c5bd43652f08a70a6bd5a610de5c549a1d0be4f0b
Contents?: true
Size: 964 Bytes
Versions: 12
Compression:
Stored size: 964 Bytes
Contents
# frozen_string_literal: true module Decidim module Templates module Admin # Updates the questionnaire template given form data. class UpdateTemplate < Decidim::Command # Initializes the command. # # template - The Template to update. # form - The form object containing the data to update. # user - The user that updates the template. def initialize(template, form, user) @template = template @form = form @user = user end def call return broadcast(:invalid) unless @form.valid? return broadcast(:invalid) unless @user.organization == @template.organization @template = Decidim.traceability.update!( @template, @user, name: @form.name, description: @form.description ) broadcast(:ok, @template) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems