Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8087

Show
Ignore:
Timestamp:
11/06/07 15:17:10 (2 years ago)
Author:
sam
Message:

Update Prototype to 1.6.0 and script.aculo.us to 1.8.0.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r8066 r8087  
    11*SVN* 
     2 
     3* Update Prototype to 1.6.0 and script.aculo.us to 1.8.0.  [sam, madrobby] 
    24 
    35* 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  
    3434// useful when one of the tokens is \n (a newline), as it  
    3535// allows smart autocompletion after linebreaks. 
    36 // 
    37 // vim:expandtab ts=8 sw=2 
    3836 
    3937if(typeof Effect == 'undefined') 
     
    624622    var value = $F(this._controls.editor); 
    625623    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; 
    628628    if (this.options.htmlResponse) { 
    629629      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_rc1 
     1/*  Prototype JavaScript framework, version 1.6.0 
    22 *  (c) 2005-2007 Sam Stephenson 
    33 * 
     
    88 
    99var Prototype = { 
    10   Version: '1.6.0_rc1', 
     10  Version: '1.6.0', 
    1111 
    1212  Browser: { 
     
    2222    ElementExtensions: !!window.HTMLElement, 
    2323    SpecificElementExtensions: 
     24      document.createElement('div').__proto__ && 
    2425      document.createElement('div').__proto__ !== 
    25        document.createElement('form').__proto__ 
     26        document.createElement('form').__proto__ 
    2627  }, 
    2728 
     
    7576Class.Methods = { 
    7677  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]; 
    8186      if (ancestor && Object.isFunction(value) && 
    8287          value.argumentNames().first() == "$super") { 
     
    562567      var ctx = object, expr = match[3]; 
    563568      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr); 
    564       if (match == null) return ''
     569      if (match == null) return before
    565570 
    566571      while (match != null) { 
     
    10931098})()); 
    10941099 
     1100Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; 
    10951101Hash.from = $H; 
    10961102var ObjectRange = Class.create(Enumerable, { 
     
    14001406  _getHeaderJSON: function() { 
    14011407    var json = this.getHeader('X-JSON'); 
     1408    if (!json) return null; 
     1409    json = decodeURIComponent(escape(json)); 
    14021410    try { 
    1403       return json ? json.evalJSON(this.request.options.sanitizeJSON) : null
     1411      return json.evalJSON(this.request.options.sanitizeJSON)
    14041412    } catch (e) { 
    14051413      this.request.dispatchException(e); 
     
    14091417  _getResponseJSON: function() { 
    14101418    var options = this.request.options; 
     1419    if (!options.evalJSON || (options.evalJSON != 'force' && 
     1420      !(this.getHeader('Content-type') || '').include('application/json'))) 
     1421        return null; 
    14111422    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); 
    14161424    } catch (e) { 
    14171425      this.request.dispatchException(e); 
     
    18181826    var elementClassName = element.className; 
    18191827    return (elementClassName.length > 0 && (elementClassName == className || 
    1820       elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))); 
     1828      new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); 
    18211829  }, 
    18221830 
     
    18601868  descendantOf: function(element, ancestor) { 
    18611869    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 
    18621884    while (element = element.parentNode) 
    18631885      if (element == ancestor) return true; 
     
    22492271    } 
    22502272    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 
    22522278    var filter = element.getStyle('filter'), style = element.style; 
    22532279    if (value == 1 || value === '') { 
     
    23452371} 
    23462372 
    2347 else if (Prototype.Browser.Gecko) { 
     2373else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { 
    23482374  Element.Methods.setOpacity = function(element, value) { 
    23492375    element = $(element); 
     
    31223148 
    31233149    attrPresence: function(nodes, root, attr) { 
     3150      if (!nodes) nodes = root.getElementsByTagName("*"); 
    31243151      var results = []; 
    31253152      for (var i = 0, node; node = nodes[i]; i++) 
     
    36853712 
    36863713Event.Methods = (function() { 
     3714  var isButton; 
     3715 
    36873716  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    }; 
    36913721 
    36923722  } else if (Prototype.Browser.WebKit) { 
    3693     function isButton(event, code) { 
     3723    isButton = function(event, code) { 
    36943724      switch (code) { 
    36953725        case 0: return event.which == 1 && !event.metaKey; 
     
    36973727        default: return false; 
    36983728      } 
    3699     } 
     3729    }; 
    37003730 
    37013731  } else { 
    3702     function isButton(event, code) { 
     3732    isButton = function(event, code) { 
    37033733      return event.which ? (event.which === code + 1) : (event.button === code); 
    3704     } 
     3734    }; 
    37053735  } 
    37063736 
     
    37363766      event.preventDefault(); 
    37373767      event.stopPropagation(); 
     3768      event.stopped = true; 
    37383769    } 
    37393770  }; 
     
    37853816 
    37863817  function getDOMEventName(eventName) { 
    3787     if (eventName && eventName.match(/:/)) return "dataavailable"; 
     3818    if (eventName && eventName.include(':')) return "dataavailable"; 
    37883819    return eventName; 
    37893820  } 
     
    38043835 
    38053836    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; 
    38083840 
    38093841      Event.extend(event); 
  • trunk/railties/CHANGELOG

    r8039 r8087  
    11*SVN* 
     2 
     3* Update Prototype to 1.6.0 and script.aculo.us to 1.8.0.  [sam, madrobby] 
    24 
    35* 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  
    3434// useful when one of the tokens is \n (a newline), as it  
    3535// allows smart autocompletion after linebreaks. 
    36 // 
    37 // vim:expandtab ts=8 sw=2 
    3836 
    3937if(typeof Effect == 'undefined') 
     
    624622    var value = $F(this._controls.editor); 
    625623    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; 
    628628    if (this.options.htmlResponse) { 
    629629      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_rc1 
     1/*  Prototype JavaScript framework, version 1.6.0 
    22 *  (c) 2005-2007 Sam Stephenson 
    33 * 
     
    88 
    99var Prototype = { 
    10   Version: '1.6.0_rc1', 
     10  Version: '1.6.0', 
    1111 
    1212  Browser: { 
     
    2222    ElementExtensions: !!window.HTMLElement, 
    2323    SpecificElementExtensions: 
     24      document.createElement('div').__proto__ && 
    2425      document.createElement('div').__proto__ !== 
    25        document.createElement('form').__proto__ 
     26        document.createElement('form').__proto__ 
    2627  }, 
    2728 
     
    7576Class.Methods = { 
    7677  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]; 
    8186      if (ancestor && Object.isFunction(value) && 
    8287          value.argumentNames().first() == "$super") { 
     
    562567      var ctx = object, expr = match[3]; 
    563568      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr); 
    564       if (match == null) return ''
     569      if (match == null) return before
    565570 
    566571      while (match != null) { 
     
    10931098})()); 
    10941099 
     1100Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; 
    10951101Hash.from = $H; 
    10961102var ObjectRange = Class.create(Enumerable, { 
     
    14001406  _getHeaderJSON: function() { 
    14011407    var json = this.getHeader('X-JSON'); 
     1408    if (!json) return null; 
     1409    json = decodeURIComponent(escape(json)); 
    14021410    try { 
    1403       return json ? json.evalJSON(this.request.options.sanitizeJSON) : null
     1411      return json.evalJSON(this.request.options.sanitizeJSON)
    14041412    } catch (e) { 
    14051413      this.request.dispatchException(e); 
     
    14091417  _getResponseJSON: function() { 
    14101418    var options = this.request.options; 
     1419    if (!options.evalJSON || (options.evalJSON != 'force' && 
     1420      !(this.getHeader('Content-type') || '').include('application/json'))) 
     1421        return null; 
    14111422    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); 
    14161424    } catch (e) { 
    14171425      this.request.dispatchException(e); 
     
    18181826    var elementClassName = element.className; 
    18191827    return (elementClassName.length > 0 && (elementClassName == className || 
    1820       elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))); 
     1828      new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); 
    18211829  }, 
    18221830 
     
    18601868  descendantOf: function(element, ancestor) { 
    18611869    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 
    18621884    while (element = element.parentNode) 
    18631885      if (element == ancestor) return true; 
     
    22492271    } 
    22502272    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 
    22522278    var filter = element.getStyle('filter'), style = element.style; 
    22532279    if (value == 1 || value === '') { 
     
    23452371} 
    23462372 
    2347 else if (Prototype.Browser.Gecko) { 
     2373else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { 
    23482374  Element.Methods.setOpacity = function(element, value) { 
    23492375    element = $(element); 
     
    31223148 
    31233149    attrPresence: function(nodes, root, attr) { 
     3150      if (!nodes) nodes = root.getElementsByTagName("*"); 
    31243151      var results = []; 
    31253152      for (var i = 0, node; node = nodes[i]; i++) 
     
    36853712 
    36863713Event.Methods = (function() { 
     3714  var isButton; 
     3715 
    36873716  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    }; 
    36913721 
    36923722  } else if (Prototype.Browser.WebKit) { 
    3693     function isButton(event, code) { 
     3723    isButton = function(event, code) { 
    36943724      switch (code) { 
    36953725        case 0: return event.which == 1 && !event.metaKey; 
     
    36973727        default: return false; 
    36983728      } 
    3699     } 
     3729    }; 
    37003730 
    37013731  } else { 
    3702     function isButton(event, code) { 
     3732    isButton = function(event, code) { 
    37033733      return event.which ? (event.which === code + 1) : (event.button === code); 
    3704     } 
     3734    }; 
    37053735  } 
    37063736 
     
    37363766      event.preventDefault(); 
    37373767      event.stopPropagation(); 
     3768      event.stopped = true; 
    37383769    } 
    37393770  }; 
     
    37853816 
    37863817  function getDOMEventName(eventName) { 
    3787     if (eventName && eventName.match(/:/)) return "dataavailable"; 
     3818    if (eventName && eventName.include(':')) return "dataavailable"; 
    37883819    return eventName; 
    37893820  } 
     
    38043835 
    38053836    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; 
    38083840 
    38093841      Event.extend(event);