added a select tag to email invitations

This commit is contained in:
ilya 2010-10-15 14:21:08 -07:00
parent b4b338b3cd
commit 0074aadd48
3 changed files with 9 additions and 1 deletions

View file

@ -30,6 +30,7 @@ class ApplicationController < ActionController::Base
end
@aspects = current_user.aspects
@aspects_dropdown_array = current_user.aspects.collect{|x| [x.to_s, x.id]}
@friends = current_user.friends
end
end

View file

@ -3,8 +3,11 @@
# the COPYRIGHT file.
class InvitationsController < Devise::InvitationsController
def create
begin
params[:aspect_id] = params.delete(:aspects)
self.resource = current_user.invite_user(params[resource_name])
flash[:notice] = I18n.t 'invitations.create.sent'
rescue RuntimeError => e

View file

@ -4,6 +4,10 @@
%p
= f.label :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"
/= link_to "Home", after_sign_in_path_for(resource_name)