Skip to content

Commit

Permalink
Compartible with Radiant 1.0.0.rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
hazg committed Jun 11, 2011
1 parent 218f688 commit 79ea10f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/helpers/admin/sites_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Admin::SitesHelper
def order_links(site)
returning String.new do |output|
String.new.tap do |output|
output << link_to(image("move_to_top.png", :alt => "Move to top"), move_to_top_admin_site_path(site), :method => :put)
output << link_to(image("move_higher.png", :alt => "Move up"), move_higher_admin_site_path(site), :method => :post)
output << link_to(image("move_lower.png", :alt => "Move down"), move_lower_admin_site_path(site), :method => :post)
Expand Down
10 changes: 10 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ActionController::Routing::Routes.draw 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
12 changes: 6 additions & 6 deletions lib/multi_site/page_extensions.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
module MultiSite::PageExtensions
def self.included(base)
base.class_eval {
alias_method_chain :url, :sites
alias_method_chain :path, :sites
mattr_accessor :current_site
has_one :site, :foreign_key => "homepage_id", :dependent => :nullify
}
base.extend ClassMethods
class << base
alias_method_chain :find_by_url, :sites
alias_method_chain :find_by_path, :sites
end
end

module ClassMethods
def find_by_url_with_sites(url, live=true)
def find_by_path_with_sites(url, live=true)
root = find_by_parent_id(nil)
if self.current_site.is_a?(Site)
root = self.current_site.homepage
end
raise Page::MissingRootPageError unless root
root.find_by_url(url, live)
root.find_by_path(url, live)
end
end

def url_with_sites
def path_with_sites
if parent
parent.child_url(self)
parent.child_path(self)
else
"/"
end
Expand Down
16 changes: 3 additions & 13 deletions multi_site_extension.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
require_dependency 'application_controller'

class MultiSiteExtension < Radiant::Extension
version "0.9.0"
version "1.0.0.rc2"
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/"

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
require 'multi_site/route_extensions'
Expand All @@ -26,7 +16,7 @@ def activate
Admin::PagesController.send :include, MultiSite::PagesControllerExtensions
admin.pages.index.add :bottom, "site_subnav"
tab 'Settings' do |tab|
tab.add_item 'Sites', '/admin/sites'
tab.add_item t('sites'), '/admin/sites'
end
load_default_regions
end
Expand All @@ -36,7 +26,7 @@ def deactivate

def load_default_regions
Radiant::AdminUI.class_eval { attr_accessor :sites }
admin.sites = returning OpenStruct.new do |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}
Expand Down

0 comments on commit 79ea10f

Please sign in to comment.