Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

switch to Rails 3.0.0.beta3; bump all gems

  • Loading branch information...
commit bff5cb58f933bfeb00931cf13acd2f37a668593d 1 parent b7890b8
@mislav authored
Showing with 348 additions and 377 deletions.
  1. +3 −2 .gitignore
  2. +12 −0 Gemfile
  3. +2 −2 Rakefile
  4. +1 −8 app/controllers/application_controller.rb
  5. +0 −1  app/helpers/application_helper.rb
  6. +1 −1  app/helpers/movies_helper.rb
  7. +4 −0 config.ru
  8. +55 −0 config/application.rb
  9. +6 −109 config/boot.rb
  10. +4 −52 config/environment.rb
  11. +15 −13 config/environments/development.rb
  12. +25 −20 config/environments/production.rb
  13. +23 −22 config/environments/test.rb
  14. +2 −2 config/initializers/backtrace_silencers.rb
  15. +7 −0 config/initializers/cookie_verification_secret.rb
  16. +2 −2 config/initializers/session_store.rb
  17. +1 −1  config/locales/en.yml
  18. +45 −28 config/routes.rb
  19. +7 −0 db/seeds.rb
  20. 0  lib/tasks/.gitkeep
  21. +15 −19 public/404.html
  22. +15 −19 public/422.html
  23. +14 −18 public/500.html
  24. +77 −0 public/javascripts/rails.js
  25. +0 −4 script/about
  26. +0 −3  script/console
  27. +0 −3  script/dbconsole
  28. +0 −3  script/destroy
  29. +0 −3  script/generate
  30. +0 −3  script/performance/benchmarker
  31. +0 −3  script/performance/profiler
  32. +0 −3  script/plugin
  33. +10 −0 script/rails
  34. +0 −3  script/runner
  35. +0 −3  script/server
  36. +1 −1  test/performance/browsing_test.rb
  37. +1 −26 test/test_helper.rb
  38. 0  vendor/plugins/.gitkeep
