show already invited users on invitation#new
This commit is contained in:
parent
0b57ccd47f
commit
2c5d5d9328
5 changed files with 52 additions and 30 deletions
|
|
@ -6,6 +6,10 @@ class InvitationsController < Devise::InvitationsController
|
|||
|
||||
before_filter :check_token, :only => [:edit]
|
||||
|
||||
def new
|
||||
sent_invitations = current_user.invitations_from_me.fields(:to_id).all
|
||||
@emails_delivered = sent_invitations.map!{ |i| i.to.email }
|
||||
end
|
||||
|
||||
def create
|
||||
if current_user.invites == 0
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
class UsersController < ApplicationController
|
||||
require File.join(Rails.root, 'lib/diaspora/ostatus_builder')
|
||||
require File.join(Rails.root, 'lib/diaspora/exporter')
|
||||
|
|
|
|||
|
|
@ -4,35 +4,44 @@
|
|||
$("#user_email").focus();
|
||||
});
|
||||
|
||||
.span-3.append-1.prepend-3
|
||||
.span-3.append-1
|
||||
= image_tag 'icons/monotone_email_letter_round.png', :height => "128px", :width => "128px"
|
||||
|
||||
.span-15.last
|
||||
%h2
|
||||
= t('.invite_someone_to_join')
|
||||
.description
|
||||
= t('.if_they_accept_info')
|
||||
.span-20.last
|
||||
.span-20.last
|
||||
%h2
|
||||
= t('.invite_someone_to_join')
|
||||
.description
|
||||
= t('.if_they_accept_info')
|
||||
%br
|
||||
|
||||
.span-15.append-1
|
||||
= form_for User.new, :url => invitation_path(User) do |invite|
|
||||
%h4
|
||||
= t('email')
|
||||
= invite.text_field :email, :title => t('.comma_seperated_plz')
|
||||
%br
|
||||
|
||||
= form_for User.new, :url => invitation_path(User) do |invite|
|
||||
%h4
|
||||
= t('email')
|
||||
= invite.text_field :email, :title => t('.comma_seperated_plz')
|
||||
%br
|
||||
%h4
|
||||
= t('.aspect')
|
||||
- unless @aspect.is_a? Aspect
|
||||
= invite.select(:aspects, @aspects_dropdown_array)
|
||||
- else
|
||||
= invite.select(:aspects, @aspects_dropdown_array, :selected => @aspect.id)
|
||||
%br
|
||||
%br
|
||||
|
||||
%h4
|
||||
= t('.aspect')
|
||||
- unless @aspect.is_a? Aspect
|
||||
= invite.select(:aspects, @aspects_dropdown_array)
|
||||
- else
|
||||
= invite.select(:aspects, @aspects_dropdown_array, :selected => @aspect.id)
|
||||
%br
|
||||
%br
|
||||
%h4
|
||||
= t('.personal_message')
|
||||
= invite.text_area :invite_messages, :rows => 3, :value => ""
|
||||
|
||||
%h4
|
||||
= t('.personal_message')
|
||||
= invite.text_area :invite_messages, :rows => 3, :value => ""
|
||||
%p
|
||||
= invite.submit t('.send_an_invitation')
|
||||
|
||||
%p
|
||||
= invite.submit t('.send_an_invitation')
|
||||
.span-4.last
|
||||
#already_invited_pane
|
||||
%h4
|
||||
Already invited
|
||||
- for email in @emails_delivered
|
||||
= email
|
||||
|
||||
|
|
|
|||
|
|
@ -1979,3 +1979,8 @@ h3,h4
|
|||
&:hover
|
||||
:background
|
||||
:color #FEFFE3
|
||||
|
||||
#already_invited_pane
|
||||
h4
|
||||
:color #666
|
||||
:color #666
|
||||
|
|
|
|||
|
|
@ -27,10 +27,8 @@ describe InvitationsController do
|
|||
true
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
describe "#create" do
|
||||
before do
|
||||
user.invites = 5
|
||||
|
|
@ -42,10 +40,10 @@ describe InvitationsController do
|
|||
end
|
||||
|
||||
it 'should call the resque job Jobs::InviteUser' do
|
||||
Resque.should_receive(:enqueue)
|
||||
post :create, :user => @invite
|
||||
Resque.should_receive(:enqueue)
|
||||
post :create, :user => @invite
|
||||
end
|
||||
|
||||
|
||||
it 'can handle a comma seperated list of emails' do
|
||||
Resque.should_receive(:enqueue).twice()
|
||||
post :create, :user => @invite.merge(:email => "foofoofoofoo@example.com, mbs@gmail.com")
|
||||
|
|
@ -114,5 +112,12 @@ describe InvitationsController do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#new' do
|
||||
it 'renders' do
|
||||
sign_in :user, user
|
||||
get :new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue