Skip to content
Browse files

reinvitation working

  • Loading branch information...
1 parent 69bf0af commit dcb745cf336be5b05bf36a42f384105a44c16476 @will-r will-r committed Jul 8, 2009
Showing with 21 additions and 41 deletions.
  1. +3 −3 app/controllers/users_controller.rb
  2. +18 −0 app/views/users/reinvite.html.haml
  3. +0 −38 app/views/users/reinvite.rhtml
View
6 app/controllers/users_controller.rb
@@ -18,12 +18,12 @@ def activate
end
def reinvite
+ get_item
if request.post?
@thing.update_attributes(params[:user])
@thing.save
UserNotifier.deliver_invitation(@thing, current_user)
- flash[:notice] = 'Invitation message was sent.'
- @thing = @thing
+ flash[:notice] = 'Invitation message was sent again.'
render :action => 'show'
end
end
@@ -45,7 +45,7 @@ def require_account_admin_or_self
end
def require_account_admin_or_password_given
- return true if current_user.account_admin?
+ return true if current_user.is_admin?
return true if @thing.valid_password?(params[:old_password])
# might as well get any other validation messages while we're at it
View
18 app/views/users/reinvite.html.haml
@@ -0,0 +1,18 @@
+- @title = "Reinvite #{@thing.name}"
+
+- content_for :admin do
+ = render :partial => 'shared/show_admin'
+
+.preamble
+ %p
+ Please check that the email address below is right and then hit the button to send out the invitation message again.
+
+.mainform
+ - form_for :thing, :url => reinvite_user_url(@thing) do |f|
+
+ = render :partial => 'shared/edit_email', :locals => {:f => f, :item => @thing, :required => true}
+
+ %p
+ = submit_tag "Send invitation"
+ or
+ = link_to 'cancel', url_for(@thing)
View
38 app/views/users/reinvite.rhtml
@@ -1,38 +0,0 @@
-<% content_for :buttons do %>
- <div class="formbuttons">
- <%= submit_tag "Send invitation" %> or
- <%= link_to 'cancel', url_for(@user) %>
- </div>
-<% end %>
-
-<% content_for :admin do %>
- <p>
- <%= render :partial => 'shared/show_admin', :locals => {:item => current_account} %>
- </p>
-<% end %>
-
-<div class="admin">
- <p>Please check that the email address below is right and then hit the button to send out the invitation message again.</p>
-</div>
-
-<div class="mainform contentblock">
-
-<% form_for :user,
- :url => reinvite_user_url(@user),
- :html => {
- :method => "post",
- :multipart => true,
- :id => 'userform'
- } do |f|
-%>
-
- <% @title = "Reinvite #{@user.name}" %>
-
- <%= render :partial => 'shared/edit_email', :locals => {:f => f, :item => @user} %>
-
- <%= yield :buttons %>
-
-<% end %>
-
-</div>
-

0 comments on commit dcb745c

Please sign in to comment.
Something went wrong with that request. Please try again.