Sha256: 182a5bb6bd238eeda796a2a5a49daddd782246086c53cb96ac1a53d0b31d86de

Contents?: true

Size: 567 Bytes

Versions: 10

Compression:

Stored size: 567 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    module Admin
      # A form object to be used when admin users want to answer a proposal.
      class ProposalAnswerForm < Decidim::Form
        include TranslatableAttributes
        mimic :proposal_answer

        translatable_attribute :answer, String
        attribute :state, String

        validates :state, presence: true, inclusion: { in: %w(accepted rejected) }
        validates :answer, translatable_presence: true, if: ->(form) { form.state == "rejected" }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
decidim-proposals-0.4.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.4.0 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.3.2 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.3.2 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.3.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.3.1 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.3.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.3.0 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.2.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.2.0 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb