2011-10-30 23:02:41 +00:00
|
|
|
module Locomotive
|
2010-05-10 22:39:52 +00:00
|
|
|
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
|
2011-07-19 12:52:02 +00:00
|
|
|
resource.role = 'author' # force author by default
|
2010-05-10 22:39:52 +00:00
|
|
|
|
2011-07-19 12:52:02 +00:00
|
|
|
case resource.process!
|
2010-05-10 22:39:52 +00:00
|
|
|
when :create_account
|
2011-10-31 23:44:23 +00:00
|
|
|
redirect_to new_account_url(:email => resource.email)
|
2010-05-10 22:39:52 +00:00
|
|
|
when :save_it
|
2011-10-31 23:44:23 +00:00
|
|
|
respond_with resource, :location => edit_current_site_url
|
2010-05-10 22:39:52 +00:00
|
|
|
when :error
|
2011-07-19 12:52:02 +00:00
|
|
|
respond_with resource, :flash => true
|
2011-07-05 16:30:12 +00:00
|
|
|
when :already_created
|
2011-10-31 23:44:23 +00:00
|
|
|
respond_with resource, :alert => t('flash.locomotive.memberships.create.already_created'), :location => edit_current_site_url
|
2010-05-10 22:39:52 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2011-10-31 23:44:23 +00:00
|
|
|
destroy! { edit_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
|