Class: Decidim::InviteUserForm

Inherits:
Form show all
Defined in:
app/forms/decidim/invite_user_form.rb

Overview

A form object used to invite users to an organization.

Constant Summary

Constants included from AttributeObject::TypeMap

AttributeObject::TypeMap::Boolean, AttributeObject::TypeMap::Decimal

Instance Attribute Summary

Attributes inherited from AttributeObject::Form

#context

Instance Method Summary collapse

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

#available_roles_for_selectObject



34
35
36
37
38
39
40
41
# File 'app/forms/decidim/invite_user_form.rb', line 34

def available_roles_for_select
  Decidim::User::Roles.all.map do |role|
    [
      I18n.t("models.user.fields.roles.#{role}", scope: "decidim.admin"),
      role
    ]
  end
end

#emailObject



22
23
24
# File 'app/forms/decidim/invite_user_form.rb', line 22

def email
  super&.downcase
end

#invited_byObject



30
31
32
# File 'app/forms/decidim/invite_user_form.rb', line 30

def invited_by
  super || current_user
end

#organizationObject



26
27
28
# File 'app/forms/decidim/invite_user_form.rb', line 26

def organization
  super || current_organization
end