show already invited users on invitation#new

This commit is contained in:
danielvincent 2010-12-10 18:05:08 -08:00
parent 0b57ccd47f
commit 2c5d5d9328
5 changed files with 52 additions and 30 deletions

View file

@ -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

View file

@ -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')

View file

@ -4,16 +4,18 @@
$("#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
.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')
@ -36,3 +38,10 @@
%p
= invite.submit t('.send_an_invitation')
.span-4.last
#already_invited_pane
%h4
Already invited
- for email in @emails_delivered
= email

View file

@ -1979,3 +1979,8 @@ h3,h4
&:hover
:background
:color #FEFFE3
#already_invited_pane
h4
:color #666
:color #666

View file

@ -27,10 +27,8 @@ describe InvitationsController do
true
end
end
end
describe "#create" do
before do
user.invites = 5
@ -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