Sha256: d5222c69ecf62e75045be1f493eba6d3419538e143a32abad7d1ddd191b8ee8a

Contents?: true

Size: 438 Bytes

Versions: 6

Compression:

Stored size: 438 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Plans
    class AttachmentForm < Decidim::Form
      attribute :title, String
      attribute :file
      attribute :weight, Integer
      attribute :deleted, Boolean, default: false

      mimic :attachment

      validates :title, presence: true, if: ->(form) { form.file.present? || form.id.present? }

      def to_param
        id || "attachment-id"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-plans-0.16.3 app/forms/decidim/plans/attachment_form.rb
decidim-plans-0.16.2 app/forms/decidim/plans/attachment_form.rb
decidim-plans-0.16.1 app/forms/decidim/plans/attachment_form.rb
decidim-plans-0.16.0 app/forms/decidim/plans/attachment_form.rb
decidim-plans-0.15.1 app/forms/decidim/plans/attachment_form.rb
decidim-plans-0.15.0 app/forms/decidim/plans/attachment_form.rb