forked from radiant/radiant-multi-site-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multi_site_extension.rb
42 lines (37 loc) · 1.44 KB
/
multi_site_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
require_dependency 'application_controller'
class MultiSiteExtension < Radiant::Extension
version "0.9.0"
description %{ Enables virtual sites to be created with associated domain names.
Also scopes the sitemap view to any given page (or the root of an
individual site). }
url "http://radiantcms.org/"
def activate
require 'multi_site/route_extensions'
require 'multi_site/route_set_extensions'
Page.send :include, MultiSite::PageExtensions
SiteController.send :include, MultiSite::SiteControllerExtensions
Admin::PagesController.send :include, MultiSite::PagesControllerExtensions
admin.pages.index.add :bottom, "site_subnav"
tab 'Settings' do |tab|
tab.add_item 'Sites', '/admin/sites'
end
load_default_regions
end
def deactivate
end
def load_default_regions
Radiant::AdminUI.class_eval { attr_accessor :sites }
admin.sites = OpenStruct.new.tap do |sites|
sites.index = Radiant::AdminUI::RegionSet.new do |index|
index.header.concat %w{name_th match_th base_th modify_th order_th}
index.row.concat %w{name_td match_td base_td modify_td order_td}
end
sites.edit = Radiant::AdminUI::RegionSet.new do |edit|
edit.main.concat %w{edit_header edit_form}
edit.form.concat %w{edit_name edit_match edit_base edit_homepage}
edit.form_bottom.concat %w{edit_buttons}
end
sites.new = sites.edit
end
end
end