From 6df8a0dc76f2f3f63e72929e051b8dd5890c764c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 28 2014 11:29:52 +0000 Subject: Add button and logic to reply to a comment When pressing the button, the content of the comment is copied into the new comment section, format is lost but it allows people to easily reply to a comment. --- diff --git a/progit/static/progit.css b/progit/static/progit.css index a9806d9..e769b94 100644 --- a/progit/static/progit.css +++ b/progit/static/progit.css @@ -665,3 +665,8 @@ ul.changes { .header { padding: .5em 0; } + +.reply { + cursor: pointer; + padding-right: 1em; +} diff --git a/progit/templates/issue.html b/progit/templates/issue.html index c62f734..d332adf 100644 --- a/progit/templates/issue.html +++ b/progit/templates/issue.html @@ -11,6 +11,11 @@ {{ user.user }} - {{ date | humanize}} +
{% autoescape false %} @@ -113,6 +118,20 @@ $(function() { } } ); + + $( ".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")); + } + ); + }); {% endblock %}