2010-05-10 22:39:52 +00:00
|
|
|
module Admin
|
|
|
|
class MembershipsController < BaseController
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-10 22:39:52 +00:00
|
|
|
sections 'settings'
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-10 22:39:52 +00:00
|
|
|
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
|
2011-07-05 16:30:12 +00:00
|
|
|
when :already_created
|
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
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-10 22:39:52 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
end
|