added a select tag to email invitations
This commit is contained in:
parent
b4b338b3cd
commit
0074aadd48
3 changed files with 9 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
@aspects = current_user.aspects
|
@aspects = current_user.aspects
|
||||||
|
@aspects_dropdown_array = current_user.aspects.collect{|x| [x.to_s, x.id]}
|
||||||
@friends = current_user.friends
|
@friends = current_user.friends
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,11 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
class InvitationsController < Devise::InvitationsController
|
class InvitationsController < Devise::InvitationsController
|
||||||
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
begin
|
begin
|
||||||
|
params[:aspect_id] = params.delete(:aspects)
|
||||||
self.resource = current_user.invite_user(params[resource_name])
|
self.resource = current_user.invite_user(params[resource_name])
|
||||||
flash[:notice] = I18n.t 'invitations.create.sent'
|
flash[:notice] = I18n.t 'invitations.create.sent'
|
||||||
rescue RuntimeError => e
|
rescue RuntimeError => e
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@
|
||||||
%p
|
%p
|
||||||
= f.label :email
|
= f.label :email
|
||||||
= f.text_field :email
|
= f.text_field :email
|
||||||
= f.hidden_field :aspect_id, :value => @aspect.id
|
To
|
||||||
|
- if @aspect == :all
|
||||||
|
= f.select(:aspects, @aspects_dropdown_array)
|
||||||
|
- else
|
||||||
|
= f.select(:aspects, @aspects_dropdown_array, :selected => [@aspect.to_s, @aspect.id])
|
||||||
%p= f.submit "Send an invitation"
|
%p= f.submit "Send an invitation"
|
||||||
/= link_to "Home", after_sign_in_path_for(resource_name)
|
/= link_to "Home", after_sign_in_path_for(resource_name)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue