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

Inherits:
Form
  • Object
show all
Includes:
TranslatableAttributes
Defined in:
decidim-initiatives/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

Methods included from TranslatableAttributes

#default_locale?

Instance Method Details

#minimum_committee_membersObject


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

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


38
39
40
# File 'decidim-initiatives/app/forms/decidim/initiatives/admin/initiative_type_form.rb', line 38

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

#signature_type_optionsObject


49
50
51
52
53
54
55
56
57
58
# File 'decidim-initiatives/app/forms/decidim/initiatives/admin/initiative_type_form.rb', line 49

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