-
Notifications
You must be signed in to change notification settings - Fork 7
/
member_extension.rb
46 lines (42 loc) · 1.41 KB
/
member_extension.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Uncomment this if you reference any of your controllers in activate
require_dependency 'application_controller'
class MemberExtension < Radiant::Extension
version "0.5"
description "Restrict site content to registered members."
url "http://blog.aissac.ro/radiant/member-extension"
define_routes do |map|
map.resources :members,
:path_prefix => '/admin',
:controller => 'admin/members',
:collection => {
:auto_complete_for_member_company => :any,
:import => :get,
:import_from_csv => :post,
:edit_invalid => :get,
:update_invalid => :post },
:member => {
:reset_password => :get,
:send_email => :post,
:activate => :post,
:deactivate => :post
}
map.resources :member_sessions, :as => MemberExtensionSettings.sessions_path
map.member_logout MemberExtensionSettings.logout_path, :controller => 'member_sessions', :action => 'destroy'
end
def activate
if RAILS_ENV == 'production'
MemberExtensionSettings.check!
end
admin.nav["settings"] << admin.nav_item(:members, "Members", "/admin/members")
ApplicationController.send(:include, ApplicationControllerMemberExtensions)
SiteController.class_eval do
include AuthenticatedMembersSystem
include SiteControllerMemberExtensions
end
Page.class_eval {
include MemberTags
}
end
def deactivate
end
end