Class: InvitationForms::CreateBulk
- Inherits:
-
ApplicationForm
- Object
- ApplicationForm
- InvitationForms::CreateBulk
- Defined in:
- app/forms/simple_teams/invitation_forms/create_bulk.rb
Instance Attribute Summary collapse
-
#accessible_emails ⇒ Object
Returns the value of attribute accessible_emails.
-
#current_user ⇒ Object
Returns the value of attribute current_user.
-
#emails ⇒ Object
Returns the value of attribute emails.
-
#role ⇒ Object
Returns the value of attribute role.
-
#select2_emails ⇒ Object
Returns the value of attribute select2_emails.
-
#single_vs_multiple ⇒ Object
Returns the value of attribute single_vs_multiple.
-
#team ⇒ Object
Returns the value of attribute team.
Instance Method Summary collapse
-
#available_roles ⇒ Object
Attributes.
-
#initialize(team, current_user) ⇒ CreateBulk
constructor
A new instance of CreateBulk.
- #perform(params) ⇒ Object
Constructor Details
#initialize(team, current_user) ⇒ CreateBulk
Returns a new instance of CreateBulk.
6 7 8 9 10 |
# File 'app/forms/simple_teams/invitation_forms/create_bulk.rb', line 6 def initialize(team, current_user) @team = team @current_user = current_user @emails = [] end |
Instance Attribute Details
#accessible_emails ⇒ Object
Returns the value of attribute accessible_emails.
4 5 6 |
# File 'app/forms/simple_teams/invitation_forms/create_bulk.rb', line 4 def accessible_emails @accessible_emails end |
#current_user ⇒ Object
Returns the value of attribute current_user.
4 5 6 |
# File 'app/forms/simple_teams/invitation_forms/create_bulk.rb', line 4 def current_user @current_user end |
#emails ⇒ Object
Returns the value of attribute emails.
4 5 6 |
# File 'app/forms/simple_teams/invitation_forms/create_bulk.rb', line 4 def emails @emails end |
#role ⇒ Object
Returns the value of attribute role.
4 5 6 |
# File 'app/forms/simple_teams/invitation_forms/create_bulk.rb', line 4 def role @role end |
#select2_emails ⇒ Object
Returns the value of attribute select2_emails.
4 5 6 |
# File 'app/forms/simple_teams/invitation_forms/create_bulk.rb', line 4 def select2_emails @select2_emails end |
#single_vs_multiple ⇒ Object
Returns the value of attribute single_vs_multiple.
4 5 6 |
# File 'app/forms/simple_teams/invitation_forms/create_bulk.rb', line 4 def single_vs_multiple @single_vs_multiple end |
#team ⇒ Object
Returns the value of attribute team.
4 5 6 |
# File 'app/forms/simple_teams/invitation_forms/create_bulk.rb', line 4 def team @team end |
Instance Method Details
#available_roles ⇒ Object
Attributes
29 30 31 |
# File 'app/forms/simple_teams/invitation_forms/create_bulk.rb', line 29 def available_roles SimpleTeams::Membership.roles end |
#perform(params) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/forms/simple_teams/invitation_forms/create_bulk.rb', line 12 def perform(params) self.assign_attributes(params) if accessible? self.emails = accessible_emails.split(",").map(&:strip).uniq.reject(&:empty?) else self.emails = select2_emails.map(&:strip).uniq.reject(&:empty?) end if valid? create_invitations generate_notification else false end end |