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