aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/application.rb5
-rw-r--r--config/httpd.conf-example (renamed from config/httpd.conf)5
-rw-r--r--config/initializers/theme_loader.rb21
l---------config/locales1
-rw-r--r--config/routes.rb5
5 files changed, 28 insertions, 9 deletions
diff --git a/config/application.rb b/config/application.rb
index f5b525a36..92fd30685 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -55,8 +55,11 @@ module Alaveteli
# will be in this time zone
config.time_zone = ::AlaveteliConfiguration::time_zone
- config.after_initialize do
+ config.after_initialize do |app|
require 'routing_filters.rb'
+ # Add a catch-all route to force routing errors to be handled by the application,
+ # rather than by middleware.
+ app.routes.append{ match '*path', :to => 'general#not_found' }
end
config.autoload_paths << "#{Rails.root.to_s}/lib/mail_handler"
diff --git a/config/httpd.conf b/config/httpd.conf-example
index e468a1e96..0115ad8d9 100644
--- a/config/httpd.conf
+++ b/config/httpd.conf-example
@@ -50,7 +50,12 @@ RewriteRule ^/request/((\d{1,3})\d*)/(response/\d+/attach/(html/)?\d+/.+) /views
PassengerResolveSymlinksInDocumentRoot on
# Recommend setting this to 3 or less on servers with 512MB RAM
PassengerMaxPoolSize 6
+ # The RackEnv variable applies to Rails 3 applications, while
+ # the RailsEnv variable applies to applicatoins for earlier
+ # versions of Rails. There doesn't seem to be any harm in
+ # setting both, however.
RailsEnv production
+ RackEnv production
</IfModule>
# Gzip font resources
diff --git a/config/initializers/theme_loader.rb b/config/initializers/theme_loader.rb
index 4c8967c97..1ad2d01f1 100644
--- a/config/initializers/theme_loader.rb
+++ b/config/initializers/theme_loader.rb
@@ -2,12 +2,23 @@
# It is used by our config/routes.rb to decide which route extension files to load.
$alaveteli_route_extensions = []
-if ENV["RAILS_ENV"] != "test" # Don't let the themes interfere with Alaveteli specs
+def require_theme(theme_name)
+ theme_main_include = File.expand_path "../../../vendor/plugins/#{theme_name}/lib/alavetelitheme.rb", __FILE__
+ if File.exists? theme_main_include
+ require theme_main_include
+ end
+end
+
+if Rails.env == "test"
+ # By setting this ALAVETELI_TEST_THEME to a theme name, theme tests can run in the Rails
+ # context with the theme loaded. Otherwise the themes from the config aren't loaded in testing
+ # so they don't interfere with core Alaveteli tests
+ if defined? ALAVETELI_TEST_THEME
+ require_theme(ALAVETELI_TEST_THEME)
+ end
+else
for url in AlaveteliConfiguration::theme_urls.reverse
theme_name = url.sub(/.*\/(.*).git/, "\\1")
- theme_main_include = File.expand_path "../../../vendor/plugins/#{theme_name}/lib/alavetelitheme.rb", __FILE__
- if File.exists? theme_main_include
- require theme_main_include
- end
+ require_theme(theme_name)
end
end
diff --git a/config/locales b/config/locales
deleted file mode 120000
index 10a4f96c3..000000000
--- a/config/locales
+++ /dev/null
@@ -1 +0,0 @@
-../vendor/rails-locales/rails/locale \ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 10f6a3284..1895543d7 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,3 +1,4 @@
+# encoding: UTF-8
# config/routes.rb:
# Mapping URLs to controllers for FOIFA.
#
@@ -51,8 +52,8 @@ Alaveteli::Application.routes.draw do
match '/request/:url_title/describe/:described_state' => 'request#describe_state_message', :as => :describe_state_message
match '/request/:id/response' => 'request#show_response', :as => :show_response_no_followup
match '/request/:id/response/:incoming_message_id' => 'request#show_response', :as => :show_response
- match '/request/:id/response/:incoming_message_id/attach/html/:part/*file_name' => 'request#get_attachment_as_html', :as => :get_attachment_as_html
- match '/request/:id/response/:incoming_message_id/attach/:part(/*file_name)' => 'request#get_attachment', :as => :get_attachment
+ match '/request/:id/response/:incoming_message_id/attach/html/:part/*file_name' => 'request#get_attachment_as_html', :format => false, :as => :get_attachment_as_html
+ match '/request/:id/response/:incoming_message_id/attach/:part(/*file_name)' => 'request#get_attachment', :format => false, :as => :get_attachment
match '/request_event/:info_request_event_id' => 'request#show_request_event', :as => :info_request_event