diff options
-rw-r--r-- | config/initializers/theme_loader.rb | 6 | ||||
-rw-r--r-- | config/routes.rb | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/config/initializers/theme_loader.rb b/config/initializers/theme_loader.rb index 4ddce6910..8908dc07e 100644 --- a/config/initializers/theme_loader.rb +++ b/config/initializers/theme_loader.rb @@ -1,5 +1,9 @@ +# This is a global array of route extensions. Alaveteli modules may add to it. +# It is used by our config/routes.rb to decide which route extension files to load. +$alaveteli_route_extensions = [] + theme_urls = MySociety::Config.get("THEME_URLS", []) -if ENV["RAILS_ENV"] != "test" # Don't let the theme interfere with Alaveteli specs +if ENV["RAILS_ENV"] != "test" # Don't let the themes interfere with Alaveteli specs for url in theme_urls.reverse theme_name = url.sub(/.*\/(.*).git/, "\\1") theme_main_include = File.expand_path "../../../vendor/plugins/#{theme_name}/lib/alavetelitheme.rb", __FILE__ diff --git a/config/routes.rb b/config/routes.rb index c0d65042c..814deb760 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,7 +7,9 @@ # $Id: routes.rb,v 1.92 2009-10-14 22:01:27 francis Exp $ # Allow easy extension from themes. Note these will have the highest priority. -load File.join('config', 'custom-routes.rb') +$alaveteli_route_extensions.each do |f| + load File.join('config', f) +end ActionController::Routing::Routes.draw do |map| |