Class: Decidim::Initiatives::Admin::InitiativeTypeForm

Inherits:
Form
  • Object
show all
Includes:
TranslatableAttributes
Defined in:
app/forms/decidim/initiatives/admin/initiative_type_form.rb

Overview

A form object used to collect the all the initiative type attributes.

Constant Summary collapse

DEFAULT_MINIMUM_COMMITTEE_MEMBERS =
2

Instance Method Summary collapse

Instance Method Details

#minimum_committee_membersObject



47
48
49
50
51
52
# File 'app/forms/decidim/initiatives/admin/initiative_type_form.rb', line 47

def minimum_committee_members
  return 0 unless promoting_committee_enabled?
  return DEFAULT_MINIMUM_COMMITTEE_MEMBERS if super.blank?

  super
end

#minimum_committee_members=(value) ⇒ Object



43
44
45
# File 'app/forms/decidim/initiatives/admin/initiative_type_form.rb', line 43

def minimum_committee_members=(value)
  super(value.presence)
end

#signature_type_optionsObject



54
55
56
57
58
59
60
61
62
63
# File 'app/forms/decidim/initiatives/admin/initiative_type_form.rb', line 54

def signature_type_options
  Initiative.signature_types.keys.map do |type|
    [
      I18n.t(
        type,
        scope: %w(activemodel attributes initiative signature_type_values)
      ), type
    ]
  end
end