Permalink
Browse files

clean up event usage a bit to reduce chance of fast clicking people s…

…aving stuff unintentionally
  • Loading branch information...
1 parent 8b56997 commit 61310eb247c7f5e563c3590b7ee7a8f0e8e1a16d Glenn Murray committed Oct 24, 2008
Showing with 6 additions and 5 deletions.
  1. +1 −1 app/views/preview/_show.html.haml
  2. +5 −4 public/javascripts/page_preview.js
@@ -1,3 +1,3 @@
= javascript_include_tag 'page_preview'
%p.buttons{:style => 'float: left; padding-right: 5px;' }
- %input{:type=>'submit', :id => 'show-preview', :value => 'Preview', :class => 'button', :onclick => 'preview(this)'}
+ %input{:type=>'submit', :id => 'show-preview', :value => 'Preview', :class => 'button', :onclick => 'return preview(this)'}
@@ -7,10 +7,11 @@ function preview(button) {
form.setAttribute('target', 'page-preview');
form.setAttribute('action', '/admin/preview');
+
+ form.submit();
+ form.target = oldtarget;
+ form.action = oldaction;
- window.setTimeout(function() {
- form.target = oldtarget;
- form.action = oldaction;
- }, 1000);
+ return false;
}

0 comments on commit 61310eb

Please sign in to comment.