Class: Decidim::Admin::UpdateNewsletter
- Inherits:
-
Command
- Object
- Command
- Decidim::Admin::UpdateNewsletter
- Defined in:
- app/commands/decidim/admin/update_newsletter.rb
Overview
Updates the newsletter given form data.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(newsletter, form) ⇒ UpdateNewsletter
constructor
Initializes the command.
Constructor Details
#initialize(newsletter, form) ⇒ UpdateNewsletter
Initializes the command.
newsletter - The Newsletter to update. form - The form object containing the data to update.
12 13 14 15 16 17 |
# File 'app/commands/decidim/admin/update_newsletter.rb', line 12 def initialize(, form) @newsletter = @content_block = .template @form = form @organization = form.current_organization end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/commands/decidim/admin/update_newsletter.rb', line 19 def call return broadcast(:invalid) unless form.valid? return broadcast(:invalid) if .sent? return broadcast(:invalid) unless organization == .organization transaction do update_content_block end broadcast(:ok, ) end |