Class: Decidim::Templates::Admin::DestroyTemplate

Inherits:
Rectify::Command
  • Object
show all
Defined in:
decidim-templates/app/commands/decidim/templates/admin/destroy_template.rb

Overview

This command deals with destroying a template from the admin panel.

Instance Method Summary collapse

Constructor Details

#initialize(template, current_user) ⇒ DestroyTemplate

Public: Initializes the command.

template - The Template to be destroyed. user - The user that destroys the template.


12
13
14
15
# File 'decidim-templates/app/commands/decidim/templates/admin/destroy_template.rb', line 12

def initialize(template, current_user)
  @template = template
  @current_user = current_user
end

Instance Method Details

#callObject

Public: Executes the command.

Broadcasts :ok if it got destroyed


20
21
22
23
# File 'decidim-templates/app/commands/decidim/templates/admin/destroy_template.rb', line 20

def call
  destroy_template
  broadcast(:ok)
end