Sha256: e5d0b3a50cb33e0f817c0c1eb42b6b864e4b44443c280b4c962e51ac01fb8168

Contents?: true

Size: 503 Bytes

Versions: 59

Compression:

Stored size: 503 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # A form object used to create attachments.
  #
  class AttachmentForm < Form
    include Decidim::HasUploadValidations

    attribute :title, String
    attribute :file
    attribute :delete_file, Boolean

    mimic :attachment

    validates :title, presence: true, if: ->(form) { form.file.present? }
    validates :file, passthru: { to: Decidim::Attachment }, if: ->(form) { form.file.present? }

    alias organization current_organization
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
decidim-core-0.30.0.rc3 app/forms/decidim/attachment_form.rb
decidim-core-0.30.0.rc2 app/forms/decidim/attachment_form.rb
decidim-core-0.30.0.rc1 app/forms/decidim/attachment_form.rb
decidim-core-0.29.2 app/forms/decidim/attachment_form.rb
decidim-core-0.28.5 app/forms/decidim/attachment_form.rb
decidim-core-0.29.1 app/forms/decidim/attachment_form.rb
decidim-core-0.28.4 app/forms/decidim/attachment_form.rb
decidim-core-0.27.9 app/forms/decidim/attachment_form.rb
decidim-core-0.29.0 app/forms/decidim/attachment_form.rb
decidim-core-0.28.3 app/forms/decidim/attachment_form.rb
decidim-core-0.27.8 app/forms/decidim/attachment_form.rb
decidim-core-0.29.0.rc4 app/forms/decidim/attachment_form.rb
decidim-core-0.29.0.rc3 app/forms/decidim/attachment_form.rb
decidim-core-0.29.0.rc2 app/forms/decidim/attachment_form.rb
decidim-core-0.29.0.rc1 app/forms/decidim/attachment_form.rb
decidim-core-0.28.2 app/forms/decidim/attachment_form.rb
decidim-core-0.27.7 app/forms/decidim/attachment_form.rb
decidim-core-0.28.1 app/forms/decidim/attachment_form.rb
decidim-core-0.27.6 app/forms/decidim/attachment_form.rb
decidim-core-0.26.10 app/forms/decidim/attachment_form.rb