Class: Decidim::Initiatives::Admin::InitiativeTypeForm
- Inherits:
-
Form
- Object
- AttributeObject::Form
- Form
- Decidim::Initiatives::Admin::InitiativeTypeForm
- 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
Constants included from AttributeObject::TypeMap
AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal
Instance Attribute Summary
Attributes inherited from AttributeObject::Form
Instance Method Summary collapse
- #minimum_committee_members ⇒ Object
- #minimum_committee_members=(value) ⇒ Object
- #signature_type_options ⇒ Object
Methods included from TranslatableAttributes
Methods inherited from AttributeObject::Form
ensure_hash, from_model, from_params, hash_from, infer_model_name, #map_model, mimic, mimicked_model_name, model_name, #persisted?, #to_key, #to_model, #to_param, #valid?, #with_context
Methods included from AttributeObject::Model
#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h
Instance Method Details
#minimum_committee_members ⇒ Object
47 48 49 50 51 52 |
# File 'decidim-initiatives/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 'decidim-initiatives/app/forms/decidim/initiatives/admin/initiative_type_form.rb', line 43 def minimum_committee_members=(value) super(value.presence) end |
#signature_type_options ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'decidim-initiatives/app/forms/decidim/initiatives/admin/initiative_type_form.rb', line 54 def Initiative.signature_types.keys.map do |type| [ I18n.t( type, scope: %w(activemodel attributes initiative signature_type_values) ), type ] end end |