Sha256: ade49b271f660fd7c325f6167679e4e389b982f25e451f56fb489f6050bc06fa

Contents?: true

Size: 634 Bytes

Versions: 46

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # This command gets called when a content block is updated from the admin
    # panel.
    class UpdateHelpSections < Rectify::Command
      def initialize(form, organization)
        @form = form
        @organization = organization
      end

      def call
        return broadcast(:invalid) unless @form.valid?

        ActiveRecord::Base.transaction do
          @form.sections.each do |section|
            ContextualHelpSection.set_content(@organization, section.id, section.content)
          end
        end

        broadcast(:ok)
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-admin-0.17.2 app/commands/decidim/admin/update_help_sections.rb
decidim-admin-0.18.0 app/commands/decidim/admin/update_help_sections.rb
decidim-admin-0.17.1 app/commands/decidim/admin/update_help_sections.rb
decidim-admin-0.16.1 app/commands/decidim/admin/update_help_sections.rb
decidim-admin-0.17.0 app/commands/decidim/admin/update_help_sections.rb
decidim-admin-0.16.0 app/commands/decidim/admin/update_help_sections.rb