Class: Decidim::Assemblies::Admin::AssemblyMemberForm

Inherits:
Form
  • Object
show all
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.

Instance Method Summary collapse

Instance Method Details

#map_model(model) ⇒ Object


31
32
33
34
# File 'decidim-assemblies/app/forms/decidim/assemblies/admin/assembly_member_form.rb', line 31

def map_model(model)
  self.user_id = model.decidim_user_id
  self.existing_user = user_id.present?
end

#positions_for_selectObject


40
41
42
43
44
45
46
47
# File 'decidim-assemblies/app/forms/decidim/assemblies/admin/assembly_member_form.rb', line 40

def positions_for_select
  Decidim::AssemblyMember::POSITIONS.map do |position|
    [
      I18n.t(position, scope: "decidim.admin.models.assembly_member.positions"),
      position
    ]
  end
end

#userObject


36
37
38
# File 'decidim-assemblies/app/forms/decidim/assemblies/admin/assembly_member_form.rb', line 36

def user
  @user ||= current_organization.user_entities.find_by(id: user_id)
end