Sha256: 4ef9922dbd39b82a154aa3ccdf680ed041ab19750d4b3ae9de5359eae7977a3b

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    module Admin
      # A form object to be used when admin users want to create a proposal.
      class ProposalForm < Decidim::Proposals::Admin::ProposalBaseForm
        translatable_attribute :title, String do |field, _locale|
          validates field, length: { in: 15..150 }, if: proc { |resource| resource.send(field).present? }
        end
        translatable_attribute :body, String

        validates :title, :body, translatable_presence: true

        validate :notify_missing_attachment_if_errored
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-proposals-0.23.1 app/forms/decidim/proposals/admin/proposal_form.rb
decidim-proposals-0.23.1.rc1 app/forms/decidim/proposals/admin/proposal_form.rb
decidim-proposals-0.23.0 app/forms/decidim/proposals/admin/proposal_form.rb