Mercurial > kallithea
changeset 2189:3052f90c568a beta
fixed main comments, prevent from sending inline comments if text is empty
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 14 Apr 2012 22:40:47 +0200 |
parents | 56e96d4e9f6e |
children | 64f7cf8f6a33 |
files | rhodecode/controllers/changeset.py rhodecode/public/js/rhodecode.js rhodecode/templates/changeset/changeset_file_comment.html |
diffstat | 3 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/controllers/changeset.py Sat Apr 14 22:15:45 2012 +0200 +++ b/rhodecode/controllers/changeset.py Sat Apr 14 22:40:47 2012 +0200 @@ -370,6 +370,10 @@ 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 @@ data.update(comm.get_dict()) data.update({'rendered_text': render('changeset/changeset_comment_block.html')}) + return data @jsonify
--- a/rhodecode/public/js/rhodecode.js Sat Apr 14 22:15:45 2012 +0200 +++ b/rhodecode/public/js/rhodecode.js Sat Apr 14 22:40:47 2012 +0200 @@ -196,6 +196,9 @@ }; 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 @@ return } + if(text == ""){ + return + } + var success = function(o){ YUD.removeClass(tr, 'form-open'); removeInlineForm(f); @@ -453,7 +460,7 @@ n.parentNode.removeChild(n); // scann nodes, and attach add button to last one - placeAddButton(root); + placeAddButton(root); } ajaxPOST(url,postData,success); }
--- a/rhodecode/templates/changeset/changeset_file_comment.html Sat Apr 14 22:15:45 2012 +0200 +++ b/rhodecode/templates/changeset/changeset_file_comment.html Sat Apr 14 22:40:47 2012 +0200 @@ -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">