diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 65b57b252..31d2c9d9c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 92da135d8..0477d9de8 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -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 diff --git a/app/views/invitations/_new.haml b/app/views/invitations/_new.haml index f53882567..0463bb8f4 100644 --- a/app/views/invitations/_new.haml +++ b/app/views/invitations/_new.haml @@ -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)