From 4350fb11c8d0cb1973980b3256ce316164629033 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Dec 24 2015 09:22:04 +0000 Subject: Remove debug code and make setting the action of the reply buttons accessible --- diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index d3a9ae6..2f50de2 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -490,11 +490,8 @@ function setup_edit_btns() { type: 'GET', dataType: 'html', success: function(res) { - console.log(commentid); var el = $('#comment-' + commentid); - console.log(el); var sec = el.parent().find('.issue_comment'); - console.log(sec); $(sec).hide(); el.parent().find('.issue_actions').hide(); $(sec).after(res); @@ -508,6 +505,22 @@ function setup_edit_btns() { }); }; +function setup_reply_btns() { + $(".reply").unbind(); + $( ".reply" ).click( + function() { + var _section = $(this).closest('.card-block'); + var _comment = _section.find('.comment_body'); + var _text = _comment.text().split("\n"); + var _output = new Array(); + for (var cnt=0; cnt < _text.length; cnt++) { + _output[cnt] = '> ' + _text[cnt]; + } + $( "#comment" ).val(_output.join("\n")); + } + ); +}; + $(document).ready(function() { $( ".commit_msg_txt" ).hide(); @@ -612,19 +625,6 @@ function setup_edit_btns() { } ); - $( ".reply" ).click( - function() { - var _section = $(this).parent().parent().parent(); - var _comment = _section.find('.comment_body'); - var _text = _comment.text().split("\n"); - var _output = new Array(); - for (cnt = 0; cnt < _text.length - 1; cnt ++) { - _output[cnt] = '> ' + jQuery.trim(_text[cnt + 1]); - } - $( "#comment" ).val(_output.join("\n")); - } - ); - $( "#clear_comment").click( function() { $( "#comment" ).val(""); @@ -667,6 +667,7 @@ function setup_edit_btns() { ); setup_edit_btns(); + setup_reply_btns(); var cur_hash = null; @@ -818,6 +819,7 @@ source.addEventListener('message', function(e) { var data = $.parseJSON(e.data); process_event(data, "{{ request.uid }}"); setup_edit_btns(); + setup_reply_btns(); }, false); {% endif %}