Update to rails 3
This commit is contained in:
parent
9ff70a861a
commit
c9fa49c994
41 changed files with 4214 additions and 2461 deletions
25
Gemfile
Normal file
25
Gemfile
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
source 'http://rubygems.org'
|
||||||
|
|
||||||
|
gem 'rails', '3.0.0'
|
||||||
|
|
||||||
|
gem 'pg'
|
||||||
|
gem 'libxml-ruby', '>= 2.0.5', :require => 'libxml'
|
||||||
|
gem 'rmagick', :require => 'RMagick'
|
||||||
|
gem 'oauth', '>= 0.4.3'
|
||||||
|
gem 'oauth-plugin', '>= 0.3.14'
|
||||||
|
gem 'httpclient'
|
||||||
|
gem 'SystemTimer', '>= 1.1.3', :require => 'system_timer'
|
||||||
|
gem 'sanitize'
|
||||||
|
|
||||||
|
# Should only load if memcache is in use
|
||||||
|
gem 'memcached'
|
||||||
|
|
||||||
|
# Should only load if we're not in database offline mode
|
||||||
|
gem 'composite_primary_keys', '>= 3.0.0.0'
|
||||||
|
|
||||||
|
# Bundle gems for the local environment. Make sure to
|
||||||
|
# put test-only gems in this group so their generators
|
||||||
|
# and rake tasks are available in development mode:
|
||||||
|
group :development, :test do
|
||||||
|
gem 'timecop'
|
||||||
|
end
|
7
Rakefile
7
Rakefile
|
@ -1,10 +1,7 @@
|
||||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
require File.expand_path('../config/application', __FILE__)
|
||||||
|
|
||||||
require 'rake'
|
require 'rake'
|
||||||
require 'rake/testtask'
|
|
||||||
require 'rake/rdoctask'
|
|
||||||
|
|
||||||
require 'tasks/rails'
|
OpenStreetMap::Application.load_tasks
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Filters added to this controller will be run for all controllers in the application.
|
|
||||||
# Likewise, all the methods added will be available for all controllers.
|
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
|
protect_from_forgery
|
||||||
|
|
||||||
if STATUS == :database_readonly or STATUS == :database_offline
|
if STATUS == :database_readonly or STATUS == :database_offline
|
||||||
session :off
|
session :off
|
||||||
|
|
||||||
|
|
|
@ -111,8 +111,6 @@ class DiaryEntryController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def rss
|
def rss
|
||||||
request.format = :rss
|
|
||||||
|
|
||||||
if params[:display_name]
|
if params[:display_name]
|
||||||
user = User.find_by_display_name(params[:display_name], :conditions => { :status => ["active", "confirmed"] })
|
user = User.find_by_display_name(params[:display_name], :conditions => { :status => ["active", "confirmed"] })
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
|
||||||
<%= javascript_strings %>
|
<%= javascript_strings %>
|
||||||
<%= javascript_include_tag 'prototype' %>
|
<%= javascript_include_tag 'prototype' %>
|
||||||
|
<%= javascript_include_tag 'rails' %>
|
||||||
<%= javascript_include_tag 'site' %>
|
<%= javascript_include_tag 'site' %>
|
||||||
<%= javascript_include_tag 'menu' %>
|
<%= javascript_include_tag 'menu' %>
|
||||||
<!--[if lt IE 7]><%= javascript_include_tag 'pngfix' %><![endif]--> <!-- thanks, microsoft! -->
|
<!--[if lt IE 7]><%= javascript_include_tag 'pngfix' %><![endif]--> <!-- thanks, microsoft! -->
|
||||||
|
@ -16,5 +17,6 @@
|
||||||
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
|
<%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %>
|
||||||
<%= style_rules %>
|
<%= style_rules %>
|
||||||
<%= yield :head %>
|
<%= yield :head %>
|
||||||
|
<%= csrf_meta_tag %>
|
||||||
<title><%= t 'layouts.project_name.title' %><%= ' | '+ h(@title) if @title %></title>
|
<title><%= t 'layouts.project_name.title' %><%= ' | '+ h(@title) if @title %></title>
|
||||||
</head>
|
</head>
|
||||||
|
|
4
config.ru
Normal file
4
config.ru
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
|
require ::File.expand_path('../config/environment', __FILE__)
|
||||||
|
run OpenStreetMap::Application
|
49
config/application.rb
Normal file
49
config/application.rb
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
require File.expand_path('../boot', __FILE__)
|
||||||
|
|
||||||
|
require File.expand_path('../preinitializer', __FILE__)
|
||||||
|
|
||||||
|
require 'rails/all'
|
||||||
|
|
||||||
|
# If you have a Gemfile, require the gems listed there, including any gems
|
||||||
|
# you've limited to :test, :development, or :production.
|
||||||
|
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
||||||
|
|
||||||
|
module OpenStreetMap
|
||||||
|
class Application < Rails::Application
|
||||||
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
|
# Application configuration should go into files in config/initializers
|
||||||
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
|
|
||||||
|
# Custom directories with classes and modules you want to be autoloadable.
|
||||||
|
config.autoload_paths += %W(#{config.root}/lib)
|
||||||
|
|
||||||
|
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||||
|
# :all can be used as a placeholder for all plugins not explicitly named.
|
||||||
|
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
||||||
|
|
||||||
|
# Activate observers that should always be running.
|
||||||
|
config.active_record.observers = :spam_observer
|
||||||
|
|
||||||
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||||
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||||
|
# config.time_zone = 'Central Time (US & Canada)'
|
||||||
|
|
||||||
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||||
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||||
|
# config.i18n.default_locale = :de
|
||||||
|
|
||||||
|
# JavaScript files you want as :defaults (application.js is always included).
|
||||||
|
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
||||||
|
|
||||||
|
# Configure the default encoding used in templates for Ruby 1.9.
|
||||||
|
config.encoding = "utf-8"
|
||||||
|
|
||||||
|
# Configure sensitive parameters which will be filtered from the log file.
|
||||||
|
config.filter_parameters += [:password]
|
||||||
|
|
||||||
|
# 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
|
||||||
|
end
|
||||||
|
end
|
119
config/boot.rb
119
config/boot.rb
|
@ -1,110 +1,13 @@
|
||||||
# Don't change this file!
|
|
||||||
# Configure your app in config/environment.rb and config/environments/*.rb
|
|
||||||
|
|
||||||
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
|
||||||
|
|
||||||
module Rails
|
|
||||||
class << self
|
|
||||||
def boot!
|
|
||||||
unless booted?
|
|
||||||
preinitialize
|
|
||||||
pick_boot.run
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def booted?
|
|
||||||
defined? Rails::Initializer
|
|
||||||
end
|
|
||||||
|
|
||||||
def pick_boot
|
|
||||||
(vendor_rails? ? VendorBoot : GemBoot).new
|
|
||||||
end
|
|
||||||
|
|
||||||
def vendor_rails?
|
|
||||||
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
|
||||||
end
|
|
||||||
|
|
||||||
def preinitialize
|
|
||||||
load(preinitializer_path) if File.exist?(preinitializer_path)
|
|
||||||
end
|
|
||||||
|
|
||||||
def preinitializer_path
|
|
||||||
"#{RAILS_ROOT}/config/preinitializer.rb"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Boot
|
|
||||||
def run
|
|
||||||
load_initializer
|
|
||||||
Rails::Initializer.run(:set_load_path)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class VendorBoot < Boot
|
|
||||||
def load_initializer
|
|
||||||
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
|
||||||
Rails::Initializer.run(:install_gem_spec_stubs)
|
|
||||||
Rails::GemDependency.add_frozen_gem_path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class GemBoot < Boot
|
|
||||||
def load_initializer
|
|
||||||
self.class.load_rubygems
|
|
||||||
load_rails_gem
|
|
||||||
require 'initializer'
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_rails_gem
|
|
||||||
if version = self.class.gem_version
|
|
||||||
gem 'rails', version
|
|
||||||
else
|
|
||||||
gem 'rails'
|
|
||||||
end
|
|
||||||
rescue Gem::LoadError => load_error
|
|
||||||
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
|
|
||||||
class << self
|
|
||||||
def rubygems_version
|
|
||||||
Gem::RubyGemsVersion rescue nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def gem_version
|
|
||||||
if defined? RAILS_GEM_VERSION
|
|
||||||
RAILS_GEM_VERSION
|
|
||||||
elsif ENV.include?('RAILS_GEM_VERSION')
|
|
||||||
ENV['RAILS_GEM_VERSION']
|
|
||||||
else
|
|
||||||
parse_gem_version(read_environment_rb)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_rubygems
|
|
||||||
min_version = '1.3.1'
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
unless rubygems_version >= min_version
|
|
||||||
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
|
|
||||||
rescue LoadError
|
# Set up gems listed in the Gemfile.
|
||||||
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
gemfile = File.expand_path('../../Gemfile', __FILE__)
|
||||||
exit 1
|
begin
|
||||||
end
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
||||||
|
require 'bundler'
|
||||||
def parse_gem_version(text)
|
Bundler.setup
|
||||||
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
rescue Bundler::GemNotFound => e
|
||||||
end
|
STDERR.puts e.message
|
||||||
|
STDERR.puts "Try running `bundle install`."
|
||||||
private
|
exit!
|
||||||
def read_environment_rb
|
end if File.exist?(gemfile)
|
||||||
File.read("#{RAILS_ROOT}/config/environment.rb")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# All that for this:
|
|
||||||
Rails.boot!
|
|
||||||
|
|
|
@ -1,59 +1,5 @@
|
||||||
# Be sure to restart your server when you modify this file
|
# Load the rails application
|
||||||
|
require File.expand_path('../application', __FILE__)
|
||||||
|
|
||||||
# Specifies gem version of Rails to use when vendor/rails is not present
|
# Initialize the rails application
|
||||||
RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION
|
OpenStreetMap::Application.initialize!
|
||||||
|
|
||||||
# Bootstrap the Rails environment, frameworks, and default configuration
|
|
||||||
require File.join(File.dirname(__FILE__), 'boot')
|
|
||||||
|
|
||||||
Rails::Initializer.run do |config|
|
|
||||||
# Settings in config/environments/* take precedence over those specified here.
|
|
||||||
# Application configuration should go into files in config/initializers
|
|
||||||
# -- all .rb files in that directory are automatically loaded.
|
|
||||||
|
|
||||||
# Add additional load paths for your own custom dirs
|
|
||||||
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
|
||||||
|
|
||||||
# Specify gems that this application depends on and have them installed with rake gems:install
|
|
||||||
unless STATUS == :database_offline
|
|
||||||
config.gem 'composite_primary_keys', :version => '2.2.2'
|
|
||||||
end
|
|
||||||
config.gem 'libxml-ruby', :version => '>= 2.0.5', :lib => 'libxml'
|
|
||||||
config.gem 'rmagick', :lib => 'RMagick'
|
|
||||||
config.gem 'oauth', :version => '>= 0.4.3'
|
|
||||||
config.gem 'oauth-plugin', :version => '0.3.14'
|
|
||||||
config.gem 'httpclient'
|
|
||||||
config.gem 'SystemTimer', :version => '>= 1.1.3', :lib => 'system_timer'
|
|
||||||
config.gem 'sanitize'
|
|
||||||
config.gem 'i18n', :version => '>= 0.5.0'
|
|
||||||
if defined?(MEMCACHE_SERVERS)
|
|
||||||
config.gem 'memcached'
|
|
||||||
end
|
|
||||||
|
|
||||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
||||||
# :all can be used as a placeholder for all plugins not explicitly named
|
|
||||||
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
||||||
|
|
||||||
# Skip frameworks you're not going to use. To use Rails without a database,
|
|
||||||
# you must remove the Active Record framework.
|
|
||||||
if STATUS == :database_offline
|
|
||||||
config.frameworks -= [ :active_record ]
|
|
||||||
config.eager_load_paths = []
|
|
||||||
end
|
|
||||||
|
|
||||||
# Activate observers that should always be running
|
|
||||||
config.active_record.observers = :spam_observer
|
|
||||||
|
|
||||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
||||||
# Run "rake -D time" for a list of tasks for finding time zone names.
|
|
||||||
config.time_zone = 'UTC'
|
|
||||||
|
|
||||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
||||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
|
|
||||||
# config.i18n.default_locale = :de
|
|
||||||
|
|
||||||
# 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
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
OpenStreetMap::Application.configure do
|
||||||
# Settings specified here will take precedence over those in config/environment.rb
|
# Settings specified here will take precedence over those in config/environment.rb
|
||||||
|
|
||||||
# In the development environment your application's code is reloaded on
|
# In the development environment your application's code is reloaded on
|
||||||
|
@ -9,9 +10,17 @@ config.cache_classes = false
|
||||||
config.whiny_nils = true
|
config.whiny_nils = true
|
||||||
|
|
||||||
# Show full error reports and disable caching
|
# Show full error reports and disable caching
|
||||||
config.action_controller.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
config.action_view.debug_rjs = true
|
config.action_view.debug_rjs = true
|
||||||
config.action_controller.perform_caching = false
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
# Don't care if the mailer can't send
|
# Don't care if the mailer can't send
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Print deprecation notices to the Rails logger
|
||||||
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
# Only use best-standards-support built into browsers
|
||||||
|
config.action_dispatch.best_standards_support = :builtin
|
||||||
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
OpenStreetMap::Application.configure do
|
||||||
# Settings specified here will take precedence over those in config/environment.rb
|
# Settings specified here will take precedence over those in config/environment.rb
|
||||||
|
|
||||||
# The production environment is meant for finished, "live" apps.
|
# The production environment is meant for finished, "live" apps.
|
||||||
|
@ -5,9 +6,17 @@
|
||||||
config.cache_classes = true
|
config.cache_classes = true
|
||||||
|
|
||||||
# Full error reports are disabled and caching is turned on
|
# Full error reports are disabled and caching is turned on
|
||||||
config.action_controller.consider_all_requests_local = false
|
config.consider_all_requests_local = false
|
||||||
config.action_controller.perform_caching = true
|
config.action_controller.perform_caching = true
|
||||||
config.action_view.cache_template_loading = true
|
|
||||||
|
# Specifies the header that your server uses for sending files
|
||||||
|
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
||||||
|
|
||||||
|
# For nginx:
|
||||||
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
||||||
|
|
||||||
|
# If you have no front-end server that supports something like X-Sendfile,
|
||||||
|
# just comment this out and Rails will serve the files
|
||||||
|
|
||||||
# See everything in the log (default is :info)
|
# See everything in the log (default is :info)
|
||||||
# config.log_level = :debug
|
# config.log_level = :debug
|
||||||
|
@ -26,6 +35,10 @@ if defined?(MEMCACHE_SERVERS)
|
||||||
config.cache_store = :mem_cache_store, MEMCACHE
|
config.cache_store = :mem_cache_store, MEMCACHE
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Disable Rails's static asset server
|
||||||
|
# In production, Apache or nginx will already do this
|
||||||
|
config.serve_static_assets = false
|
||||||
|
|
||||||
# Enable serving of images, stylesheets, and javascripts from an asset server
|
# Enable serving of images, stylesheets, and javascripts from an asset server
|
||||||
# config.action_controller.asset_host = "http://assets.example.com"
|
# config.action_controller.asset_host = "http://assets.example.com"
|
||||||
|
|
||||||
|
@ -34,3 +47,11 @@ end
|
||||||
|
|
||||||
# Enable threaded mode
|
# Enable threaded mode
|
||||||
# config.threadsafe!
|
# config.threadsafe!
|
||||||
|
|
||||||
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||||
|
# the I18n.default_locale when a translation can not be found)
|
||||||
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
|
# Send deprecation notices to registered listeners
|
||||||
|
config.active_support.deprecation = :notify
|
||||||
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
OpenStreetMap::Application.configure do
|
||||||
# Settings specified here will take precedence over those in config/environment.rb
|
# Settings specified here will take precedence over those in config/environment.rb
|
||||||
|
|
||||||
# The test environment is used exclusively to run your application's
|
# The test environment is used exclusively to run your application's
|
||||||
|
@ -10,9 +11,11 @@ config.cache_classes = true
|
||||||
config.whiny_nils = true
|
config.whiny_nils = true
|
||||||
|
|
||||||
# Show full error reports and disable caching
|
# Show full error reports and disable caching
|
||||||
config.action_controller.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
config.action_controller.perform_caching = false
|
config.action_controller.perform_caching = false
|
||||||
config.action_view.cache_template_loading = true
|
|
||||||
|
# Raise exceptions instead of rendering exception templates
|
||||||
|
config.action_dispatch.show_exceptions = false
|
||||||
|
|
||||||
# Disable request forgery protection in test environment
|
# Disable request forgery protection in test environment
|
||||||
config.action_controller.allow_forgery_protection = false
|
config.action_controller.allow_forgery_protection = false
|
||||||
|
@ -22,5 +25,6 @@ config.action_controller.allow_forgery_protection = false
|
||||||
# ActionMailer::Base.deliveries array.
|
# ActionMailer::Base.deliveries array.
|
||||||
config.action_mailer.delivery_method = :test
|
config.action_mailer.delivery_method = :test
|
||||||
|
|
||||||
# Load timecop to help with testing time dependent code
|
# Print deprecation notices to the stderr
|
||||||
config.gem 'timecop'
|
config.active_support.deprecation = :stderr
|
||||||
|
end
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Stop action controller from automatically parsing XML in request bodies
|
|
||||||
ActionController::Base.param_parsers.delete Mime::XML
|
|
||||||
|
|
2
config/initializers/action_dispatch.rb
Normal file
2
config/initializers/action_dispatch.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Stop rails from automatically parsing XML in request bodies
|
||||||
|
Rails.configuration.middleware.delete ActionDispatch::ParamsParser
|
|
@ -3,5 +3,5 @@
|
||||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||||
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||||
|
|
||||||
# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
|
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||||
# Rails.backtrace_cleaner.remove_silencers!
|
# Rails.backtrace_cleaner.remove_silencers!
|
|
@ -1,21 +0,0 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
|
||||||
|
|
||||||
# These settings change the behavior of Rails 2 apps and will be defaults
|
|
||||||
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
|
||||||
|
|
||||||
if defined?(ActiveRecord)
|
|
||||||
# Include Active Record class name as root for JSON serialized output.
|
|
||||||
ActiveRecord::Base.include_root_in_json = true
|
|
||||||
|
|
||||||
# Store the full class name (including module namespace) in STI type column.
|
|
||||||
ActiveRecord::Base.store_full_sti_class = true
|
|
||||||
end
|
|
||||||
|
|
||||||
ActionController::Routing.generate_best_match = false
|
|
||||||
|
|
||||||
# Use ISO 8601 format for JSON serialized times and dates.
|
|
||||||
ActiveSupport.use_standard_json_time_format = true
|
|
||||||
|
|
||||||
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
|
||||||
# if you're including raw json in an HTML page.
|
|
||||||
ActiveSupport.escape_html_entities_in_json = false
|
|
|
@ -4,4 +4,4 @@
|
||||||
# If you change this key, all old signed cookies will become invalid!
|
# If you change this key, all old signed cookies will become invalid!
|
||||||
# Make sure the secret is at least 30 characters and all random,
|
# Make sure the secret is at least 30 characters and all random,
|
||||||
# no regular words or you'll be exposed to dictionary attacks.
|
# no regular words or you'll be exposed to dictionary attacks.
|
||||||
ActionController::Base.cookie_verifier_secret = '67881c9e6670d9b55b43885ea8eab34e32865ce436bdbde73e1967a11a26674906736de0aa1a0d24edf8ebcb653e1735413e6fd24e1201338e397d4a2392c614';
|
OpenStreetMap::Application.config.secret_token = '67881c9e6670d9b55b43885ea8eab34e32865ce436bdbde73e1967a11a26674906736de0aa1a0d24edf8ebcb653e1735413e6fd24e1201338e397d4a2392c614'
|
|
@ -1,17 +1,8 @@
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Your secret key for verifying cookie session data integrity.
|
OpenStreetMap::Application.config.session_store :cookie_store, :key => '_osm_session'
|
||||||
# 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.
|
|
||||||
ActionController::Base.session = {
|
|
||||||
:key => '_osm_session',
|
|
||||||
:secret => 'd886369b1e709c61d1f9fcb07384a2b96373c83c01bfc98c6611a9fe2b6d0b14215bb360a0154265cccadde5489513f2f9b8d9e7b384a11924f772d2872c2a1f'
|
|
||||||
}
|
|
||||||
|
|
||||||
# Use the database for sessions instead of the cookie-based default,
|
# Use the database for sessions instead of the cookie-based default,
|
||||||
# which shouldn't be used to store highly confidential information
|
# which shouldn't be used to store highly confidential information
|
||||||
# (create the session table with "rake db:sessions:create")
|
# (create the session table with "rake db:sessions:create")
|
||||||
unless STATUS == :database_offline or STATUS == :database_readonly
|
# OpenStreetMap::Application.config.session_store :active_record_store
|
||||||
ActionController::Base.session_store = :sql_session_store
|
|
||||||
end
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# Work out which session store adapter to use
|
# Work out which session store adapter to use
|
||||||
environment = Rails.configuration.environment
|
adapter = Rails.configuration.database_configuration[Rails.env]["adapter"]
|
||||||
adapter = Rails.configuration.database_configuration[environment]["adapter"]
|
|
||||||
session_class = adapter + "_session"
|
session_class = adapter + "_session"
|
||||||
|
|
||||||
# Configure SqlSessionStore
|
# Configure SqlSessionStore
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
|
|
||||||
config = YAML.load_file("#{RAILS_ROOT}/config/application.yml")
|
config = YAML.load_file(File.expand_path("../application.yml", __FILE__))
|
||||||
env = ENV['RAILS_ENV'] || 'development'
|
env = ENV['RAILS_ENV'] || 'development'
|
||||||
|
|
||||||
ENV.each do |key,value|
|
ENV.each do |key,value|
|
||||||
|
|
377
config/routes.rb
377
config/routes.rb
|
@ -1,232 +1,233 @@
|
||||||
ActionController::Routing::Routes.draw do |map|
|
OpenStreetMap::Application.routes.draw do
|
||||||
# API
|
# API
|
||||||
map.connect "api/capabilities", :controller => 'api', :action => 'capabilities'
|
match 'api/capabilities' => 'api#capabilities'
|
||||||
map.connect "api/#{API_VERSION}/capabilities", :controller => 'api', :action => 'capabilities'
|
match 'api/0.6/capabilities' => 'api#capabilities'
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/changeset/create", :controller => 'changeset', :action => 'create'
|
match 'api/0.6/changeset/create' => 'changeset#create'
|
||||||
map.connect "api/#{API_VERSION}/changeset/:id/upload", :controller => 'changeset', :action => 'upload', :id => /\d+/
|
match 'api/0.6/changeset/:id/upload' => 'changeset#upload', :id => /\d+/
|
||||||
map.changeset_download "api/#{API_VERSION}/changeset/:id/download", :controller => 'changeset', :action => 'download', :id => /\d+/
|
match 'api/0.6/changeset/:id/download' => 'changeset#download', :as => :changeset_download, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/changeset/:id/expand_bbox", :controller => 'changeset', :action => 'expand_bbox', :id => /\d+/
|
match 'api/0.6/changeset/:id/expand_bbox' => 'changeset#expand_bbox', :id => /\d+/
|
||||||
map.changeset_read "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
|
match 'api/0.6/changeset/:id' => 'changeset#read', :as => :changeset_read, :via => :get, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
|
match 'api/0.6/changeset/:id' => 'changeset#update', :via => :put, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/changeset/:id/close", :controller => 'changeset', :action => 'close', :id =>/\d+/
|
match 'api/0.6/changeset/:id/close' => 'changeset#close', :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/changesets", :controller => 'changeset', :action => 'query'
|
match 'api/0.6/changesets' => 'changeset#query', :id => nil
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/node/create", :controller => 'node', :action => 'create'
|
match 'api/0.6/node/create' => 'node#create'
|
||||||
map.connect "api/#{API_VERSION}/node/:id/ways", :controller => 'way', :action => 'ways_for_node', :id => /\d+/
|
match 'api/0.6/node/:id/ways' => 'way#ways_for_node', :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/node/:id/relations", :controller => 'relation', :action => 'relations_for_node', :id => /\d+/
|
match 'api/0.6/node/:id/relations' => 'relation#relations_for_node', :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/node/:id/history", :controller => 'old_node', :action => 'history', :id => /\d+/
|
match 'api/0.6/node/:id/history' => 'old_node#history', :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/node/:id/:version", :controller => 'old_node', :action => 'version', :id => /\d+/, :version => /\d+/
|
match 'api/0.6/node/:id/:version' => 'old_node#version', :version => /\d+/, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
|
match 'api/0.6/node/:id' => 'node#read', :via => :get, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
|
match 'api/0.6/node/:id' => 'node#update', :via => :put, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
|
match 'api/0.6/node/:id' => 'node#delete', :via => :delete, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/nodes", :controller => 'node', :action => 'nodes', :id => nil
|
match 'api/0.6/nodes' => 'node#nodes', :id => nil
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/way/create", :controller => 'way', :action => 'create'
|
match 'api/0.6/way/create' => 'way#create'
|
||||||
map.connect "api/#{API_VERSION}/way/:id/history", :controller => 'old_way', :action => 'history', :id => /\d+/
|
match 'api/0.6/way/:id/history' => 'old_way#history', :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/way/:id/full", :controller => 'way', :action => 'full', :id => /\d+/
|
match 'api/0.6/way/:id/full' => 'way#full', :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/way/:id/relations", :controller => 'relation', :action => 'relations_for_way', :id => /\d+/
|
match 'api/0.6/way/:id/relations' => 'relation#relations_for_way', :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/way/:id/:version", :controller => 'old_way', :action => 'version', :id => /\d+/, :version => /\d+/
|
match 'api/0.6/way/:id/:version' => 'old_way#version', :version => /\d+/, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
|
match 'api/0.6/way/:id' => 'way#read', :via => :get, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
|
match 'api/0.6/way/:id' => 'way#update', :via => :put, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
|
match 'api/0.6/way/:id' => 'way#delete', :via => :delete, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/ways", :controller => 'way', :action => 'ways', :id => nil
|
match 'api/0.6/ways' => 'way#ways', :id => nil
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/relation/create", :controller => 'relation', :action => 'create'
|
match 'api/0.6/relation/create' => 'relation#create'
|
||||||
map.connect "api/#{API_VERSION}/relation/:id/relations", :controller => 'relation', :action => 'relations_for_relation', :id => /\d+/
|
match 'api/0.6/relation/:id/relations' => 'relation#relations_for_relation', :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/relation/:id/history", :controller => 'old_relation', :action => 'history', :id => /\d+/
|
match 'api/0.6/relation/:id/history' => 'old_relation#history', :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/relation/:id/full", :controller => 'relation', :action => 'full', :id => /\d+/
|
match 'api/0.6/relation/:id/full' => 'relation#full', :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/relation/:id/:version", :controller => 'old_relation', :action => 'version', :id => /\d+/, :version => /\d+/
|
match 'api/0.6/relation/:id/:version' => 'old_relation#version', :version => /\d+/, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
|
match 'api/0.6/relation/:id' => 'relation#read', :via => :get, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
|
match 'api/0.6/relation/:id' => 'relation#update', :via => :put, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
|
match 'api/0.6/relation/:id' => 'relation#delete', :via => :delete, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/relations", :controller => 'relation', :action => 'relations', :id => nil
|
match 'api/0.6/relations' => 'relation#relations'
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/map", :controller => 'api', :action => 'map'
|
match 'api/0.6/map' => 'api#map'
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/trackpoints", :controller => 'api', :action => 'trackpoints'
|
match 'api/0.6/trackpoints' => 'api#trackpoints'
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/changes", :controller => 'api', :action => 'changes'
|
match 'api/0.6/changes' => 'api#changes'
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/search", :controller => 'search', :action => 'search_all'
|
match 'api/0.6/search' => 'search#search_all'
|
||||||
map.connect "api/#{API_VERSION}/ways/search", :controller => 'search', :action => 'search_ways'
|
match 'api/0.6/ways/search' => 'search#search_ways'
|
||||||
map.connect "api/#{API_VERSION}/relations/search", :controller => 'search', :action => 'search_relations'
|
match 'api/0.6/relations/search' => 'search#search_relations'
|
||||||
map.connect "api/#{API_VERSION}/nodes/search", :controller => 'search', :action => 'search_nodes'
|
match 'api/0.6/nodes/search' => 'search#search_nodes'
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/user/details", :controller => 'user', :action => 'api_details'
|
match 'api/0.6/user/details' => 'user#api_details'
|
||||||
map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'read', :conditions => { :method => :get }
|
match 'api/0.6/user/preferences' => 'user_preference#read', :via => :get
|
||||||
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'read_one', :conditions => { :method => :get }
|
match 'api/0.6/user/preferences/:preference_key' => 'user_preference#read_one', :via => :get
|
||||||
map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'update', :conditions => { :method => :put }
|
match 'api/0.6/user/preferences' => 'user_preference#update', :via => :put
|
||||||
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'update_one', :conditions => { :method => :put }
|
match 'api/0.6/user/preferences/:preference_key' => 'user_preference#update_one', :via => :put
|
||||||
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'delete_one', :conditions => { :method => :delete }
|
match 'api/0.6/user/preferences/:preference_key' => 'user_preference#delete_one', :via => :delete
|
||||||
map.connect "api/#{API_VERSION}/user/gpx_files", :controller => 'user', :action => 'api_gpx_files'
|
match 'api/0.6/user/gpx_files' => 'user#api_gpx_files'
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/gpx/create", :controller => 'trace', :action => 'api_create'
|
match 'api/0.6/gpx/create' => 'trace#api_create'
|
||||||
map.connect "api/#{API_VERSION}/gpx/:id", :controller => 'trace', :action => 'api_read', :id => /\d+/, :conditions => { :method => :get }
|
match 'api/0.6/gpx/:id' => 'trace#api_read', :via => :get, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/gpx/:id", :controller => 'trace', :action => 'api_update', :id => /\d+/, :conditions => { :method => :put }
|
match 'api/0.6/gpx/:id' => 'trace#api_update', :via => :put, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/gpx/:id", :controller => 'trace', :action => 'api_delete', :id => /\d+/, :conditions => { :method => :delete }
|
match 'api/0.6/gpx/:id' => 'trace#api_delete', :via => :delete, :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/gpx/:id/details", :controller => 'trace', :action => 'api_read', :id => /\d+/
|
match 'api/0.6/gpx/:id/details' => 'trace#api_read', :id => /\d+/
|
||||||
map.connect "api/#{API_VERSION}/gpx/:id/data", :controller => 'trace', :action => 'api_data', :id => /\d+/
|
match 'api/0.6/gpx/:id/data' => 'trace#api_data'
|
||||||
map.connect "api/#{API_VERSION}/gpx/:id/data.:format", :controller => 'trace', :action => 'api_data', :id => /\d+/
|
match 'api/0.6/gpx/:id/data.:format' => 'trace#api_data'
|
||||||
|
|
||||||
# AMF (ActionScript) API
|
# AMF (ActionScript) API
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/amf/read", :controller =>'amf', :action =>'amf_read'
|
match 'api/0.6/amf/read' => 'amf#amf_read'
|
||||||
map.connect "api/#{API_VERSION}/amf/write", :controller =>'amf', :action =>'amf_write'
|
match 'api/0.6/amf/write' => 'amf#amf_write'
|
||||||
map.connect "api/#{API_VERSION}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints'
|
match 'api/0.6/swf/trackpoints' => 'swf#trackpoints'
|
||||||
|
|
||||||
# Data browsing
|
# Data browsing
|
||||||
map.connect '/browse/start', :controller => 'browse', :action => 'start'
|
match '/browse/start' => 'browse#start'
|
||||||
map.connect '/browse/way/:id', :controller => 'browse', :action => 'way', :id => /\d+/
|
match '/browse/way/:id' => 'browse#way', :id => /\d+/
|
||||||
map.connect '/browse/way/:id/history', :controller => 'browse', :action => 'way_history', :id => /\d+/
|
match '/browse/way/:id/history' => 'browse#way_history', :id => /\d+/
|
||||||
map.connect '/browse/node/:id', :controller => 'browse', :action => 'node', :id => /\d+/
|
match '/browse/node/:id' => 'browse#node', :id => /\d+/
|
||||||
map.connect '/browse/node/:id/history', :controller => 'browse', :action => 'node_history', :id => /\d+/
|
match '/browse/node/:id/history' => 'browse#node_history', :id => /\d+/
|
||||||
map.connect '/browse/relation/:id', :controller => 'browse', :action => 'relation', :id => /\d+/
|
match '/browse/relation/:id' => 'browse#relation', :id => /\d+/
|
||||||
map.connect '/browse/relation/:id/history', :controller => 'browse', :action => 'relation_history', :id => /\d+/
|
match '/browse/relation/:id/history' => 'browse#relation_history', :id => /\d+/
|
||||||
map.changeset '/browse/changeset/:id', :controller => 'browse', :action => 'changeset', :id => /\d+/
|
match '/browse/changeset/:id' => 'browse#changeset', :as => :changeset, :id => /\d+/
|
||||||
map.connect '/user/:display_name/edits/feed', :controller => 'changeset', :action => 'list', :format =>:atom
|
match '/user/:display_name/edits' => 'changeset#list'
|
||||||
map.connect '/user/:display_name/edits', :controller => 'changeset', :action => 'list'
|
match '/user/:display_name/edits/feed' => 'changeset#list', :format => :atom
|
||||||
map.connect '/browse/changesets/feed', :controller => 'changeset', :action => 'list', :format => :atom
|
match '/browse/changesets' => 'changeset#list'
|
||||||
map.connect '/browse/changesets', :controller => 'changeset', :action => 'list'
|
match '/browse/changesets/feed' => 'changeset#list', :format => :atom
|
||||||
map.connect '/browse', :controller => 'changeset', :action => 'list'
|
match '/browse' => 'changeset#list'
|
||||||
|
|
||||||
# web site
|
# web site
|
||||||
map.root :controller => 'site', :action => 'index'
|
match '/' => 'site#index'
|
||||||
map.connect '/', :controller => 'site', :action => 'index'
|
match '/edit' => 'site#edit'
|
||||||
map.connect '/edit', :controller => 'site', :action => 'edit'
|
match '/copyright' => 'site#copyright'
|
||||||
map.connect '/copyright', :controller => 'site', :action => 'copyright'
|
match '/copyright/:copyright_locale' => 'site#copyright'
|
||||||
map.connect '/copyright/:copyright_locale', :controller => 'site', :action => 'copyright'
|
match '/history' => 'changeset#list'
|
||||||
map.connect '/history', :controller => 'changeset', :action => 'list'
|
match '/history/feed' => 'changeset#list', :format => :atom
|
||||||
map.connect '/history/feed', :controller => 'changeset', :action => 'list', :format => :atom
|
match '/export' => 'site#export'
|
||||||
map.connect '/export', :controller => 'site', :action => 'export'
|
match '/login' => 'user#login'
|
||||||
map.connect '/login', :controller => 'user', :action => 'login'
|
match '/logout' => 'user#logout'
|
||||||
map.connect '/logout', :controller => 'user', :action => 'logout'
|
match '/offline' => 'site#offline'
|
||||||
map.connect '/offline', :controller => 'site', :action => 'offline'
|
match '/key' => 'site#key'
|
||||||
map.connect '/key', :controller => 'site', :action => 'key'
|
match '/user/new' => 'user#new'
|
||||||
map.connect '/user/new', :controller => 'user', :action => 'new'
|
match '/user/terms' => 'user#terms'
|
||||||
map.connect '/user/terms', :controller => 'user', :action => 'terms'
|
match '/user/save' => 'user#save'
|
||||||
map.connect '/user/save', :controller => 'user', :action => 'save'
|
match '/user/:display_name/confirm/resend' => 'user#confirm_resend'
|
||||||
map.connect '/user/:display_name/confirm/resend', :controller => 'user', :action => 'confirm_resend'
|
match '/user/:display_name/confirm' => 'user#confirm'
|
||||||
map.connect '/user/:display_name/confirm', :controller => 'user', :action => 'confirm'
|
match '/user/confirm' => 'user#confirm'
|
||||||
map.connect '/user/confirm', :controller => 'user', :action => 'confirm'
|
match '/user/confirm-email' => 'user#confirm_email'
|
||||||
map.connect '/user/confirm-email', :controller => 'user', :action => 'confirm_email'
|
match '/user/go_public' => 'user#go_public'
|
||||||
map.connect '/user/go_public', :controller => 'user', :action => 'go_public'
|
match '/user/reset-password' => 'user#reset_password'
|
||||||
map.connect '/user/reset-password', :controller => 'user', :action => 'reset_password'
|
match '/user/forgot-password' => 'user#lost_password'
|
||||||
map.connect '/user/forgot-password', :controller => 'user', :action => 'lost_password'
|
match '/user/suspended' => 'user#suspended'
|
||||||
map.connect '/user/suspended', :controller => 'user', :action => 'suspended'
|
|
||||||
|
|
||||||
map.connect '/index.html', :controller => 'site', :action => 'index'
|
match '/index.html' => 'site#index'
|
||||||
map.connect '/edit.html', :controller => 'site', :action => 'edit'
|
match '/edit.html' => 'site#edit'
|
||||||
map.connect '/export.html', :controller => 'site', :action => 'export'
|
match '/export.html' => 'site#export'
|
||||||
map.connect '/login.html', :controller => 'user', :action => 'login'
|
match '/login.html' => 'user#login'
|
||||||
map.connect '/logout.html', :controller => 'user', :action => 'logout'
|
match '/logout.html' => 'user#logout'
|
||||||
map.connect '/create-account.html', :controller => 'user', :action => 'new'
|
match '/create-account.html' => 'user#new'
|
||||||
map.connect '/forgot-password.html', :controller => 'user', :action => 'lost_password'
|
match '/forgot-password.html' => 'user#lost_password'
|
||||||
|
|
||||||
# permalink
|
# permalink
|
||||||
map.connect '/go/:code', :controller => 'site', :action => 'permalink', :code => /[a-zA-Z0-9_@]+[=-]*/
|
match '/go/:code' => 'site#permalink', :code => /[a-zA-Z0-9_@]+[=-]*/
|
||||||
|
|
||||||
# traces
|
# traces
|
||||||
map.connect '/user/:display_name/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
|
match '/user/:display_name/traces/tag/:tag/page/:page' => 'trace#list'
|
||||||
map.connect '/user/:display_name/traces/tag/:tag', :controller => 'trace', :action => 'list'
|
match '/user/:display_name/traces/tag/:tag' => 'trace#list'
|
||||||
map.connect '/user/:display_name/traces/page/:page', :controller => 'trace', :action => 'list'
|
match '/user/:display_name/traces/page/:page' => 'trace#list'
|
||||||
map.connect '/user/:display_name/traces', :controller => 'trace', :action => 'list'
|
match '/user/:display_name/traces' => 'trace#list'
|
||||||
map.connect '/user/:display_name/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
|
match '/user/:display_name/traces/tag/:tag/rss' => 'trace#georss'
|
||||||
map.connect '/user/:display_name/traces/rss', :controller => 'trace', :action => 'georss'
|
match '/user/:display_name/traces/rss' => 'trace#georss'
|
||||||
map.connect '/user/:display_name/traces/:id', :controller => 'trace', :action => 'view'
|
match '/user/:display_name/traces/:id' => 'trace#view'
|
||||||
map.connect '/user/:display_name/traces/:id/picture', :controller => 'trace', :action => 'picture'
|
match '/user/:display_name/traces/:id/picture' => 'trace#picture'
|
||||||
map.connect '/user/:display_name/traces/:id/icon', :controller => 'trace', :action => 'icon'
|
match '/user/:display_name/traces/:id/icon' => 'trace#icon'
|
||||||
map.connect '/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
|
match '/traces/tag/:tag/page/:page' => 'trace#list'
|
||||||
map.connect '/traces/tag/:tag', :controller => 'trace', :action => 'list'
|
match '/traces/tag/:tag' => 'trace#list'
|
||||||
map.connect '/traces/page/:page', :controller => 'trace', :action => 'list'
|
match '/traces/page/:page' => 'trace#list'
|
||||||
map.connect '/traces', :controller => 'trace', :action => 'list'
|
match '/traces' => 'trace#list'
|
||||||
map.connect '/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
|
match '/traces/tag/:tag/rss' => 'trace#georss'
|
||||||
map.connect '/traces/rss', :controller => 'trace', :action => 'georss'
|
match '/traces/rss' => 'trace#georss'
|
||||||
map.connect '/traces/mine/tag/:tag/page/:page', :controller => 'trace', :action => 'mine'
|
match '/traces/mine/tag/:tag/page/:page' => 'trace#mine'
|
||||||
map.connect '/traces/mine/tag/:tag', :controller => 'trace', :action => 'mine'
|
match '/traces/mine/tag/:tag' => 'trace#mine'
|
||||||
map.connect '/traces/mine/page/:page', :controller => 'trace', :action => 'mine'
|
match '/traces/mine/page/:page' => 'trace#mine'
|
||||||
map.connect '/traces/mine', :controller => 'trace', :action => 'mine'
|
match '/traces/mine' => 'trace#mine'
|
||||||
map.connect '/trace/create', :controller => 'trace', :action => 'create'
|
match '/trace/create' => 'trace#create'
|
||||||
map.connect '/trace/:id/data', :controller => 'trace', :action => 'data'
|
match '/trace/:id/data' => 'trace#data'
|
||||||
map.connect '/trace/:id/data.:format', :controller => 'trace', :action => 'data'
|
match '/trace/:id/data.:format' => 'trace#data'
|
||||||
map.connect '/trace/:id/edit', :controller => 'trace', :action => 'edit'
|
match '/trace/:id/edit' => 'trace#edit'
|
||||||
map.connect '/trace/:id/delete', :controller => 'trace', :action => 'delete'
|
match '/trace/:id/delete' => 'trace#delete'
|
||||||
|
|
||||||
# diary pages
|
# diary pages
|
||||||
map.connect '/diary/new', :controller => 'diary_entry', :action => 'new'
|
match '/diary/new' => 'diary_entry#new'
|
||||||
map.connect '/user/:display_name/diary/rss', :controller => 'diary_entry', :action => 'rss'
|
match '/user/:display_name/diary/rss' => 'diary_entry#rss', :format => :rss
|
||||||
map.connect '/diary/:language/rss', :controller => 'diary_entry', :action => 'rss'
|
match '/diary/:language/rss' => 'diary_entry#rss', :format => :rss
|
||||||
map.connect '/diary/rss', :controller => 'diary_entry', :action => 'rss'
|
match '/diary/rss' => 'diary_entry#rss', :format => :rss
|
||||||
map.connect '/user/:display_name/diary', :controller => 'diary_entry', :action => 'list'
|
match '/user/:display_name/diary' => 'diary_entry#list'
|
||||||
map.connect '/diary/:language', :controller => 'diary_entry', :action => 'list'
|
match '/diary/:language' => 'diary_entry#list'
|
||||||
map.connect '/diary', :controller => 'diary_entry', :action => 'list'
|
match '/diary' => 'diary_entry#list'
|
||||||
map.connect '/user/:display_name/diary/:id', :controller => 'diary_entry', :action => 'view', :id => /\d+/
|
match '/user/:display_name/diary/:id' => 'diary_entry#view', :id => /\d+/
|
||||||
map.connect '/user/:display_name/diary/:id/newcomment', :controller => 'diary_entry', :action => 'comment', :id => /\d+/
|
match '/user/:display_name/diary/:id/newcomment' => 'diary_entry#comment', :id => /\d+/
|
||||||
map.connect '/user/:display_name/diary/:id/edit', :controller => 'diary_entry', :action => 'edit', :id => /\d+/
|
match '/user/:display_name/diary/:id/edit' => 'diary_entry#edit', :id => /\d+/
|
||||||
map.connect '/user/:display_name/diary/:id/hide', :controller => 'diary_entry', :action => 'hide', :id => /\d+/
|
match '/user/:display_name/diary/:id/hide' => 'diary_entry#hide', :id => /\d+/
|
||||||
map.connect '/user/:display_name/diary/:id/hidecomment/:comment', :controller => 'diary_entry', :action => 'hidecomment', :id => /\d+/, :comment => /\d+/
|
match '/user/:display_name/diary/:id/hidecomment/:comment' => 'diary_entry#hidecomment', :id => /\d+/, :comment => /\d+/
|
||||||
|
|
||||||
# user pages
|
# user pages
|
||||||
map.connect '/user/:display_name', :controller => 'user', :action => 'view'
|
match '/user/:display_name' => 'user#view'
|
||||||
map.connect '/user/:display_name/make_friend', :controller => 'user', :action => 'make_friend'
|
match '/user/:display_name/make_friend' => 'user#make_friend'
|
||||||
map.connect '/user/:display_name/remove_friend', :controller => 'user', :action => 'remove_friend'
|
match '/user/:display_name/remove_friend' => 'user#remove_friend'
|
||||||
map.connect '/user/:display_name/account', :controller => 'user', :action => 'account'
|
match '/user/:display_name/account' => 'user#account'
|
||||||
map.connect '/user/:display_name/set_status', :controller => 'user', :action => 'set_status'
|
match '/user/:display_name/set_status' => 'user#set_status'
|
||||||
map.connect '/user/:display_name/delete', :controller => 'user', :action => 'delete'
|
match '/user/:display_name/delete' => 'user#delete'
|
||||||
|
|
||||||
# user lists
|
# user lists
|
||||||
map.connect '/users', :controller => 'user', :action => 'list'
|
match '/users' => 'user#list'
|
||||||
map.connect '/users/:status', :controller => 'user', :action => 'list'
|
match '/users/:status' => 'user#list'
|
||||||
|
|
||||||
# test pages
|
# test pages
|
||||||
map.connect '/test/populate/:table/:from/:count', :controller => 'test', :action => 'populate'
|
match '/test/populate/:table/:from/:count' => 'test#populate'
|
||||||
map.connect '/test/populate/:table/:count', :controller => 'test', :action => 'populate', :from => 1
|
match '/test/populate/:table/:count' => 'test#populate', :from => 1
|
||||||
|
|
||||||
# geocoder
|
# geocoder
|
||||||
map.connect '/geocoder/search', :controller => 'geocoder', :action => 'search'
|
match '/geocoder/search' => 'geocoder#search'
|
||||||
map.connect '/geocoder/search_latlon', :controller => 'geocoder', :action => 'search_latlon'
|
match '/geocoder/search_latlon' => 'geocoder#search_latlon'
|
||||||
map.connect '/geocoder/search_us_postcode', :controller => 'geocoder', :action => 'search_us_postcode'
|
match '/geocoder/search_us_postcode' => 'geocoder#search_us_postcode'
|
||||||
map.connect '/geocoder/search_uk_postcode', :controller => 'geocoder', :action => 'search_uk_postcode'
|
match '/geocoder/search_uk_postcode' => 'geocoder#search_uk_postcode'
|
||||||
map.connect '/geocoder/search_ca_postcode', :controller => 'geocoder', :action => 'search_ca_postcode'
|
match '/geocoder/search_ca_postcode' => 'geocoder#search_ca_postcode'
|
||||||
map.connect '/geocoder/search_osm_namefinder', :controller => 'geocoder', :action => 'search_osm_namefinder'
|
match '/geocoder/search_osm_namefinder' => 'geocoder#search_osm_namefinder'
|
||||||
map.connect '/geocoder/search_osm_nominatim', :controller => 'geocoder', :action => 'search_osm_nominatim'
|
match '/geocoder/search_osm_nominatim' => 'geocoder#search_osm_nominatim'
|
||||||
map.connect '/geocoder/search_geonames', :controller => 'geocoder', :action => 'search_geonames'
|
match '/geocoder/search_geonames' => 'geocoder#search_geonames'
|
||||||
map.connect '/geocoder/description', :controller => 'geocoder', :action => 'description'
|
match '/geocoder/description' => 'geocoder#description'
|
||||||
map.connect '/geocoder/description_osm_namefinder', :controller => 'geocoder', :action => 'description_osm_namefinder'
|
match '/geocoder/description_osm_namefinder' => 'geocoder#description_osm_namefinder'
|
||||||
map.connect '/geocoder/description_osm_nominatim', :controller => 'geocoder', :action => 'description_osm_nominatim'
|
match '/geocoder/description_osm_nominatim' => 'geocoder#description_osm_nominatim'
|
||||||
map.connect '/geocoder/description_geonames', :controller => 'geocoder', :action => 'description_geonames'
|
match '/geocoder/description_geonames' => 'geocoder#description_geonames'
|
||||||
|
|
||||||
# export
|
# export
|
||||||
map.connect '/export/start', :controller => 'export', :action => 'start'
|
match '/export/start' => 'export#start'
|
||||||
map.connect '/export/finish', :controller => 'export', :action => 'finish'
|
match '/export/finish' => 'export#finish'
|
||||||
|
|
||||||
# messages
|
# messages
|
||||||
map.connect '/user/:display_name/inbox', :controller => 'message', :action => 'inbox'
|
match '/user/:display_name/inbox' => 'message#inbox'
|
||||||
map.connect '/user/:display_name/outbox', :controller => 'message', :action => 'outbox'
|
match '/user/:display_name/outbox' => 'message#outbox'
|
||||||
map.connect '/message/new/:display_name', :controller => 'message', :action => 'new'
|
match '/message/new/:display_name' => 'message#new'
|
||||||
map.connect '/message/read/:message_id', :controller => 'message', :action => 'read'
|
match '/message/read/:message_id' => 'message#read'
|
||||||
map.connect '/message/mark/:message_id', :controller => 'message', :action => 'mark'
|
match '/message/mark/:message_id' => 'message#mark'
|
||||||
map.connect '/message/reply/:message_id', :controller => 'message', :action => 'reply'
|
match '/message/reply/:message_id' => 'message#reply'
|
||||||
map.connect '/message/delete/:message_id', :controller => 'message', :action => 'delete'
|
match '/message/delete/:message_id' => 'message#delete'
|
||||||
|
|
||||||
# oauth admin pages (i.e: for setting up new clients, etc...)
|
# oauth admin pages (i.e: for setting up new clients, etc...)
|
||||||
map.resources :oauth_clients, :path_prefix => '/user/:display_name'
|
scope "/user/:display_name" do
|
||||||
map.connect '/oauth/revoke', :controller => 'oauth', :action => 'revoke'
|
resources :oauth_clients
|
||||||
map.authorize '/oauth/authorize', :controller => 'oauth', :action => 'oauthorize'
|
end
|
||||||
map.request_token '/oauth/request_token', :controller => 'oauth', :action => 'request_token'
|
match '/oauth/revoke' => 'oauth#revoke'
|
||||||
map.access_token '/oauth/access_token', :controller => 'oauth', :action => 'access_token'
|
match '/oauth/authorize' => 'oauth#oauthorize', :as => :authorize
|
||||||
map.test_request '/oauth/test_request', :controller => 'oauth', :action => 'test_request'
|
match '/oauth/request_token' => 'oauth#request_token', :as => :request_token
|
||||||
|
match '/oauth/access_token' => 'oauth#access_token', :as => :access_token
|
||||||
|
match '/oauth/test_request' => 'oauth#test_request', :as => :test_request
|
||||||
|
|
||||||
# roles and banning pages
|
# roles and banning pages
|
||||||
map.connect '/user/:display_name/role/:role/grant', :controller => 'user_roles', :action => 'grant'
|
match '/user/:display_name/role/:role/grant' => 'user_roles#grant'
|
||||||
map.connect '/user/:display_name/role/:role/revoke', :controller => 'user_roles', :action => 'revoke'
|
match '/user/:display_name/role/:role/revoke' => 'user_roles#revoke'
|
||||||
map.connect '/user/:display_name/blocks', :controller => 'user_blocks', :action => 'blocks_on'
|
match '/user/:display_name/blocks' => 'user_blocks#blocks_on'
|
||||||
map.connect '/user/:display_name/blocks_by', :controller => 'user_blocks', :action => 'blocks_by'
|
match '/user/:display_name/blocks_by' => 'user_blocks#blocks_by'
|
||||||
map.connect '/blocks/new/:display_name', :controller => 'user_blocks', :action => 'new'
|
match '/blocks/new/:display_name' => 'user_blocks#new'
|
||||||
map.resources :user_blocks, :as => 'blocks'
|
resources :user_blocks
|
||||||
map.connect '/blocks/:id/revoke', :controller => 'user_blocks', :action => 'revoke'
|
match '/blocks/:id/revoke' => 'user_blocks#revoke'
|
||||||
|
|
||||||
# fall through
|
# fall through
|
||||||
map.connect ':controller/:id/:action'
|
match ':controller/:id/:action' => '#index'
|
||||||
map.connect ':controller/:action'
|
match ':controller/:action' => '#index'
|
||||||
end
|
end
|
||||||
|
|
7
db/seeds.rb
Normal file
7
db/seeds.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# This file should contain all the record creation needed to seed the database with its default values.
|
||||||
|
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||||
|
#
|
||||||
|
# Examples:
|
||||||
|
#
|
||||||
|
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
||||||
|
# Mayor.create(:name => 'Daley', :city => cities.first)
|
8
public/javascripts/controls.js
vendored
8
public/javascripts/controls.js
vendored
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
// script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
|
||||||
// (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
|
|
||||||
// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com)
|
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||||
|
// (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
|
||||||
|
// (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
|
||||||
// Contributors:
|
// Contributors:
|
||||||
// Richard Livsey
|
// Richard Livsey
|
||||||
// Rahul Bhargava
|
// Rahul Bhargava
|
||||||
|
|
13
public/javascripts/dragdrop.js
vendored
13
public/javascripts/dragdrop.js
vendored
|
@ -1,5 +1,6 @@
|
||||||
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
// script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
|
||||||
// (c) 2005-2008 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
|
|
||||||
|
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||||
//
|
//
|
||||||
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
||||||
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
||||||
|
@ -311,7 +312,7 @@ var Draggable = Class.create({
|
||||||
tag_name=='TEXTAREA')) return;
|
tag_name=='TEXTAREA')) return;
|
||||||
|
|
||||||
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
var pointer = [Event.pointerX(event), Event.pointerY(event)];
|
||||||
var pos = Position.cumulativeOffset(this.element);
|
var pos = this.element.cumulativeOffset();
|
||||||
this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
|
this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
|
||||||
|
|
||||||
Draggables.activate(this);
|
Draggables.activate(this);
|
||||||
|
@ -454,7 +455,7 @@ var Draggable = Class.create({
|
||||||
},
|
},
|
||||||
|
|
||||||
draw: function(point) {
|
draw: function(point) {
|
||||||
var pos = Position.cumulativeOffset(this.element);
|
var pos = this.element.cumulativeOffset();
|
||||||
if(this.options.ghosting) {
|
if(this.options.ghosting) {
|
||||||
var r = Position.realOffset(this.element);
|
var r = Position.realOffset(this.element);
|
||||||
pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
|
pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
|
||||||
|
@ -730,7 +731,7 @@ var Sortable = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// keep reference
|
// keep reference
|
||||||
this.sortables[element.id] = options;
|
this.sortables[element.identify()] = options;
|
||||||
|
|
||||||
// for onupdate
|
// for onupdate
|
||||||
Draggables.addObserver(new SortableObserver(element, options.onUpdate));
|
Draggables.addObserver(new SortableObserver(element, options.onUpdate));
|
||||||
|
@ -825,7 +826,7 @@ var Sortable = {
|
||||||
hide().addClassName('dropmarker').setStyle({position:'absolute'});
|
hide().addClassName('dropmarker').setStyle({position:'absolute'});
|
||||||
document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
|
document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
|
||||||
}
|
}
|
||||||
var offsets = Position.cumulativeOffset(dropon);
|
var offsets = dropon.cumulativeOffset();
|
||||||
Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
|
Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
|
||||||
|
|
||||||
if(position=='after')
|
if(position=='after')
|
||||||
|
|
19
public/javascripts/effects.js
vendored
19
public/javascripts/effects.js
vendored
|
@ -1,4 +1,6 @@
|
||||||
// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
|
||||||
|
|
||||||
|
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||||
// Contributors:
|
// Contributors:
|
||||||
// Justin Palmer (http://encytemedia.com/)
|
// Justin Palmer (http://encytemedia.com/)
|
||||||
// Mark Pilgrim (http://diveintomark.org/)
|
// Mark Pilgrim (http://diveintomark.org/)
|
||||||
|
@ -145,14 +147,13 @@ var Effect = {
|
||||||
'blind': ['BlindDown','BlindUp'],
|
'blind': ['BlindDown','BlindUp'],
|
||||||
'appear': ['Appear','Fade']
|
'appear': ['Appear','Fade']
|
||||||
},
|
},
|
||||||
toggle: function(element, effect) {
|
toggle: function(element, effect, options) {
|
||||||
element = $(element);
|
element = $(element);
|
||||||
effect = (effect || 'appear').toLowerCase();
|
effect = (effect || 'appear').toLowerCase();
|
||||||
var options = Object.extend({
|
|
||||||
|
return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({
|
||||||
queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
|
queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
|
||||||
}, arguments[2] || { });
|
}, options || {}));
|
||||||
Effect[element.visible() ?
|
|
||||||
Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -228,12 +229,6 @@ Effect.Queue = Effect.Queues.get('global');
|
||||||
Effect.Base = Class.create({
|
Effect.Base = Class.create({
|
||||||
position: null,
|
position: null,
|
||||||
start: function(options) {
|
start: function(options) {
|
||||||
function codeForEvent(options,eventName){
|
|
||||||
return (
|
|
||||||
(options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
|
|
||||||
(options[eventName] ? 'this.options.'+eventName+'(this);' : '')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (options && options.transition === false) options.transition = Effect.Transitions.linear;
|
if (options && options.transition === false) options.transition = Effect.Transitions.linear;
|
||||||
this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
|
this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
|
||||||
this.currentFrame = 0;
|
this.currentFrame = 0;
|
||||||
|
|
5185
public/javascripts/prototype.js
vendored
5185
public/javascripts/prototype.js
vendored
File diff suppressed because it is too large
Load diff
175
public/javascripts/rails.js
Normal file
175
public/javascripts/rails.js
Normal file
|
@ -0,0 +1,175 @@
|
||||||
|
(function() {
|
||||||
|
// Technique from Juriy Zaytsev
|
||||||
|
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
|
||||||
|
function isEventSupported(eventName) {
|
||||||
|
var el = document.createElement('div');
|
||||||
|
eventName = 'on' + eventName;
|
||||||
|
var isSupported = (eventName in el);
|
||||||
|
if (!isSupported) {
|
||||||
|
el.setAttribute(eventName, 'return;');
|
||||||
|
isSupported = typeof el[eventName] == 'function';
|
||||||
|
}
|
||||||
|
el = null;
|
||||||
|
return isSupported;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isForm(element) {
|
||||||
|
return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM'
|
||||||
|
}
|
||||||
|
|
||||||
|
function isInput(element) {
|
||||||
|
if (Object.isElement(element)) {
|
||||||
|
var name = element.nodeName.toUpperCase()
|
||||||
|
return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA'
|
||||||
|
}
|
||||||
|
else return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var submitBubbles = isEventSupported('submit'),
|
||||||
|
changeBubbles = isEventSupported('change')
|
||||||
|
|
||||||
|
if (!submitBubbles || !changeBubbles) {
|
||||||
|
// augment the Event.Handler class to observe custom events when needed
|
||||||
|
Event.Handler.prototype.initialize = Event.Handler.prototype.initialize.wrap(
|
||||||
|
function(init, element, eventName, selector, callback) {
|
||||||
|
init(element, eventName, selector, callback)
|
||||||
|
// is the handler being attached to an element that doesn't support this event?
|
||||||
|
if ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) ||
|
||||||
|
(!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) {
|
||||||
|
// "submit" => "emulated:submit"
|
||||||
|
this.eventName = 'emulated:' + this.eventName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!submitBubbles) {
|
||||||
|
// discover forms on the page by observing focus events which always bubble
|
||||||
|
document.on('focusin', 'form', function(focusEvent, form) {
|
||||||
|
// special handler for the real "submit" event (one-time operation)
|
||||||
|
if (!form.retrieve('emulated:submit')) {
|
||||||
|
form.on('submit', function(submitEvent) {
|
||||||
|
var emulated = form.fire('emulated:submit', submitEvent, true)
|
||||||
|
// if custom event received preventDefault, cancel the real one too
|
||||||
|
if (emulated.returnValue === false) submitEvent.preventDefault()
|
||||||
|
})
|
||||||
|
form.store('emulated:submit', true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!changeBubbles) {
|
||||||
|
// discover form inputs on the page
|
||||||
|
document.on('focusin', 'input, select, texarea', function(focusEvent, input) {
|
||||||
|
// special handler for real "change" events
|
||||||
|
if (!input.retrieve('emulated:change')) {
|
||||||
|
input.on('change', function(changeEvent) {
|
||||||
|
input.fire('emulated:change', changeEvent, true)
|
||||||
|
})
|
||||||
|
input.store('emulated:change', true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRemote(element) {
|
||||||
|
var method, url, params;
|
||||||
|
|
||||||
|
var event = element.fire("ajax:before");
|
||||||
|
if (event.stopped) return false;
|
||||||
|
|
||||||
|
if (element.tagName.toLowerCase() === 'form') {
|
||||||
|
method = element.readAttribute('method') || 'post';
|
||||||
|
url = element.readAttribute('action');
|
||||||
|
params = element.serialize();
|
||||||
|
} else {
|
||||||
|
method = element.readAttribute('data-method') || 'get';
|
||||||
|
url = element.readAttribute('href');
|
||||||
|
params = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
new Ajax.Request(url, {
|
||||||
|
method: method,
|
||||||
|
parameters: params,
|
||||||
|
evalScripts: true,
|
||||||
|
|
||||||
|
onComplete: function(request) { element.fire("ajax:complete", request); },
|
||||||
|
onSuccess: function(request) { element.fire("ajax:success", request); },
|
||||||
|
onFailure: function(request) { element.fire("ajax:failure", request); }
|
||||||
|
});
|
||||||
|
|
||||||
|
element.fire("ajax:after");
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMethod(element) {
|
||||||
|
var method = element.readAttribute('data-method'),
|
||||||
|
url = element.readAttribute('href'),
|
||||||
|
csrf_param = $$('meta[name=csrf-param]')[0],
|
||||||
|
csrf_token = $$('meta[name=csrf-token]')[0];
|
||||||
|
|
||||||
|
var form = new Element('form', { method: "POST", action: url, style: "display: none;" });
|
||||||
|
element.parentNode.insert(form);
|
||||||
|
|
||||||
|
if (method !== 'post') {
|
||||||
|
var field = new Element('input', { type: 'hidden', name: '_method', value: method });
|
||||||
|
form.insert(field);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (csrf_param) {
|
||||||
|
var param = csrf_param.readAttribute('content'),
|
||||||
|
token = csrf_token.readAttribute('content'),
|
||||||
|
field = new Element('input', { type: 'hidden', name: param, value: token });
|
||||||
|
form.insert(field);
|
||||||
|
}
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
document.on("click", "*[data-confirm]", function(event, element) {
|
||||||
|
var message = element.readAttribute('data-confirm');
|
||||||
|
if (!confirm(message)) event.stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.on("click", "a[data-remote]", function(event, element) {
|
||||||
|
if (event.stopped) return;
|
||||||
|
handleRemote(element);
|
||||||
|
event.stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.on("click", "a[data-method]", function(event, element) {
|
||||||
|
if (event.stopped) return;
|
||||||
|
handleMethod(element);
|
||||||
|
event.stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.on("submit", function(event) {
|
||||||
|
var element = event.findElement(),
|
||||||
|
message = element.readAttribute('data-confirm');
|
||||||
|
if (message && !confirm(message)) {
|
||||||
|
event.stop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var inputs = element.select("input[type=submit][data-disable-with]");
|
||||||
|
inputs.each(function(input) {
|
||||||
|
input.disabled = true;
|
||||||
|
input.writeAttribute('data-original-value', input.value);
|
||||||
|
input.value = input.readAttribute('data-disable-with');
|
||||||
|
});
|
||||||
|
|
||||||
|
var element = event.findElement("form[data-remote]");
|
||||||
|
if (element) {
|
||||||
|
handleRemote(element);
|
||||||
|
event.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.on("ajax:after", "form", function(event, element) {
|
||||||
|
var inputs = element.select("input[type=submit][disabled=true][data-disable-with]");
|
||||||
|
inputs.each(function(input) {
|
||||||
|
input.value = input.readAttribute('data-original-value');
|
||||||
|
input.removeAttribute('data-original-value');
|
||||||
|
input.disabled = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
require File.expand_path('../../config/boot', __FILE__)
|
|
||||||
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
|
|
||||||
require 'commands/about'
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
require File.expand_path('../../config/boot', __FILE__)
|
|
||||||
require 'commands/console'
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
require File.expand_path('../../config/boot', __FILE__)
|
|
||||||
require 'commands/dbconsole'
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
require File.expand_path('../../config/boot', __FILE__)
|
|
||||||
require 'commands/destroy'
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
require File.expand_path('../../config/boot', __FILE__)
|
|
||||||
require 'commands/generate'
|
|
0
script/locale/merge-from-translatewiki
Normal file → Executable file
0
script/locale/merge-from-translatewiki
Normal file → Executable file
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
require File.expand_path('../../../config/boot', __FILE__)
|
|
||||||
require 'commands/performance/benchmarker'
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
require File.expand_path('../../../config/boot', __FILE__)
|
|
||||||
require 'commands/performance/profiler'
|
|
6
script/rails
Executable file
6
script/rails
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||||
|
|
||||||
|
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||||
|
require File.expand_path('../../config/boot', __FILE__)
|
||||||
|
require 'rails/commands'
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
require File.expand_path('../../config/boot', __FILE__)
|
|
||||||
require 'commands/runner'
|
|
|
@ -1,3 +0,0 @@
|
||||||
#!/usr/bin/env ruby
|
|
||||||
require File.expand_path('../../config/boot', __FILE__)
|
|
||||||
require 'commands/server'
|
|
9
test/performance/browsing_test.rb
Normal file
9
test/performance/browsing_test.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
require 'test_helper'
|
||||||
|
require 'rails/performance_test_help'
|
||||||
|
|
||||||
|
# Profiling results for each test method are written to tmp/performance.
|
||||||
|
class BrowsingTest < ActionDispatch::PerformanceTest
|
||||||
|
def test_homepage
|
||||||
|
get '/'
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,6 +1,6 @@
|
||||||
ENV["RAILS_ENV"] = "test"
|
ENV["RAILS_ENV"] = "test"
|
||||||
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
require File.expand_path('../../config/environment', __FILE__)
|
||||||
require 'test_help'
|
require 'rails/test_help'
|
||||||
load 'composite_primary_keys/fixtures.rb'
|
load 'composite_primary_keys/fixtures.rb'
|
||||||
|
|
||||||
# This monkey patch is to make tests where a rack module alters
|
# This monkey patch is to make tests where a rack module alters
|
||||||
|
@ -41,28 +41,6 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
class ActiveSupport::TestCase
|
class ActiveSupport::TestCase
|
||||||
# Transactional fixtures accelerate your tests by wrapping each test method
|
|
||||||
# in a transaction that's rolled back on completion. This ensures that the
|
|
||||||
# test database remains unchanged so your fixtures don't have to be reloaded
|
|
||||||
# between every test method. Fewer database queries means faster tests.
|
|
||||||
#
|
|
||||||
# Read Mike Clark's excellent walkthrough at
|
|
||||||
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
|
||||||
#
|
|
||||||
# Every Active Record database supports transactions except MyISAM tables
|
|
||||||
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
|
||||||
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
|
||||||
# is recommended.
|
|
||||||
self.use_transactional_fixtures = false
|
|
||||||
|
|
||||||
# Instantiated fixtures are slow, but give you @david where otherwise you
|
|
||||||
# would need people(:david). If you don't want to migrate your existing
|
|
||||||
# test cases which use the @david style and don't mind the speed hit (each
|
|
||||||
# instantiated fixtures translates to a database query per test method),
|
|
||||||
# then set this back to true.
|
|
||||||
self.use_instantiated_fixtures = false
|
|
||||||
|
|
||||||
|
|
||||||
# Load standard fixtures needed to test API methods
|
# Load standard fixtures needed to test API methods
|
||||||
def self.api_fixtures
|
def self.api_fixtures
|
||||||
#print "setting up the api_fixtures"
|
#print "setting up the api_fixtures"
|
||||||
|
|
Loading…
Add table
Reference in a new issue