Sha256: b1ecbbd5e1c99f2823ec89c23635ac38605cf09f6b40a5aab647c1f72b22804c
Contents?: true
Size: 1.27 KB
Versions: 12
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true module Decidim module Assemblies module Admin # A command with all the business logic when updating assemblies # settings in admin area. class UpdateAssembliesSetting < Decidim::Command # Public: Initializes the command. # # assemblies_setting - A assemblies_setting object to update. # form - A form object with the params. def initialize(assemblies_settings, form) @assemblies_settings = assemblies_settings @form = form end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if the form or assemblies_settings isn't valid and we couldn't proceed. # # Returns nothing. def call return broadcast(:invalid) if form.invalid? || assemblies_settings.invalid? update_assemblies_setting! broadcast(:ok) end private attr_reader :form, :assemblies_settings def update_assemblies_setting! Decidim.traceability.update!( @assemblies_settings, form.current_user, enable_organization_chart: form.enable_organization_chart ) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems