Changeset - 3052f90c568a
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 14 years ago 2012-04-14 22:40:47
marcin@python-works.com
fixed main comments, prevent from sending inline comments if text is empty
3 files changed with 16 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/changeset.py
Show inline comments
 
@@ -370,6 +370,10 @@ class ChangesetController(BaseRepoContro
 
            line_no=request.POST.get('line')
 
        )
 
        Session.commit()
 
        if not request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            return redirect(h.url('changeset_home', repo_name=repo_name,
 
                                  revision=revision))
 

	
 
        data = {
 
           'target_id': h.safeid(h.safe_unicode(request.POST.get('f_path'))),
 
        }
 
@@ -378,6 +382,7 @@ class ChangesetController(BaseRepoContro
 
            data.update(comm.get_dict())
 
            data.update({'rendered_text':
 
                         render('changeset/changeset_comment_block.html')})
 

	
 
        return data
 

	
 
    @jsonify
rhodecode/public/js/rhodecode.js
Show inline comments
 
@@ -196,6 +196,9 @@ function ypjax(url,container,s_call,f_ca
 
};
 

	
 
var ajaxPOST = function(url,postData,success) {
 
	// Set special header for ajax == HTTP_X_PARTIAL_XHR
 
	YUC.initHeader('X-PARTIAL-XHR',true);
 
	
 
	var toQueryString = function(o) {
 
	    if(typeof o !== 'object') {
 
	        return false;
 
@@ -423,6 +426,10 @@ var injectInlineForm = function(tr){
 
			  return
 
		  }
 
		  
 
		  if(text == ""){
 
			  return
 
		  }
 
		  
 
		  var success = function(o){
 
			  YUD.removeClass(tr, 'form-open');
 
			  removeInlineForm(f);			  
 
@@ -453,7 +460,7 @@ var deleteComment = function(comment_id)
 
        n.parentNode.removeChild(n);
 

	
 
        // scann nodes, and attach add button to last one
 
        placeAddButton(root);        
 
        placeAddButton(root);
 
    }
 
    ajaxPOST(url,postData,success);
 
}
rhodecode/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -87,7 +87,9 @@
 
    </div>
 

	
 
    %for co in c.comments:
 
        ${comment_block(co)}
 
        <div id="comment-tr-${co.comment_id}">
 
          ${comment_block(co)}
 
        </div>
 
    %endfor
 
    %if c.rhodecode_user.username != 'default':
 
    <div class="comment-form">
0 comments (0 inline, 0 general)