diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/environment.rb | 19 | ||||
-rw-r--r-- | config/environments/development.rb | 2 | ||||
-rw-r--r-- | config/i18n-routes.yml | 6 | ||||
-rw-r--r-- | config/initializers/fast_gettext.rb | 6 | ||||
l--------- | config/locales | 1 | ||||
-rw-r--r-- | config/routes.rb | 93 |
6 files changed, 102 insertions, 25 deletions
diff --git a/config/environment.rb b/config/environment.rb index 4f72d030b..a3c93db53 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -6,7 +6,7 @@ # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') @@ -17,8 +17,9 @@ $:.push(File.join(File.dirname(__FILE__), '../commonlib/rblib')) # (type "git submodule update --init" in the whatdotheyknow directory) # ruby-ole and ruby-msg. We use a custom ruby-msg to avoid a name conflict -$:.unshift(File.join(File.dirname(__FILE__), '../commonlib/rblib/ruby-ole/lib')) +$:.unshift(File.join(File.dirname(__FILE__), '../vendor/ruby-ole/lib')) $:.unshift(File.join(File.dirname(__FILE__), '../vendor/ruby-msg/lib')) +$:.unshift(File.join(File.dirname(__FILE__), '../vendor/plugins/globalize2/lib')) require 'memcache' @@ -56,13 +57,13 @@ Rails::Initializer.run do |config| config.gem 'rspec', :lib => false, :version => '1.3.1' config.gem 'rspec-rails', :lib => false, :version => '1.3.3' config.gem 'will_paginate', :version => '~> 2.3.11', :source => 'http://gemcutter.org' - + #GettextI18nRails.translations_are_html_safe = true # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. config.action_controller.session = { - :key => '_wdtk_cookie_session', + :session_key => '_wdtk_cookie_session', :secret => MySociety::Config.get("COOKIE_STORE_SESSION_SECRET", 'this default is insecure as code is open source, please override for live sites in config/general; this will do for local development') } config.action_controller.session_store = :cookie_store @@ -70,7 +71,7 @@ Rails::Initializer.run do |config| # Use SQL instead of Active Record's schema dumper when creating the test database. # This is necessary if your schema can't be completely dumped by the schema dumper, # like if you have constraints or database-specific column types - config.active_record.schema_format = :sql + # config.active_record.schema_format = :sql # Activate observers that should always be running # config.active_record.observers = :cacher, :garbage_collector @@ -112,6 +113,11 @@ if (MySociety::Config.get("DOMAIN", "") != "") } end +# fallback locale and available locales +I18n.default_locale = :en +available_locales = MySociety::Config.get('AVAILABLE_LOCALES', 'en') +FastGettext.default_available_locales = available_locales.split(/ /) + # Load monkey patches and other things from lib/ require 'tmail_extensions.rb' require 'activesupport_cache_extensions.rb' @@ -123,5 +129,4 @@ require 'activerecord_errors_extensions.rb' require 'willpaginate_hack.rb' require 'sendmail_return_path.rb' require 'tnef.rb' - - +require 'i18n_fixes.rb' diff --git a/config/environments/development.rb b/config/environments/development.rb index d15af3336..d5f2f5772 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -21,3 +21,5 @@ config.action_mailer.delivery_method = :sendmail # so is queued, rather than giv # unintentionally kept references to objects, especially strings. # require 'memory_profiler' # MemoryProfiler.start :string_debug => true, :delay => 10 + +config.gem "gettext", :version => '>=1.9.3', :lib => false diff --git a/config/i18n-routes.yml b/config/i18n-routes.yml new file mode 100644 index 000000000..1f9b3028c --- /dev/null +++ b/config/i18n-routes.yml @@ -0,0 +1,6 @@ +en: + # default from routes.rb +es: + search: busquedas + help: ayuda + about: sobre diff --git a/config/initializers/fast_gettext.rb b/config/initializers/fast_gettext.rb index 9ce0955e9..b01b129fa 100644 --- a/config/initializers/fast_gettext.rb +++ b/config/initializers/fast_gettext.rb @@ -1,3 +1,3 @@ -FastGettext.add_text_domain 'app', :path => File.join(RAILS_ROOT, 'locale'), :type => :po -FastGettext.default_available_locales = ['en'] #all you want to allow -FastGettext.default_text_domain = 'app'
\ No newline at end of file +FastGettext.add_text_domain 'app', :path => 'locale', :type => :po +FastGettext.default_available_locales = ['en','es'] #all you want to allow +FastGettext.default_text_domain = 'app' diff --git a/config/locales b/config/locales new file mode 120000 index 000000000..748fbfcbe --- /dev/null +++ b/config/locales @@ -0,0 +1 @@ +/home/seb/Code/alaveteli/vendor/rails-locales/rails/locale
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 928bacf67..2bf8e87fb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,7 +17,7 @@ ActionController::Routing::Routes.draw do |map| map.with_options :controller => 'general' do |general| general.frontpage '/', :action => 'frontpage' general.blog '/blog', :action => 'blog' - + general.custom_css '/custom.css', :action => 'custom_css' general.search_redirect '/search', :action => 'search_redirect' # XXX combined is the search query, and then if sorted a "/newest" at the end. # Couldn't find a way to do this in routes which also picked up multiple other slashes @@ -31,7 +31,9 @@ ActionController::Routing::Routes.draw do |map| end map.with_options :controller => 'request' do |request| - request.request_list '/list/:view', :action => 'list', :view => nil + request.request_list_recent '/list/recent', :action => 'list', :view => 'recent' + request.request_list_successful '/list/successful', :action => 'list', :view => 'successful' + request.request_list '/list', :action => 'list' request.new_request '/new', :action => 'new' request.new_request_to_body '/new/:url_name', :action => 'new' @@ -107,6 +109,9 @@ ActionController::Routing::Routes.draw do |map| map.with_options :controller => 'help' do |help| help.help_unhappy '/help/unhappy/:url_title', :action => 'unhappy' + help.help_about '/help/about', :action => 'about' + help.help_contact '/help/contact', :action => 'contact' + help.help_requesting '/help/requesting', :action => 'requesting' help.help_general '/help/:action', :action => :action end @@ -120,22 +125,80 @@ ActionController::Routing::Routes.draw do |map| game.stop '/categorise/stop', :action => 'stop' end - # NB: We don't use routes to *construct* admin URLs, as they need to be relative - # paths to work on the live site proxied over HTTPS to secure.mysociety.org - map.connect '/admin/', :controller => 'admin_general', :action => 'index' - map.connect '/admin/timeline', :controller => 'admin_general', :action => 'timeline' - map.connect '/admin/debug', :controller => 'admin_general', :action => 'debug' - map.connect '/admin/stats', :controller => 'admin_general', :action => 'stats' - map.connect '/admin/missing_scheme', :controller => 'admin_public_body', :action => 'missing_scheme' - map.connect '/admin/unclassified', :controller => 'admin_request', :action => 'list_old_unclassified' - map.connect '/admin/body/:action/:id', :controller => 'admin_public_body' - map.connect '/admin/request/:action/:id', :controller => 'admin_request' - map.connect '/admin/user/:action/:id', :controller => 'admin_user' - map.connect '/admin/track/:action/:id', :controller => 'admin_track' - map.connect '/admin/censor/:action/:id', :controller => 'admin_censor_rule' + map.with_options :controller => 'admin_public_body' do |body| + body.admin_body_missing '/admin/missing_scheme', :action => 'missing_scheme' + body.admin_body_index '/admin/body', :action => 'index' + body.admin_body_list '/admin/body/list', :action => 'list' + body.admin_body_show '/admin/body/show/:id', :action => 'show' + body.admin_body_new '/admin/body/new/:id', :action => 'new' + body.admin_body_edit '/admin/body/edit/:id', :action => 'edit' + body.admin_body_update '/admin/body/update/:id', :action => 'update' + body.admin_body_create '/admin/body/create/:id', :action => 'create' + body.admin_body_destroy '/admin/body/destroy/:id', :action => 'destroy' + body.admin_body_import_csv '/admin/body/import_csv', :action => 'import_csv' + end + + map.with_options :controller => 'admin_general' do |admin| + admin.admin_general_index '/admin', :action => 'index' + admin.admin_timeline '/admin/timeline', :action => 'timeline' + admin.admin_debug '/admin/debug', :action => 'debug' + admin.admin_stats '/admin/stats', :action => 'stats' + end + + map.with_options :controller => 'admin_request' do |admin| + admin.admin_request_list_old_unclassified '/admin/unclassified', :action => 'list_old_unclassified' + admin.admin_request_index '/admin/request', :action => 'index' + admin.admin_request_list '/admin/request/list', :action => 'list' + admin.admin_request_show '/admin/request/show/:id', :action => 'show' + admin.admin_request_resend '/admin/request/resend', :action => 'resend' + admin.admin_request_edit '/admin/request/edit/:id', :action => 'edit' + admin.admin_request_update '/admin/request/update/:id', :action => 'update' + admin.admin_request_destroy '/admin/request/destroy/:id', :action => 'fully_destroy' + admin.admin_request_edit_outgoing '/admin/request/edit_outgoing/:id', :action => 'edit_outgoing' + admin.admin_request_destroy_outgoing '/admin/request/destroy_outgoing/:id', :action => 'destroy_outgoing' + admin.admin_request_update_outgoing '/admin/request/update_outgoing/:id', :action => 'update_outgoing' + admin.admin_request_edit_comment '/admin/request/edit_comment/:id', :action => 'edit_comment' + admin.admin_request_update_comment '/admin/request/update_comment/:id', :action => 'update_comment' + admin.admin_request_destroy_incomine '/admin/request/destroy_incoming/:id', :action => 'destroy_incoming' + admin.admin_request_redeliver_incoming '/admin/request/redeliver_incoming', :action => 'redeliver_incoming' + admin.admin_request_move_request '/admin/request/move_request', :action => 'move_request' + admin.admin_request_generate_upload_url '/admin/request/generate_upload_url/:id', :action => 'generate_upload_url' + admin.admin_request_show_raw_email '/admin/request/show_raw_email/:id', :action => 'show_raw_email' + admin.admin_request_download_raw_email '/admin/request/download_raw_email/:id', :action => 'download_raw_email' + admin.admin_request_clarification '/admin/request/clarification', :action => 'mark_event_as_clarification' + end + + map.with_options :controller => 'admin_user' do |user| + user.admin_user_index '/admin/user', :action => 'index' + user.admin_user_list '/admin/user/list', :action => 'list' + user.admin_user_list_banned '/admin/user/banned', :action => 'list_banned' + user.admin_user_show '/admin/user/show/:id', :action => 'show' + user.admin_user_edit '/admin/user/edit/:id', :action => 'edit' + user.admin_user_update '/admin/user/update/:id', :action => 'update' + user.admin_user_destroy_track '/admin/user/destroy_track', :action => 'destroy_track' + user.admin_user_login_as '/admin/user/login_as/:id', :action => 'login_as' + user.admin_clear_profile_photo '/admin/user/clear_profile_photo/:id', :action => 'clear_profile_photo' + end + + map.with_options :controller => 'admin_track' do |track| + track.admin_track_list '/admin/track/list', :action => 'list' + end + + map.with_options :controller => 'admin_censor_rule' do |rule| + rule.admin_rule_new '/admin/censor/new', :action => 'new' + rule.admin_rule_create '/admin/censor/create', :action => 'create' + rule.admin_rule_edit '/admin/censor/edit/:id', :action => 'edit' + rule.admin_rule_update '/admin/censor/update', :action => 'update' + rule.admin_rule_destroy '/admin/censor/destroy', :action => 'destroy' + end # Allow downloading Web Service WSDL as a file with an extension # instead of a file named 'wsdl' # map.connect ':controller/service.wsdl', :action => 'wsdl' end +# XXX should do something like the following to load routes from separate files +# Dir.glob("config/routes_*yml").each do |f| +# ActionController::Routing::Translator.translate_from_file(f) +# end +ActionController::Routing::Translator.translate_from_file('config', 'i18n-routes.yml') |