Permalink
Browse files

jquery driver now supports :confirm

  • Loading branch information...
1 parent 4911343 commit a0232d864177d14476bff73ac274a3ed820153f3 @erikstmartin erikstmartin committed Jan 28, 2010
Showing with 12 additions and 2 deletions.
  1. +12 −2 railties/lib/generators/rails/app/templates/public/javascripts/jquery.driver.js
@@ -118,6 +118,18 @@ jQuery(function ($) {
});
/**
+ * confirm
+ * make sure this event is first!
+ */
+ $('a[data-confirm],input[data-confirm]').live('click', function(e){
+ var el = $(this);
+
+ if(!confirm(el.attr('data-confirm'))){
+ return false;
+ }
+ });
+
+ /**
* periodically_call_remote
*/
$('script[data-periodical="true"]').each(function (index, e) {
@@ -155,10 +167,8 @@ jQuery(function ($) {
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');
}
});

0 comments on commit a0232d8

Please sign in to comment.