Sha256: b4a3dab6e8e36c22cb98ae36f41d5d35ce049beaa0a6e023dad33b9a2dfd683c
Contents?: true
Size: 886 Bytes
Versions: 14
Compression:
Stored size: 886 Bytes
Contents
# frozen_string_literal: true module Decidim module Elections module Admin # This class holds a Form to create/update questions from Decidim's admin panel. class QuestionForm < Decidim::Form include TranslatableAttributes translatable_attribute :title, String translatable_attribute :description, String attribute :max_selections, Integer, default: 1 attribute :weight, Integer, default: 0 attribute :random_answers_order, Boolean, default: true attribute :min_selections, Integer, default: 1 validates :title, translatable_presence: true validates :description, translatable_presence: true validates :max_selections, presence: true, numericality: { greater_than_or_equal_to: 0 } def election @election ||= context[:election] end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems