Sha256: 0ec8116ce6d1e9ffd7c9da107eb13c1c0ff673e19996a79d2735542ad2ae490b

Contents?: true

Size: 566 Bytes

Versions: 13

Compression:

Stored size: 566 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

13 entries across 13 versions & 2 rubygems

Version Path
decidim-proposals-0.1.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.1.0 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.0.8.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.0.8.1 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.0.7 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.0.7 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.0.6 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.0.6 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.0.5 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.0.5 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.0.4 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.0.3 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-0.0.3 decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb