Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

61 lines (49 sloc) 2.079 kB
require_dependency 'application_controller'
class MultiSiteExtension < Radiant::Extension
version "0.8.1"
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) and allows model classes to be scoped by site. }
url "http://radiantcms.org/"
define_routes do |map|
map.namespace :admin, :member => { :remove => :get } do |admin|
admin.resources :sites, :member => {
:move_higher => :post,
:move_lower => :post,
:move_to_top => :put,
:move_to_bottom => :put
}
end
end
def activate
# ActionController::Routing modules are required rather than sent as includes
# because the routing persists between dev. requests and is not compatible
# with multiple alias_method_chain calls.
require 'multi_site/route_extensions'
require 'multi_site/route_set_extensions'
# likewise for ScopedValidation, which is a pre-emptive hack that shouldn't run more than once.
require 'multi_site/scoped_validation'
# Model extensions
ActiveRecord::Base.send :include, MultiSite::ScopedModel
Page.send :include, MultiSite::PageExtensions
# Controller extensions
ApplicationController.send :include, MultiSite::ApplicationControllerExtensions
SiteController.send :include, MultiSite::SiteControllerExtensions
Admin::ResourceController.send :include, MultiSite::ResourceControllerExtensions
Admin::PagesController.send :include, MultiSite::PagesControllerExtensions
unless defined? admin.site
Radiant::AdminUI.send :include, MultiSite::AdminUI
admin.site = Radiant::AdminUI.load_default_site_regions
end
if respond_to?(:tab)
tab("Content") do
add_item "Sites", "/admin/sites", :visibility => [:admin]
end
else
admin.tabs.add "Sites", "/admin/sites", :visibility => [:admin]
end
end
def deactivate
end
end
class ActiveRecord::SiteNotFound < Exception; end
Jump to Line
Something went wrong with that request. Please try again.