Sha256: 1d5bda18c3af9b34f66a20700d2cef32efdf3de563dee5999897129885bc1e15

Contents?: true

Size: 1.21 KB

Versions: 6

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    module Admin
      # A command with all the business logic when creating a new conference
      # speaker in the system.
      class CreateConferenceSpeaker < Decidim::Commands::CreateResource
        fetch_file_attributes :avatar

        fetch_form_attributes :full_name, :twitter_handle, :personal_url, :position, :affiliation, :short_bio,
                              :user

        protected

        def resource_class = Decidim::ConferenceSpeaker

        def extra_params
          {
            resource: {
              title: form.full_name
            },
            participatory_space: {
              title: form.participatory_space.title
            }
          }
        end

        def attributes
          super.merge(conference: form.participatory_space)
        end

        def conference_meetings
          meeting_components = resource.conference.components.where(manifest_name: "meetings")
          Decidim::ConferenceMeeting.where(component: meeting_components).where(id: form.conference_meeting_ids)
        end

        def run_after_hooks
          resource.conference_meetings = conference_meetings
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-conferences-0.29.1 app/commands/decidim/conferences/admin/create_conference_speaker.rb
decidim-conferences-0.29.0 app/commands/decidim/conferences/admin/create_conference_speaker.rb
decidim-conferences-0.29.0.rc4 app/commands/decidim/conferences/admin/create_conference_speaker.rb
decidim-conferences-0.29.0.rc3 app/commands/decidim/conferences/admin/create_conference_speaker.rb
decidim-conferences-0.29.0.rc2 app/commands/decidim/conferences/admin/create_conference_speaker.rb
decidim-conferences-0.29.0.rc1 app/commands/decidim/conferences/admin/create_conference_speaker.rb