Sha256: f56408eecd40b1ee4cc09f21dcbb2721c2d56f20a175949b7b2f9cf734c87ac2
Contents?: true
Size: 984 Bytes
Versions: 25
Compression:
Stored size: 984 Bytes
Contents
# frozen_string_literal: true module Decidim module Templates module Admin # This command deals with destroying a template from the admin panel. class DestroyTemplate < Decidim::Command # Public: Initializes the command. # # template - The Template to be destroyed. # user - The user that destroys the template. def initialize(template, current_user) @template = template @current_user = current_user end # Public: Executes the command. # # Broadcasts :ok if it got destroyed def call destroy_template broadcast(:ok) end private attr_reader :template, :current_user def destroy_template Decidim.traceability.perform_action!( :delete, template, current_user ) do template.destroy! end end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems