Mercurial > kallithea
changeset 4825:a0443f20a5ec
javascript: on submit, don't warn for open form if the main form is the only one
author | Jan Heylen <heyleke@gmail.com> |
---|---|
date | Wed, 11 Feb 2015 21:10:43 +0100 |
parents | 11422edf4bea |
children | 2346f7b1b82a |
files | kallithea/templates/changeset/changeset_file_comment.html |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/templates/changeset/changeset_file_comment.html Wed Feb 18 23:48:47 2015 +0100 +++ b/kallithea/templates/changeset/changeset_file_comment.html Wed Feb 11 21:10:43 2015 +0100 @@ -157,7 +157,7 @@ <div class="comments"> %if c.authuser.username != 'default': <div class="comment-form ac"> - ${h.form(post_url)} + ${h.form(post_url, id="main_form")} <div id="edit-container" class="clearfix"> <div class="comment-help"> ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')), @@ -221,6 +221,14 @@ } }); + $('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){