aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik St. Martin <alakriti@gmail.com>2010-01-27 20:42:36 -0500
committerErik St. Martin <alakriti@gmail.com>2010-01-27 20:42:36 -0500
commit4911343bf7719e76c8964445f9f146e7b8999b54 (patch)
tree65ea8c3a67392f77f116db540844221a9024d1ae
parent2e338aed706b3ee8fb8d51040be87689597e087b (diff)
downloadrails-4911343bf7719e76c8964445f9f146e7b8999b54.tar.gz
rails-4911343bf7719e76c8964445f9f146e7b8999b54.tar.bz2
rails-4911343bf7719e76c8964445f9f146e7b8999b54.zip
jquery driver now supports :popup
-rw-r--r--railties/lib/generators/rails/app/templates/public/javascripts/jquery.driver.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/railties/lib/generators/rails/app/templates/public/javascripts/jquery.driver.js b/railties/lib/generators/rails/app/templates/public/javascripts/jquery.driver.js
index 20938b002e..5189130c5c 100644
--- a/railties/lib/generators/rails/app/templates/public/javascripts/jquery.driver.js
+++ b/railties/lib/generators/rails/app/templates/public/javascripts/jquery.driver.js
@@ -144,6 +144,23 @@ jQuery(function ($) {
*/
$('a[data-remote="true"],input[data-remote="true"],input[data-remote-submit="true"]').live('click', rails.remote);
+ /*
+ * popup
+ */
+ $('a[data-popup],input[data-popup]').live('click', function(e){
+ var el = $(this),
+ url = el.attr('data-url') || el.attr('href');
+
+ e.preventDefault();
+
+ if(el.attr('data-popup') === "true"){
+ window.open(url);
+ console.log('without options');
+ } else {
+ window.open(url, el.attr('data-popup'));
+ console.log('with options');
+ }
+ });
/**
*