Sha256: 24950ba41d9de69342e5cba4c7d0c6566d9324ca0522b25ee05d039e7a928d89

Contents?: true

Size: 871 Bytes

Versions: 60

Compression:

Stored size: 871 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    module Admin
      # A form object used to copy a conferences from the admin
      # dashboard.
      #
      class ConferenceCopyForm < Form
        include TranslatableAttributes

        translatable_attribute :title, String

        mimic :conference

        attribute :slug, String
        attribute :copy_categories, Boolean
        attribute :copy_components, Boolean

        validates :slug, presence: true, format: { with: Decidim::Conference.slug_format }
        validates :title, translatable_presence: true
        validate :slug_uniqueness

        private

        def slug_uniqueness
          return unless OrganizationConferences.new(current_organization).query.where(slug: slug).where.not(id: id).any?

          errors.add(:slug, :taken)
        end
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
decidim-conferences-0.27.9 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.27.8 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.27.7 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.27.6 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.26.10 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.26.9 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.27.5 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.26.8 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.27.4 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.27.3 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.26.7 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.26.5 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.27.2 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.27.1 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.26.4 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.27.0 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.26.3 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.27.0.rc2 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.27.0.rc1 app/forms/decidim/conferences/admin/conference_copy_form.rb
decidim-conferences-0.26.2 app/forms/decidim/conferences/admin/conference_copy_form.rb