2010-05-10 22:39:52 +00:00
|
|
|
module Admin
|
|
|
|
class MembershipsController < BaseController
|
|
|
|
|
|
|
|
sections 'settings'
|
|
|
|
|
|
|
|
def create
|
|
|
|
@membership = current_site.memberships.build(params[:membership])
|
|
|
|
|
2010-07-13 00:46:17 +00:00
|
|
|
case @membership.process!
|
2010-05-10 22:39:52 +00:00
|
|
|
when :create_account
|
|
|
|
redirect_to new_admin_account_url(:email => @membership.email)
|
|
|
|
when :save_it
|
2010-07-13 00:46:17 +00:00
|
|
|
respond_with @membership, :location => edit_admin_current_site_url
|
2010-05-10 22:39:52 +00:00
|
|
|
when :error
|
2010-07-13 00:46:17 +00:00
|
|
|
respond_with @membership, :flash => true
|
2010-05-10 22:39:52 +00:00
|
|
|
when :nothing
|
2010-07-13 00:46:17 +00:00
|
|
|
respond_with @membership, :alert => t('flash.admin.memberships.create.already_created'), :location => edit_admin_current_site_url
|
2010-05-10 22:39:52 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2010-07-13 00:46:17 +00:00
|
|
|
destroy! { edit_admin_current_site_url }
|
2010-05-10 22:39:52 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|