diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/generators/rails/app/templates/public/javascripts/jquery.driver.js | 17 |
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'); + } + }); /** * |