Sha256: 006cccd35fcc4a21f03fcad312dc0cb24f01a5c1eb48dbc53401c5ddc2be1d45

Contents?: true

Size: 774 Bytes

Versions: 26

Compression:

Stored size: 774 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
        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 :max_selections, presence: true, numericality: { greater_than_or_equal_to: 1 }

        def election
          @election ||= context[:election]
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
decidim-elections-0.28.4 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.27.9 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.28.3 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.27.8 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.28.2 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.27.7 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.28.1 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.27.6 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.26.10 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.26.9 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.28.0 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.27.5 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.28.0.rc5 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.28.0.rc4 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.26.8 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.27.4 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.27.3 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.26.7 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.26.5 app/forms/decidim/elections/admin/question_form.rb
decidim-elections-0.27.2 app/forms/decidim/elections/admin/question_form.rb