-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathsettings_extension.rb
35 lines (28 loc) · 1.04 KB
/
settings_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
# Uncomment this if you reference any of your controllers in activate
# require_dependency 'application_controller'
class SettingsExtension < Radiant::Extension
version "#{File.read(File.expand_path(File.dirname(__FILE__)) + '/VERSION')}"
description "Web based administration for Radiant default configuration settings."
url "https://github.com/saturnflyer/radiant-settings"
def activate
Radiant::Config.extend ConfigFindAllAsTree
Radiant::Config.class_eval { include ConfigProtection }
tab 'Settings' do
add_item 'Application', '/admin/settings', :after => 'Extensions'
end
Page.class_eval { include SettingsTags }
Radiant::AdminUI.class_eval do
attr_accessor :settings
end
admin.settings = load_default_settings_regions
end
def load_default_settings_regions
OpenStruct.new.tap do |settings|
settings.index = Radiant::AdminUI::RegionSet.new do |index|
index.top.concat %w{}
index.main.concat %w{list}
index.bottom.concat %w{new_button}
end
end
end
end