Class: InvitationForms::CreateCombo

Inherits:
ApplicationForm
  • Object
show all
Defined in:
app/forms/simple_teams/invitation_forms/create_combo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(team, current_user) ⇒ CreateCombo

Returns a new instance of CreateCombo.



6
7
8
9
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 6

def initialize(team, current_user)
  @team = team
  @current_user = current_user
end

Instance Attribute Details

#accessible_emailsObject

Returns the value of attribute accessible_emails.



4
5
6
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 4

def accessible_emails
  @accessible_emails
end

#current_userObject

Returns the value of attribute current_user.



4
5
6
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 4

def current_user
  @current_user
end

#emailObject

Returns the value of attribute email.



4
5
6
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 4

def email
  @email
end

#emailsObject

Returns the value of attribute emails.



4
5
6
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 4

def emails
  @emails
end

#form_instanceObject

Returns the value of attribute form_instance.



4
5
6
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 4

def form_instance
  @form_instance
end

#roleObject

Returns the value of attribute role.



4
5
6
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 4

def role
  @role
end

#select2_emailsObject

Returns the value of attribute select2_emails.



4
5
6
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 4

def select2_emails
  @select2_emails
end

#single_vs_multipleObject

Returns the value of attribute single_vs_multiple.



4
5
6
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 4

def single_vs_multiple
  @single_vs_multiple
end

#teamObject

Returns the value of attribute team.



4
5
6
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 4

def team
  @team
end

Instance Method Details

#available_rolesObject



30
31
32
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 30

def available_roles
  SimpleTeams::Membership.roles
end

#perform(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/forms/simple_teams/invitation_forms/create_combo.rb', line 11

def perform(params)
  # Store input
  self.assign_attributes(params)

  # Set form instance from input
  @form_instance = selected_form_klass.new(team, current_user)

  # Perform 
  if form_instance.perform(filter_params(params))
    return true
  else
    reassign_errors
    unless single?
      self.emails = form_instance.emails
    end
    false
  end
end