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.20.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.20.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.19.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.18.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.19.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.17.2 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.18.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.17.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.16.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.17.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.16.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.15.2 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.15.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.15.0 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.14.4 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.14.3 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.14.2 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.14.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.13.1 app/forms/decidim/proposals/admin/proposal_answer_form.rb
decidim-proposals-0.12.2 app/forms/decidim/proposals/admin/proposal_answer_form.rb