Skip to content

Instantly share code, notes, and snippets.

@manuels
Created October 19, 2011 20:15
Show Gist options
  • Save manuels/1299532 to your computer and use it in GitHub Desktop.
Save manuels/1299532 to your computer and use it in GitHub Desktop.
diff --git a/public/javascripts/publisher.js b/public/javascripts/publisher.js
index baf4e0d..a63f58c 100644
--- a/public/javascripts/publisher.js
+++ b/public/javascripts/publisher.js
@@ -362,8 +362,11 @@ var Publisher = {
return false;
}
Publisher.hidePreview();
+ Publisher._pendingSubmit = true;
},
onSubmit: function(data, json, xhr){
+ Publisher._pendingSubmit = false;
+
$("#photodropzone").find('li').remove();
$("#publisher textarea").removeClass("with_attachments").css('paddingBottom', '');
},
@@ -446,6 +449,9 @@ var Publisher = {
$.post('/preview.json', {
text: $('#status_message_fake_text').val()
}, function(data){
+ if (Publisher._pendingSubmit)
+ return;
+
$('#preview').hide();
$('#publisher_textarea_wrapper').hide();
$('#preview-edit').show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment