Mercurial > kallithea
changeset 4813:749b5e8cead3
comment: warn before leaving page with open comments
author | Jan Heylen <heyleke@gmail.com> |
---|---|
date | Fri, 30 Jan 2015 20:57:02 +0100 |
parents | d7420a74b98d |
children | d95ea48af67b |
files | kallithea/templates/changeset/changeset_file_comment.html |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/templates/changeset/changeset_file_comment.html Tue Jul 08 20:33:50 2014 -0500 +++ b/kallithea/templates/changeset/changeset_file_comment.html Fri Jan 30 20:57:02 2015 +0100 @@ -201,6 +201,14 @@ $(document).ready(function () { MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA); + $(window).on('beforeunload', function(){ + if($('.form-open').size() || $('textarea#text').val()){ + // this message will not be displayed on all browsers + // (e.g. some versions of Firefox), but the user will still be warned + return 'There are uncommitted comments.'; + } + }); + $('#preview-btn').click(function(){ var _text = $('#text').val(); if(!_text){