Create restful invites controller and ajaxified the workflow.
This commit is contained in:
parent
5cf75ee32a
commit
178fba7b30
11 changed files with 89 additions and 52 deletions
26
app/controllers/invites_controller.rb
Normal file
26
app/controllers/invites_controller.rb
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
class InvitesController < ApplicationController
|
||||
|
||||
before_filter :authenticate_membership_or_admin, :only => [:new]
|
||||
#TODO: auhtorize also for create action.
|
||||
|
||||
def new
|
||||
@invite = Invite.new(:user => @current_user, :group => @group)
|
||||
|
||||
render :update do |page|
|
||||
page.replace_html :edit_box, :partial => "new"
|
||||
page.show :edit_box
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@invite = Invite.new(params[:invite])
|
||||
|
||||
render :update do |page|
|
||||
if @invite.save
|
||||
page.replace_html :edit_box, :partial => "success"
|
||||
else
|
||||
page.replace_html :edit_box, :partial => "new"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue