Class: Decidim::Assemblies::Admin::AssemblyMemberForm
- Inherits:
-
Form
- Object
- Decidim::AttributeObject::Form
- Form
- Decidim::Assemblies::Admin::AssemblyMemberForm
- Defined in:
- decidim-assemblies/app/forms/decidim/assemblies/admin/assembly_member_form.rb
Overview
A form object used to create assembly members from the admin dashboard.
Constant Summary
Constants included from Decidim::AttributeObject::TypeMap
Decidim::AttributeObject::TypeMap::Boolean, Decidim::AttributeObject::TypeMap::Decimal
Instance Attribute Summary
Attributes inherited from Decidim::AttributeObject::Form
Instance Method Summary collapse
Methods inherited from Decidim::AttributeObject::Form
ensure_hash, from_model, from_params, hash_from, infer_model_name, mimic, mimicked_model_name, model_name, #persisted?, #to_key, #to_model, #to_param, #valid?, #with_context
Methods included from Decidim::AttributeObject::Model
#[], #[]=, #attributes, #attributes_with_values, #initialize, #to_h
Instance Method Details
#map_model(model) ⇒ Object
44 45 46 47 |
# File 'decidim-assemblies/app/forms/decidim/assemblies/admin/assembly_member_form.rb', line 44 def map_model(model) self.user_id = model.decidim_user_id self.existing_user = user_id.present? end |
#positions_for_select ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'decidim-assemblies/app/forms/decidim/assemblies/admin/assembly_member_form.rb', line 53 def positions_for_select Decidim::AssemblyMember::POSITIONS.map do |position| [ I18n.t(position, scope: "decidim.admin.models.assembly_member.positions"), position ] end end |
#user ⇒ Object
49 50 51 |
# File 'decidim-assemblies/app/forms/decidim/assemblies/admin/assembly_member_form.rb', line 49 def user @user ||= current_organization.user_entities.find_by(id: user_id) end |