Changeset - 5cc8e1d7ee21
[Not reviewed]
default
0 2 0
Mads Kiilerich - 10 years ago 2015-08-17 01:11:42
madski@unity3d.com
comments: fix warning when unloading page with unsaved comments

e87baa8f1c5b broke the existing check. Instead, only set the
comment-inline-form class when it actually is an inline form and use that class
for finding comments.
2 files changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/base.js
Show inline comments
 
@@ -680,13 +680,14 @@ function _comment_div_append_add($commen
 
        comment_div_state($comment_div, f_path, line_no, true);
 
    });
 
}
 

	
 
// append a comment form to $comment_div
 
function _comment_div_append_form($comment_div, f_path, line_no) {
 
    var $form_div = $($('#comment-inline-form-template').html().format(f_path, line_no));
 
    var $form_div = $($('#comment-inline-form-template').html().format(f_path, line_no))
 
        .addClass('comment-inline-form');
 
    $comment_div.append($form_div);
 
    var $form = $comment_div.find("form");
 

	
 
    $form.submit(function(e) {
 
        e.preventDefault();
 

	
kallithea/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -49,13 +49,13 @@
 

	
 

	
 
## expanded with .format(f_path, line_no)
 
## TODO: don't assume line_no is globally unique ...
 
<%def name="comment_inline_form()">
 
<div id='comment-inline-form-template' style="display:none">
 
  <div class="comment-inline-form ac">
 
  <div class="ac">
 
  %if c.authuser.username != 'default':
 
    ${h.form('#', class_='inline-form')}
 
      <div id="edit-container_{1}" class="clearfix">
 
        <div class="comment-help">${_('Commenting on line {1}.')}
 
          ${(_('Comments parsed using %s syntax with %s support.') % (
 
                 ('<a href="%s">RST</a>' % h.url('rst_help')),
 
@@ -199,13 +199,14 @@
 
<script>
 

	
 
$(document).ready(function () {
 
   MentionsAutoComplete($('#text'), $('#mentions_container'), _USERS_AC_DATA, _GROUPS_AC_DATA);
 

	
 
   $(window).on('beforeunload', function(){
 
      if($('.form-open').size() || $('textarea#text').val()){
 
      if($('.comment-inline-form textarea[name=text]').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.';
 
      }
 
   });
 

	
0 comments (0 inline, 0 general)