# HG changeset patch # User Jan Heylen # Date 2015-02-11 21:10:43 # Node ID a0443f20a5ecdc7ce29aee252f53fa67e8432625 # Parent 11422edf4bea5418df6f25b0a90f0d31575c66a2 javascript: on submit, don't warn for open form if the main form is the only one diff --git a/kallithea/templates/changeset/changeset_file_comment.html b/kallithea/templates/changeset/changeset_file_comment.html --- a/kallithea/templates/changeset/changeset_file_comment.html +++ b/kallithea/templates/changeset/changeset_file_comment.html @@ -157,7 +157,7 @@
%if c.authuser.username != 'default':
- ${h.form(post_url)} + ${h.form(post_url, id="main_form")}
${(_('Comments parsed using %s syntax with %s support.') % (('RST' % h.url('rst_help')), @@ -221,6 +221,14 @@ $(document).ready(function () { } }); + $('form#main_form').submit(function(){ + // if no open inline forms, disable the beforeunload check - it would + // fail in the check for the textarea we are about to submit + if(!$('.form-open').size()){ + $(window).off('beforeunload'); + } + }); + $('#preview-btn').click(function(){ var _text = $('#text').val(); if(!_text){