Changeset 8087
- Timestamp:
- 11/06/07 15:17:10 (2 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_view/helpers/javascripts/controls.js (modified) (2 diffs)
- trunk/actionpack/lib/action_view/helpers/javascripts/prototype.js (modified) (18 diffs)
- trunk/railties/CHANGELOG (modified) (1 diff)
- trunk/railties/html/javascripts/controls.js (modified) (2 diffs)
- trunk/railties/html/javascripts/prototype.js (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r8066 r8087 1 1 *SVN* 2 3 * Update Prototype to 1.6.0 and script.aculo.us to 1.8.0. [sam, madrobby] 2 4 3 5 * Expose the cookie jar as a helper method (before the view would just get the raw cookie hash) [DHH] trunk/actionpack/lib/action_view/helpers/javascripts/controls.js
r7947 r8087 34 34 // useful when one of the tokens is \n (a newline), as it 35 35 // allows smart autocompletion after linebreaks. 36 //37 // vim:expandtab ts=8 sw=238 36 39 37 if(typeof Effect == 'undefined') … … 624 622 var value = $F(this._controls.editor); 625 623 this.prepareSubmission(); 626 var params = this.options.callback(form, value); 627 params = (params ? params + '&' : '?') + 'editorId=' + this.element.id; 624 var params = this.options.callback(form, value) || ''; 625 if (Object.isString(params)) 626 params = params.toQueryParams(); 627 params.editorId = this.element.id; 628 628 if (this.options.htmlResponse) { 629 629 var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); trunk/actionpack/lib/action_view/helpers/javascripts/prototype.js
r7947 r8087 1 /* Prototype JavaScript framework, version 1.6.0 _rc11 /* Prototype JavaScript framework, version 1.6.0 2 2 * (c) 2005-2007 Sam Stephenson 3 3 * … … 8 8 9 9 var Prototype = { 10 Version: '1.6.0 _rc1',10 Version: '1.6.0', 11 11 12 12 Browser: { … … 22 22 ElementExtensions: !!window.HTMLElement, 23 23 SpecificElementExtensions: 24 document.createElement('div').__proto__ && 24 25 document.createElement('div').__proto__ !== 25 document.createElement('form').__proto__26 document.createElement('form').__proto__ 26 27 }, 27 28 … … 75 76 Class.Methods = { 76 77 addMethods: function(source) { 77 var ancestor = this.superclass && this.superclass.prototype; 78 79 for (var property in source) { 80 var value = source[property]; 78 var ancestor = this.superclass && this.superclass.prototype; 79 var properties = Object.keys(source); 80 81 if (!Object.keys({ toString: true }).length) 82 properties.push("toString", "valueOf"); 83 84 for (var i = 0, length = properties.length; i < length; i++) { 85 var property = properties[i], value = source[property]; 81 86 if (ancestor && Object.isFunction(value) && 82 87 value.argumentNames().first() == "$super") { … … 562 567 var ctx = object, expr = match[3]; 563 568 var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr); 564 if (match == null) return '';569 if (match == null) return before; 565 570 566 571 while (match != null) { … … 1093 1098 })()); 1094 1099 1100 Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; 1095 1101 Hash.from = $H; 1096 1102 var ObjectRange = Class.create(Enumerable, { … … 1400 1406 _getHeaderJSON: function() { 1401 1407 var json = this.getHeader('X-JSON'); 1408 if (!json) return null; 1409 json = decodeURIComponent(escape(json)); 1402 1410 try { 1403 return json ? json.evalJSON(this.request.options.sanitizeJSON) : null;1411 return json.evalJSON(this.request.options.sanitizeJSON); 1404 1412 } catch (e) { 1405 1413 this.request.dispatchException(e); … … 1409 1417 _getResponseJSON: function() { 1410 1418 var options = this.request.options; 1419 if (!options.evalJSON || (options.evalJSON != 'force' && 1420 !(this.getHeader('Content-type') || '').include('application/json'))) 1421 return null; 1411 1422 try { 1412 if (options.evalJSON == 'force' || (options.evalJSON && 1413 (this.getHeader('Content-type') || '').include('application/json'))) 1414 return this.transport.responseText.evalJSON(options.sanitizeJSON); 1415 return null; 1423 return this.transport.responseText.evalJSON(options.sanitizeJSON); 1416 1424 } catch (e) { 1417 1425 this.request.dispatchException(e); … … 1818 1826 var elementClassName = element.className; 1819 1827 return (elementClassName.length > 0 && (elementClassName == className || 1820 elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))));1828 new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); 1821 1829 }, 1822 1830 … … 1860 1868 descendantOf: function(element, ancestor) { 1861 1869 element = $(element), ancestor = $(ancestor); 1870 1871 if (element.compareDocumentPosition) 1872 return (element.compareDocumentPosition(ancestor) & 8) === 8; 1873 1874 if (element.sourceIndex && !Prototype.Browser.Opera) { 1875 var e = element.sourceIndex, a = ancestor.sourceIndex, 1876 nextAncestor = ancestor.nextSibling; 1877 if (!nextAncestor) { 1878 do { ancestor = ancestor.parentNode; } 1879 while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode); 1880 } 1881 if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex); 1882 } 1883 1862 1884 while (element = element.parentNode) 1863 1885 if (element == ancestor) return true; … … 2249 2271 } 2250 2272 element = $(element); 2251 if (!element.currentStyle.hasLayout) element.style.zoom = 1; 2273 var currentStyle = element.currentStyle; 2274 if ((currentStyle && !currentStyle.hasLayout) || 2275 (!currentStyle && element.style.zoom == 'normal')) 2276 element.style.zoom = 1; 2277 2252 2278 var filter = element.getStyle('filter'), style = element.style; 2253 2279 if (value == 1 || value === '') { … … 2345 2371 } 2346 2372 2347 else if (Prototype.Browser.Gecko ) {2373 else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { 2348 2374 Element.Methods.setOpacity = function(element, value) { 2349 2375 element = $(element); … … 3122 3148 3123 3149 attrPresence: function(nodes, root, attr) { 3150 if (!nodes) nodes = root.getElementsByTagName("*"); 3124 3151 var results = []; 3125 3152 for (var i = 0, node; node = nodes[i]; i++) … … 3685 3712 3686 3713 Event.Methods = (function() { 3714 var isButton; 3715 3687 3716 if (Prototype.Browser.IE) { 3688 function isButton(event, code) { 3689 return event.button == ({ 0: 1, 1: 4, 2: 2 })[code]; 3690 } 3717 var buttonMap = { 0: 1, 1: 4, 2: 2 }; 3718 isButton = function(event, code) { 3719 return event.button == buttonMap[code]; 3720 }; 3691 3721 3692 3722 } else if (Prototype.Browser.WebKit) { 3693 function isButton(event, code) {3723 isButton = function(event, code) { 3694 3724 switch (code) { 3695 3725 case 0: return event.which == 1 && !event.metaKey; … … 3697 3727 default: return false; 3698 3728 } 3699 } 3729 }; 3700 3730 3701 3731 } else { 3702 function isButton(event, code) {3732 isButton = function(event, code) { 3703 3733 return event.which ? (event.which === code + 1) : (event.button === code); 3704 } 3734 }; 3705 3735 } 3706 3736 … … 3736 3766 event.preventDefault(); 3737 3767 event.stopPropagation(); 3768 event.stopped = true; 3738 3769 } 3739 3770 }; … … 3785 3816 3786 3817 function getDOMEventName(eventName) { 3787 if (eventName && eventName. match(/:/)) return "dataavailable";3818 if (eventName && eventName.include(':')) return "dataavailable"; 3788 3819 return eventName; 3789 3820 } … … 3804 3835 3805 3836 var wrapper = function(event) { 3806 if (event.eventName && event.eventName != eventName) 3807 return false; 3837 if (!Event || !Event.extend || 3838 (event.eventName && event.eventName != eventName)) 3839 return false; 3808 3840 3809 3841 Event.extend(event); trunk/railties/CHANGELOG
r8039 r8087 1 1 *SVN* 2 3 * Update Prototype to 1.6.0 and script.aculo.us to 1.8.0. [sam, madrobby] 2 4 3 5 * Added db:rollback to rollback the schema one version (or multiple as specified by STEP) [Jeffrey Allan Hardy] trunk/railties/html/javascripts/controls.js
r7947 r8087 34 34 // useful when one of the tokens is \n (a newline), as it 35 35 // allows smart autocompletion after linebreaks. 36 //37 // vim:expandtab ts=8 sw=238 36 39 37 if(typeof Effect == 'undefined') … … 624 622 var value = $F(this._controls.editor); 625 623 this.prepareSubmission(); 626 var params = this.options.callback(form, value); 627 params = (params ? params + '&' : '?') + 'editorId=' + this.element.id; 624 var params = this.options.callback(form, value) || ''; 625 if (Object.isString(params)) 626 params = params.toQueryParams(); 627 params.editorId = this.element.id; 628 628 if (this.options.htmlResponse) { 629 629 var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); trunk/railties/html/javascripts/prototype.js
r7947 r8087 1 /* Prototype JavaScript framework, version 1.6.0 _rc11 /* Prototype JavaScript framework, version 1.6.0 2 2 * (c) 2005-2007 Sam Stephenson 3 3 * … … 8 8 9 9 var Prototype = { 10 Version: '1.6.0 _rc1',10 Version: '1.6.0', 11 11 12 12 Browser: { … … 22 22 ElementExtensions: !!window.HTMLElement, 23 23 SpecificElementExtensions: 24 document.createElement('div').__proto__ && 24 25 document.createElement('div').__proto__ !== 25 document.createElement('form').__proto__26 document.createElement('form').__proto__ 26 27 }, 27 28 … … 75 76 Class.Methods = { 76 77 addMethods: function(source) { 77 var ancestor = this.superclass && this.superclass.prototype; 78 79 for (var property in source) { 80 var value = source[property]; 78 var ancestor = this.superclass && this.superclass.prototype; 79 var properties = Object.keys(source); 80 81 if (!Object.keys({ toString: true }).length) 82 properties.push("toString", "valueOf"); 83 84 for (var i = 0, length = properties.length; i < length; i++) { 85 var property = properties[i], value = source[property]; 81 86 if (ancestor && Object.isFunction(value) && 82 87 value.argumentNames().first() == "$super") { … … 562 567 var ctx = object, expr = match[3]; 563 568 var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr); 564 if (match == null) return '';569 if (match == null) return before; 565 570 566 571 while (match != null) { … … 1093 1098 })()); 1094 1099 1100 Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; 1095 1101 Hash.from = $H; 1096 1102 var ObjectRange = Class.create(Enumerable, { … … 1400 1406 _getHeaderJSON: function() { 1401 1407 var json = this.getHeader('X-JSON'); 1408 if (!json) return null; 1409 json = decodeURIComponent(escape(json)); 1402 1410 try { 1403 return json ? json.evalJSON(this.request.options.sanitizeJSON) : null;1411 return json.evalJSON(this.request.options.sanitizeJSON); 1404 1412 } catch (e) { 1405 1413 this.request.dispatchException(e); … … 1409 1417 _getResponseJSON: function() { 1410 1418 var options = this.request.options; 1419 if (!options.evalJSON || (options.evalJSON != 'force' && 1420 !(this.getHeader('Content-type') || '').include('application/json'))) 1421 return null; 1411 1422 try { 1412 if (options.evalJSON == 'force' || (options.evalJSON && 1413 (this.getHeader('Content-type') || '').include('application/json'))) 1414 return this.transport.responseText.evalJSON(options.sanitizeJSON); 1415 return null; 1423 return this.transport.responseText.evalJSON(options.sanitizeJSON); 1416 1424 } catch (e) { 1417 1425 this.request.dispatchException(e); … … 1818 1826 var elementClassName = element.className; 1819 1827 return (elementClassName.length > 0 && (elementClassName == className || 1820 elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))));1828 new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); 1821 1829 }, 1822 1830 … … 1860 1868 descendantOf: function(element, ancestor) { 1861 1869 element = $(element), ancestor = $(ancestor); 1870 1871 if (element.compareDocumentPosition) 1872 return (element.compareDocumentPosition(ancestor) & 8) === 8; 1873 1874 if (element.sourceIndex && !Prototype.Browser.Opera) { 1875 var e = element.sourceIndex, a = ancestor.sourceIndex, 1876 nextAncestor = ancestor.nextSibling; 1877 if (!nextAncestor) { 1878 do { ancestor = ancestor.parentNode; } 1879 while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode); 1880 } 1881 if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex); 1882 } 1883 1862 1884 while (element = element.parentNode) 1863 1885 if (element == ancestor) return true; … … 2249 2271 } 2250 2272 element = $(element); 2251 if (!element.currentStyle.hasLayout) element.style.zoom = 1; 2273 var currentStyle = element.currentStyle; 2274 if ((currentStyle && !currentStyle.hasLayout) || 2275 (!currentStyle && element.style.zoom == 'normal')) 2276 element.style.zoom = 1; 2277 2252 2278 var filter = element.getStyle('filter'), style = element.style; 2253 2279 if (value == 1 || value === '') { … … 2345 2371 } 2346 2372 2347 else if (Prototype.Browser.Gecko ) {2373 else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { 2348 2374 Element.Methods.setOpacity = function(element, value) { 2349 2375 element = $(element); … … 3122 3148 3123 3149 attrPresence: function(nodes, root, attr) { 3150 if (!nodes) nodes = root.getElementsByTagName("*"); 3124 3151 var results = []; 3125 3152 for (var i = 0, node; node = nodes[i]; i++) … … 3685 3712 3686 3713 Event.Methods = (function() { 3714 var isButton; 3715 3687 3716 if (Prototype.Browser.IE) { 3688 function isButton(event, code) { 3689 return event.button == ({ 0: 1, 1: 4, 2: 2 })[code]; 3690 } 3717 var buttonMap = { 0: 1, 1: 4, 2: 2 }; 3718 isButton = function(event, code) { 3719 return event.button == buttonMap[code]; 3720 }; 3691 3721 3692 3722 } else if (Prototype.Browser.WebKit) { 3693 function isButton(event, code) {3723 isButton = function(event, code) { 3694 3724 switch (code) { 3695 3725 case 0: return event.which == 1 && !event.metaKey; … … 3697 3727 default: return false; 3698 3728 } 3699 } 3729 }; 3700 3730 3701 3731 } else { 3702 function isButton(event, code) {3732 isButton = function(event, code) { 3703 3733 return event.which ? (event.which === code + 1) : (event.button === code); 3704 } 3734 }; 3705 3735 } 3706 3736 … … 3736 3766 event.preventDefault(); 3737 3767 event.stopPropagation(); 3768 event.stopped = true; 3738 3769 } 3739 3770 }; … … 3785 3816 3786 3817 function getDOMEventName(eventName) { 3787 if (eventName && eventName. match(/:/)) return "dataavailable";3818 if (eventName && eventName.include(':')) return "dataavailable"; 3788 3819 return eventName; 3789 3820 } … … 3804 3835 3805 3836 var wrapper = function(event) { 3806 if (event.eventName && event.eventName != eventName) 3807 return false; 3837 if (!Event || !Event.extend || 3838 (event.eventName && event.eventName != eventName)) 3839 return false; 3808 3840 3809 3841 Event.extend(event);