View
5 .gitignore
@@ -1,5 +1,6 @@
-log
-tmp
+.bundle
db/*.sqlite3
config/settings.yml
.idea
+log/*.log
+tmp
View
12 Gemfile
@@ -0,0 +1,12 @@
+git 'git://github.com/rails/rails.git'
+source :gemcutter
+
+gem 'rails', '3.0.0.beta3'
+
+gem 'mongo_mapper', '~> 0.7.4'
+gem 'mongo_ext', '0.19.3', :require => nil
+gem 'nokogiri', '~> 1.4.1'
+gem 'hashie', '~> 0.2.0'
+gem 'oauth', '~> 0.4.0', :require => nil
+gem 'twitter-login', '~> 0.2.2', :require => 'twitter/login'
+gem 'will_paginate', '3.0.pre'
View
4 Rakefile
@@ -1,10 +1,10 @@
# 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.
-require(File.join(File.dirname(__FILE__), 'config', 'boot'))
+require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
-require 'tasks/rails'
+Rails::Application.load_tasks
View
9 app/controllers/application_controller.rb
@@ -1,12 +1,5 @@
-# Filters added to this controller apply to all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
-
class ApplicationController < ActionController::Base
- helper :all # include all helpers, all the time
- protect_from_forgery # See ActionController::RequestForgeryProtection for details
-
- # Scrub sensitive parameters from your log
- filter_parameter_logging :password
+ protect_from_forgery
include Twitter::Login::Helpers
View
1  app/helpers/application_helper.rb
@@ -1,3 +1,2 @@
-# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
View
2  app/helpers/movies_helper.rb
@@ -5,7 +5,7 @@ def link_to_movie(movie)
def title_for_movie(movie)
if movie.original_title
- "<i>#{movie.original_title}</i> / #{movie.title.titleize}"
+ ("<i>%s</i> / %s" % [h(movie.original_title), h(movie.title.titleize)]).html_safe
else
movie.title.titleize
end
View
4 config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Movies::Application
View
55 config/application.rb
@@ -0,0 +1,55 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'active_model/railtie'
+require 'action_controller/railtie'
+require 'action_view/railtie'
+
+# Auto-require default libraries and those for the current Rails environment.
+Bundler.require :default, Rails.env
+
+require 'erb'
+settings = ERB.new(IO.read(File.expand_path('../settings.yml', __FILE__))).result
+$settings = Hashie::Mash.new YAML::load(settings)[Rails.env.to_s]
+
+module Movies
+ 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.
+
+ # Add additional load paths for your own custom dirs
+ # config.load_paths += %W( #{config.root}/extras )
+
+ # 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 = :cacher, :garbage_collector, :forum_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}')]
+ # config.i18n.default_locale = :de
+
+ # Configure generators values. Many other options are available, be sure to check the documentation.
+ # config.generators do |g|
+ # g.orm :active_record
+ # g.template_engine :erb
+ # g.test_framework :test_unit, :fixture => true
+ # end
+
+ config.after_initialize do
+ MongoMapper.database = $settings.mongodb.database
+ end
+
+ config.middleware.use Twitter::Login,
+ :consumer_key => $settings.twitter.consumer_key, :secret => $settings.twitter.secret
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters << :password
+ end
+end
View
115 config/boot.rb
@@ -1,110 +1,7 @@
-# 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.2'
- 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
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
- exit 1
- end
-
- def parse_gem_version(text)
- $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
- end
-
- private
- def read_environment_rb
- File.read("#{RAILS_ROOT}/config/environment.rb")
- end
- end
- end
+begin
+ require File.expand_path('../../.bundle/environment', __FILE__)
+rescue LoadError
+ require 'rubygems'
+ require 'bundler'
+ Bundler.setup
end
-
-# All that for this:
-Rails.boot!
View
56 config/environment.rb
@@ -1,53 +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
-RAILS_GEM_VERSION = '~> 2.3.5' unless defined? RAILS_GEM_VERSION
-
-# 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 )
-
- config.gem 'will_paginate', :version => '~> 2.3.11'
- config.gem 'mongo_mapper', :version => '~> 0.6.8'
- config.gem 'nokogiri', :version => '~> 1.4.1'
- config.gem 'hashie', :version => '~> 0.1.5'
- config.gem 'oauth', :version => '~> 0.3.6'
- config.gem 'twitter-login', :version => '~> 0.2.0', :lib => 'twitter/login'
-
- # 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.
- config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
-
- # Activate observers that should always be running
- # config.active_record.observers = :cacher, :garbage_collector, :forum_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
-
- config.after_initialize do
- require 'erb'
- settings = ERB.new(IO.read(Rails.root + 'config/settings.yml')).result
- $settings = Hashie::Mash.new YAML::load(settings)[Rails.env.to_s]
-
- MongoMapper.database = $settings.mongodb.database
-
- config.middleware.use Twitter::Login,
- :consumer_key => $settings.twitter.consumer_key, :secret => $settings.twitter.secret
- end
-end
+# Initialize the rails application
+Movies::Application.initialize!
View
28 config/environments/development.rb
@@ -1,17 +1,19 @@
-# Settings specified here will take precedence over those in config/environment.rb
+Movies::Application.configure do
+ # Settings specified here will take precedence over those in config/environment.rb
-# In the development environment your application's code is reloaded on
-# every request. This slows down response time but is perfect for development
-# since you don't have to restart the webserver when you make code changes.
-config.cache_classes = false
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the webserver when you make code changes.
+ config.cache_classes = false
-# Log error messages when you accidentally call methods on nil.
-config.whiny_nils = true
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
-# Show full error reports and disable caching
-config.action_controller.consider_all_requests_local = true
-config.action_view.debug_rjs = true
-config.action_controller.perform_caching = false
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_view.debug_rjs = true
+ config.action_controller.perform_caching = false
-# Don't care if the mailer can't send
-config.action_mailer.raise_delivery_errors = false
+ # Don't care if the mailer can't send
+ # config.action_mailer.raise_delivery_errors = false
+end
View
45 config/environments/production.rb
@@ -1,28 +1,33 @@
-# Settings specified here will take precedence over those in config/environment.rb
+Movies::Application.configure do
+ # Settings specified here will take precedence over those in config/environment.rb
-# The production environment is meant for finished, "live" apps.
-# Code is not reloaded between requests
-config.cache_classes = true
+ # The production environment is meant for finished, "live" apps.
+ # Code is not reloaded between requests
+ config.cache_classes = true
-# Full error reports are disabled and caching is turned on
-config.action_controller.consider_all_requests_local = false
-config.action_controller.perform_caching = true
-config.action_view.cache_template_loading = true
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
-# See everything in the log (default is :info)
-# config.log_level = :debug
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
-# Use a different logger for distributed setups
-# config.logger = SyslogLogger.new
+ # Use a different logger for distributed setups
+ # config.logger = SyslogLogger.new
-# Use a different cache store in production
-# config.cache_store = :mem_cache_store
+ # Use a different cache store in production
+ # config.cache_store = :mem_cache_store
-# Enable serving of images, stylesheets, and javascripts from an asset server
-# config.action_controller.asset_host = "http://assets.example.com"
+ # Disable Rails's static asset server
+ # In production, Apache or nginx will already do this
+ config.serve_static_assets = false
-# Disable delivery errors, bad email addresses will be ignored
-# config.action_mailer.raise_delivery_errors = false
+ # Enable serving of images, stylesheets, and javascripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
-# Enable threaded mode
-# config.threadsafe!
+ # Disable delivery errors, bad email addresses will be ignored
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable threaded mode
+ # config.threadsafe!
+end
View
45 config/environments/test.rb
@@ -1,28 +1,29 @@
-# Settings specified here will take precedence over those in config/environment.rb
+Movies::Application.configure do
+ # Settings specified here will take precedence over those in config/environment.rb
-# The test environment is used exclusively to run your application's
-# test suite. You never need to work with it otherwise. Remember that
-# your test database is "scratch space" for the test suite and is wiped
-# and recreated between test runs. Don't rely on the data there!
-config.cache_classes = true
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
-# Log error messages when you accidentally call methods on nil.
-config.whiny_nils = true
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
-# Show full error reports and disable caching
-config.action_controller.consider_all_requests_local = true
-config.action_controller.perform_caching = false
-config.action_view.cache_template_loading = true
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
-# Disable request forgery protection in test environment
-config.action_controller.allow_forgery_protection = false
+ # Disable request forgery protection in test environment
+ config.action_controller.allow_forgery_protection = false
-# Tell Action Mailer not to deliver emails to the real world.
-# The :test delivery method accumulates sent emails in the
-# ActionMailer::Base.deliveries array.
-config.action_mailer.delivery_method = :test
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ # config.action_mailer.delivery_method = :test
-# 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
+ # 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
View
4 config/initializers/backtrace_silencers.rb
@@ -3,5 +3,5 @@
# 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/ }
-# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
-# Rails.backtrace_cleaner.remove_silencers!
+# 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!
View
7 config/initializers/cookie_verification_secret.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies 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.cookie_verifier_secret = 'cc19a053086aebefc77631ea7c161c414a21aa6f99942a090b5a9375500ffad149939e4948cb76f7fbe6a0ea38fb3a6747a75d0b83c4056490e5f65bc0e8ac3c'
View
4 config/initializers/session_store.rb
@@ -5,8 +5,8 @@
# 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 => '_movieproject_session',
- :secret => 'e57280c1957d11754d591b9eb6bc78f1ed3ff14e8c7bbc59cc274c1267e5c1360fd8a19d171f101ae76c667f88cbd7dad4ddd0dd2a91e761ad5a3a3f10d5ea2f'
+ :key => '_movies_session',
+ :secret => 'd485de517da9dbdf772fa01f0c28ae4a3efeca8ab3d9f39763619eb6fe8b8314ac395dd06e42ae54eabe946479c947338b862556b88348fccdbec826cca53b1f'
}
# Use the database for sessions instead of the cookie-based default,
View
2  config/locales/en.yml
@@ -2,4 +2,4 @@
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
- hello: "Hello world"
+ hello: "Hello world"
View
73 config/routes.rb
@@ -1,50 +1,67 @@
-ActionController::Routing::Routes.draw do |map|
-
- map.add_to_watch '/movies/towatch', :controller => 'movies', :action => 'add_to_watch'
- map.to_watch '/user/:username', :controller => 'movies', :action => 'to_watch'
- map.resources :movies
-
- map.logout 'logout', :controller => 'sessions', :action => 'logout'
-
- # The priority is based upon order of creation: first created -> highest priority.
+Movies::Application.routes.draw do |map|
+
+ match 'movies/towatch' => 'movies#add_to_watch', :as => :add_to_watch
+ match 'user/:username' => 'movies#to_watch', :as => :to_watch
+ resources :movies
+
+ match 'logout' => 'sessions#logout', :as => :logout
+
+ root :to => "movies#index"
+
+ # The priority is based upon order of creation:
+ # first created -> highest priority.
# Sample of regular route:
- # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
+ # match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
- # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
- # map.resources :products
+ # resources :products
# Sample resource route with options:
- # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
+ # resources :products do
+ # member do
+ # get :short
+ # post :toggle
+ # end
+ #
+ # collection do
+ # get :sold
+ # end
+ # end
# Sample resource route with sub-resources:
- # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
-
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
# Sample resource route with more complex sub-resources
- # map.resources :products do |products|
- # products.resources :comments
- # products.resources :sales, :collection => { :recent => :get }
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get :recent, :on => :collection
+ # end
# end
# Sample resource route within a namespace:
- # map.namespace :admin do |admin|
- # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
- # admin.resources :products
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
# end
- # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
- map.root :controller => 'movies'
+ # You can have the root of your site routed with "root"
+ # just remember to delete public/index.html.
+ # root :to => "welcome#index"
# See how all your routes lay out with "rake routes"
- # Install the default routes as the lowest priority.
- # Note: These default routes make all actions in every controller accessible via GET requests. You should
- # consider removing the them or commenting them out if you're using named routes and resources.
- map.connect ':controller/:action/:id'
- map.connect ':controller/:action/:id.:format'
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
+ # Note: This route will make all actions in every controller accessible via GET requests.
+ # match ':controller(/:action(/:id(.:format)))'
end
View
7 db/seeds.rb
@@ -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)
View
0  lib/tasks/.gitkeep
No changes.
View
34 public/404.html
@@ -1,23 +1,19 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
+<!DOCTYPE html>
+<html>
<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>The page you were looking for doesn't exist (404)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
- </style>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
</head>
<body>
@@ -27,4 +23,4 @@
<p>You may have mistyped the address or the page may have moved.</p>
</div>
</body>
-</html>
+</html>
View
34 public/422.html
@@ -1,23 +1,19 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
+<!DOCTYPE html>
+<html>
<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>The change you wanted was rejected (422)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
- </style>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
</head>
<body>
@@ -27,4 +23,4 @@
<p>Maybe you tried to change something you didn't have access to.</p>
</div>
</body>
-</html>
+</html>
View
32 public/500.html
@@ -1,23 +1,19 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
+<!DOCTYPE html>
+<html>
<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>We're sorry, but something went wrong (500)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
- </style>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
</head>
<body>
View
77 public/javascripts/rails.js
@@ -0,0 +1,77 @@
+document.observe("dom:loaded", function() {
+ function handleRemote(element) {
+ var method, url, params;
+
+ if (element.tagName.toLowerCase() == 'form') {
+ method = element.readAttribute('method') || 'post';
+ url = element.readAttribute('action');
+ params = element.serialize(true);
+ } else {
+ method = element.readAttribute('data-method') || 'get';
+ // TODO: data-url support is going away, just use href
+ url = element.readAttribute('data-url') || element.readAttribute('href');
+ params = {};
+ }
+
+ var event = element.fire("ajax:before");
+ if (event.stopped) return false;
+
+ new Ajax.Request(url, {
+ method: method,
+ parameters: params,
+ asynchronous: true,
+ evalScripts: true,
+
+ onLoading: function(request) { element.fire("ajax:loading", {request: request}); },
+ onLoaded: function(request) { element.fire("ajax:loaded", {request: request}); },
+ onInteractive: function(request) { element.fire("ajax:interactive", {request: request}); },
+ onComplete: function(request) { element.fire("ajax:complete", {request: request}); },
+ onSuccess: function(request) { element.fire("ajax:success", {request: request}); },
+ onFailure: function(request) { element.fire("ajax:failure", {request: request}); }
+ });
+
+ element.fire("ajax:after");
+ }
+
+ $(document.body).observe("click", function(event) {
+ var element = event.findElement("a[data-remote=true]");
+ if (element) {
+ handleRemote(element);
+ event.stop();
+ }
+ });
+
+ $(document.body).observe("ajax:before", function(event) {
+ var message = event.element().readAttribute('data-confirm');
+ if (message && !confirm(message)) event.stop();
+ });
+
+ // TODO: I don't think submit bubbles in IE
+ $(document.body).observe("submit", function(event) {
+ var inputs = event.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=true]");
+ if (element) {
+ handleRemote(element);
+ event.stop();
+ }
+ });
+
+ $(document.body).observe("ajax:complete", function(event) {
+ var element = event.element();
+
+ if (element.tagName.toLowerCase() == 'form') {
+ var inputs = element.select("input[type=submit][disabled=true][data-disable-with]");
+ inputs.each(function(input) {
+ input.value = input.readAttribute('data-original-value');
+ input.writeAttribute('data-original-value', null);
+ input.disabled = false;
+ });
+ }
+ });
+});
View
4 script/about
@@ -1,4 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
-require 'commands/about'
View
3  script/console
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/console'
View
3  script/dbconsole
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/dbconsole'
View
3  script/destroy
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/destroy'
View
3  script/generate
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/generate'
View
3  script/performance/benchmarker
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/performance/benchmarker'
View
3  script/performance/profiler
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../../config/boot'
-require 'commands/performance/profiler'
View
3  script/plugin
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/plugin'
View
10 script/rails
@@ -0,0 +1,10 @@
+#!/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.
+
+ENV_PATH = File.expand_path('../../config/environment', __FILE__)
+BOOT_PATH = File.expand_path('../../config/boot', __FILE__)
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+ROOT_PATH = File.expand_path('../..', __FILE__)
+
+require BOOT_PATH
+require 'rails/commands'
View
3  script/runner
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/runner'
View
3  script/server
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'commands/server'
View
2  test/performance/browsing_test.rb
@@ -1,5 +1,5 @@
require 'test_helper'
-require 'performance_test_help'
+require 'rails/performance_test_help'
# Profiling results for each test method are written to tmp/performance.
class BrowsingTest < ActionController::PerformanceTest
View
27 test/test_helper.rb
@@ -1,33 +1,8 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
-require 'test_help'
+require 'rails/test_help'
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.
- #
- # The only drawback to using transactional fixtures is when you actually
- # need to test transactions. Since your test is bracketed by a transaction,
- # any transactions started in your code will be automatically rolled back.
- self.use_transactional_fixtures = true
-
- # 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
-
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
View
0  vendor/plugins/.gitkeep
No changes.
Please sign in to comment.
Something went wrong with that request. Please try again.