From a6543bbf3a3833cfd1e0c1595f099aa267ec9eb2 Mon Sep 17 00:00:00 2001 From: Priit Tamboom Date: Sat, 8 Dec 2007 12:39:26 +0800 Subject: [PATCH] updated to 2.0.1 --- app/controllers/application.rb | 2 +- config/environment.rb | 4 +-- public/javascripts/controls.js | 6 ++-- public/javascripts/prototype.js | 65 ++++++++++++++++++++++++++++------------- test/test_helper.rb | 4 +++ 5 files changed, 55 insertions(+), 26 deletions(-) diff --git a/app/controllers/application.rb b/app/controllers/application.rb index fd7e004..4852b05 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -6,5 +6,5 @@ class ApplicationController < ActionController::Base # See ActionController::RequestForgeryProtection for details # Uncomment the :secret if you're not using the cookie session store - protect_from_forgery # :secret => '33d4b3ee6fc0266b90063ecbf256076b' + protect_from_forgery # :secret => 'fc3d46c3fbc4bb4ff24b81d2125e1662' end diff --git a/config/environment.rb b/config/environment.rb index 0843fc4..643ce18 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -5,7 +5,7 @@ # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '1.99.1' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '2.0.1' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') @@ -38,7 +38,7 @@ Rails::Initializer.run do |config| # no regular words or you'll be exposed to dictionary attacks. config.action_controller.session = { :session_key => '_rails-skeleton_session', - :secret => '5743a49340356dd047cbd67b2b9d0412b69ce923f20810e5a039c38293d0a80bafe89728fe2bde1f580dc5a5ac6f287ceaed055617ca7a268e42aa60f492397b' + :secret => 'd621ee17b00e1f40f6e23159735767aa4b06587e6380e8d9b153ef23a281b23d93ff52a8825e0c453d753affcbe6fedb3c71244cadfca9c8a80f1820fc455592' } # Use the database for sessions instead of the cookie-based default, diff --git a/public/javascripts/controls.js b/public/javascripts/controls.js index da7bfa2..fbc4418 100644 --- a/public/javascripts/controls.js +++ b/public/javascripts/controls.js @@ -86,7 +86,7 @@ Autocompleter.Base = Class.create({ Element.hide(this.update); Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); - Event.observe(this.element, 'keypress', this.onKeyPress.bindAsEventListener(this)); + Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this)); }, show: function() { @@ -142,12 +142,12 @@ Autocompleter.Base = Class.create({ case Event.KEY_UP: this.markPrevious(); this.render(); - if(Prototype.Browser.WebKit) Event.stop(event); + Event.stop(event); return; case Event.KEY_DOWN: this.markNext(); this.render(); - if(Prototype.Browser.WebKit) Event.stop(event); + Event.stop(event); return; } else diff --git a/public/javascripts/prototype.js b/public/javascripts/prototype.js index 086ba2e..546f9fe 100644 --- a/public/javascripts/prototype.js +++ b/public/javascripts/prototype.js @@ -1,4 +1,4 @@ -/* Prototype JavaScript framework, version 1.6.0 +/* Prototype JavaScript framework, version 1.6.0.1 * (c) 2005-2007 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license. @@ -7,7 +7,7 @@ *--------------------------------------------------------------------------*/ var Prototype = { - Version: '1.6.0', + Version: '1.6.0.1', Browser: { IE: !!(window.attachEvent && !window.opera), @@ -2194,22 +2194,46 @@ if (!document.createRange || Prototype.Browser.Opera) { } if (Prototype.Browser.Opera) { - Element.Methods._getStyle = Element.Methods.getStyle; - Element.Methods.getStyle = function(element, style) { - switch(style) { - case 'left': - case 'top': - case 'right': - case 'bottom': - if (Element._getStyle(element, 'position') == 'static') return null; - default: return Element._getStyle(element, style); + Element.Methods.getStyle = Element.Methods.getStyle.wrap( + function(proceed, element, style) { + switch (style) { + case 'left': case 'top': case 'right': case 'bottom': + if (proceed(element, 'position') === 'static') return null; + case 'height': case 'width': + // returns '0px' for hidden elements; we want it to return null + if (!Element.visible(element)) return null; + + // returns the border-box dimensions rather than the content-box + // dimensions, so we subtract padding and borders from the value + var dim = parseInt(proceed(element, style), 10); + + if (dim !== element['offset' + style.capitalize()]) + return dim + 'px'; + + var properties; + if (style === 'height') { + properties = ['border-top-width', 'padding-top', + 'padding-bottom', 'border-bottom-width']; + } + else { + properties = ['border-left-width', 'padding-left', + 'padding-right', 'border-right-width']; + } + return properties.inject(dim, function(memo, property) { + var val = proceed(element, property); + return val === null ? memo : memo - parseInt(val, 10); + }) + 'px'; + default: return proceed(element, style); + } } - }; - Element.Methods._readAttribute = Element.Methods.readAttribute; - Element.Methods.readAttribute = function(element, attribute) { - if (attribute == 'title') return element.title; - return Element._readAttribute(element, attribute); - }; + ); + + Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( + function(proceed, element, attribute) { + if (attribute === 'title') return element.title; + return proceed(element, attribute); + } + ); } else if (Prototype.Browser.IE) { @@ -2380,7 +2404,7 @@ else if (Prototype.Browser.WebKit) { }; // Safari returns margins on body which is incorrect if the child is absolutely - // positioned. For performance reasons, redefine Position.cumulativeOffset for + // positioned. For performance reasons, redefine Element#cumulativeOffset for // KHTML/WebKit only. Element.Methods.cumulativeOffset = function(element) { var valueT = 0, valueL = 0; @@ -2669,10 +2693,11 @@ Element.addMethods = function(methods) { document.viewport = { getDimensions: function() { var dimensions = { }; + var B = Prototype.Browser; $w('width height').each(function(d) { var D = d.capitalize(); - dimensions[d] = self['inner' + D] || - (document.documentElement['client' + D] || document.body['client' + D]); + dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] : + (B.Opera) ? document.body['client' + D] : document.documentElement['client' + D]; }); return dimensions; }, diff --git a/test/test_helper.rb b/test/test_helper.rb index f91c6a1..9f19269 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -15,6 +15,10 @@ class Test::Unit::TestCase # 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 -- 2.11.4.GIT