forked from saturnflyer/radiant-dashboard-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard_extension.rb
36 lines (29 loc) · 1020 Bytes
/
dashboard_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
# Uncomment this if you reference any of your controllers in activate
# require_dependency 'application'
class DashboardExtension < Radiant::Extension
version "1.0"
description "Dashboard provides a way to view recent activity in Radiant."
url "http://saturnflyer.com/"
define_routes do |map|
map.connect 'admin/dashboard/:action', :controller => 'admin/dashboard'
end
def activate
admin.tabs.add "Dashboard", "/admin/dashboard", :before => "Pages", :visibility => [:all]
Radiant::AdminUI.class_eval do
attr_accessor :dashboard
end
admin.dashboard = load_default_dashboard_regions
end
def deactivate
# admin.tabs.remove "Dashboard"
end
private
def load_default_dashboard_regions
returning OpenStruct.new do |dashboard|
dashboard.index = Radiant::AdminUI::RegionSet.new do |index|
index.main.concat %w{header draft_pages reviewed_pages updated_pages updated_snippets}
index.extensions.concat %w{}
end
end
end
end