mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added Element.toggle, Element.show, and Element.hide to the prototype javascript library. Toggle.display has been deprecated, but will still work #992 [Lucas Carlson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1181 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
6acda705dc
commit
c3ca5ab7a8
4 changed files with 48 additions and 18 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Added Element.toggle, Element.show, and Element.hide to the prototype javascript library. Toggle.display has been deprecated, but will still work #992 [Lucas Carlson]
|
||||||
|
|
||||||
* Added that deleting a cookie should not just set it to an empty string but also instantly expire it #1118 [todd@robotcoop.com]
|
* Added that deleting a cookie should not just set it to an empty string but also instantly expire it #1118 [todd@robotcoop.com]
|
||||||
|
|
||||||
* Added AssetTagHelper#image_path, AssetTagHelper#javascript_path, and AssetTagHelper#stylesheet_path #1110 [Larry Halff]
|
* Added AssetTagHelper#image_path, AssetTagHelper#javascript_path, and AssetTagHelper#stylesheet_path #1110 [Larry Halff]
|
||||||
|
|
|
@ -95,16 +95,16 @@ module ActionView
|
||||||
|
|
||||||
# Returns a button input tag that will submit form using XMLHttpRequest in tghe background instead of regular
|
# Returns a button input tag that will submit form using XMLHttpRequest in tghe background instead of regular
|
||||||
# reloading POST arrangement. <tt>options</tt> argument is the same as in <tt>form_remote_tag</tt>
|
# reloading POST arrangement. <tt>options</tt> argument is the same as in <tt>form_remote_tag</tt>
|
||||||
def submit_to_remote(name,value,options = {})
|
def submit_to_remote(name, value, options = {})
|
||||||
options[:with] = 'Form.serialize(this.form)'
|
options[:with] = 'Form.serialize(this.form)'
|
||||||
|
|
||||||
options[:html] ||= {}
|
options[:html] ||= {}
|
||||||
options[:html][:type] = 'button'
|
options[:html][:type] = 'button'
|
||||||
options[:html][:onclick] = "#{remote_function(options)}; return false;"
|
options[:html][:onclick] = "#{remote_function(options)}; return false;"
|
||||||
options[:html][:name] = name
|
options[:html][:name] = name
|
||||||
options[:html][:value] = value
|
options[:html][:value] = value
|
||||||
|
|
||||||
tag("input", options[:html], false)
|
tag("input", options[:html], false)
|
||||||
end
|
end
|
||||||
|
|
||||||
def remote_function(options) #:nodoc: for now
|
def remote_function(options) #:nodoc: for now
|
||||||
|
@ -134,9 +134,7 @@ module ActionView
|
||||||
# create remote <script> links.
|
# create remote <script> links.
|
||||||
def define_javascript_functions
|
def define_javascript_functions
|
||||||
javascript = '<script type="text/javascript">'
|
javascript = '<script type="text/javascript">'
|
||||||
Dir.glob(File.join(JAVASCRIPT_PATH, '*')).each do |filename|
|
Dir.glob(File.join(JAVASCRIPT_PATH, '*')).each { |filename| javascript << "\n" << IO.read(filename) }
|
||||||
javascript << "\n" << IO.read(filename)
|
|
||||||
end
|
|
||||||
javascript << '</script>'
|
javascript << '</script>'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Prototype: an object-oriented Javascript library, version 1.0.1
|
/* Prototype: an object-oriented Javascript library, version 1.1.0
|
||||||
* (c) 2005 Sam Stephenson <sam@conio.net>
|
* (c) 2005 Sam Stephenson <sam@conio.net>
|
||||||
*
|
*
|
||||||
* Prototype is freely distributable under the terms of an MIT-style license.
|
* Prototype is freely distributable under the terms of an MIT-style license.
|
||||||
|
@ -62,14 +62,29 @@ var Try = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var Toggle = {
|
// Deprecated accessor for Element.toggle
|
||||||
display: function() {
|
var Toggle = { display: function() { Element.toggle(arguments); } }
|
||||||
|
|
||||||
|
var Element = {
|
||||||
|
toggle: function() {
|
||||||
for (var i = 0; i < arguments.length; i++) {
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
var element = $(arguments[i]);
|
var element = $(arguments[i]);
|
||||||
element.style.display =
|
element.style.display =
|
||||||
(element.style.display == 'none' ? '' : 'none');
|
(element.style.display == 'none' ? '' : 'none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
hide: function() {
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
var element = $(arguments[i]);
|
||||||
|
element.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
show: function() {
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
var element = $(arguments[i]);
|
||||||
|
element.style.display = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
21
railties/html/javascripts/prototype.js
vendored
21
railties/html/javascripts/prototype.js
vendored
|
@ -1,4 +1,4 @@
|
||||||
/* Prototype: an object-oriented Javascript library, version 1.0.1
|
/* Prototype: an object-oriented Javascript library, version 1.1.0
|
||||||
* (c) 2005 Sam Stephenson <sam@conio.net>
|
* (c) 2005 Sam Stephenson <sam@conio.net>
|
||||||
*
|
*
|
||||||
* Prototype is freely distributable under the terms of an MIT-style license.
|
* Prototype is freely distributable under the terms of an MIT-style license.
|
||||||
|
@ -62,14 +62,29 @@ var Try = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var Toggle = {
|
// Deprecated accessor for Element.toggle
|
||||||
display: function() {
|
var Toggle = { display: function() { Element.toggle(arguments); } }
|
||||||
|
|
||||||
|
var Element = {
|
||||||
|
toggle: function() {
|
||||||
for (var i = 0; i < arguments.length; i++) {
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
var element = $(arguments[i]);
|
var element = $(arguments[i]);
|
||||||
element.style.display =
|
element.style.display =
|
||||||
(element.style.display == 'none' ? '' : 'none');
|
(element.style.display == 'none' ? '' : 'none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
hide: function() {
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
var element = $(arguments[i]);
|
||||||
|
element.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
show: function() {
|
||||||
|
for (var i = 0; i < arguments.length; i++) {
|
||||||
|
var element = $(arguments[i]);
|
||||||
|
element.style.display = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue