Sha256: 0a49978149ead69c7f4e1a19af33eb40eec88ab37b1deb25f7760e1befdce371

Contents?: true

Size: 578 Bytes

Versions: 74

Compression:

Stored size: 578 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 evaluating) }
        validates :answer, translatable_presence: true, if: ->(form) { form.state == "rejected" }
      end
    end
  end
end

Version data entries

74 entries across 74 versions & 2 rubygems

Version Path
decidim-proposals-0.13.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.12.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.13.0.pre1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.12.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.11.2 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.12.0.pre app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.11.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.11.0.pre1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.10.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.10.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.9.3 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.9.2 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.9.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.9.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.8.4 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.8.3 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.8.2 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.8.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.8.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.7.4 app/forms/decidim/proposals/admin/proposal_answer_form.rb