diff --git a/pagure/static/pagure.css b/pagure/static/pagure.css index 2c70843..c7cf49a 100644 --- a/pagure/static/pagure.css +++ b/pagure/static/pagure.css @@ -448,7 +448,7 @@ table.list .assigned { color: #aaa; } -.issue_comment, .add_comment, .project_list { +.issue_comment. .request_comment, .add_comment, .project_list { background-color: #fff; border-radius: 10px; margin-bottom: 1em; @@ -456,19 +456,25 @@ table.list .assigned { } .issue_comment > div, -.issue_comment > form > div { +.issue_comment > form > div, +.request_comment > div, +.request_comment > form > div { padding: .2em .5em; } -.issue_comment > p { +.issue_comment > p. +request_comment > p { padding: .5em; } -.issue_comment p { +.issue_comment p, +request_comment p { margin: .5em 0 1em; } .issue_comment > header, .issue_comment > form > header, +.request_comment > header, +.request_comment > form > header, .file_content > header, .commit_diff > header { diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index 3ffd3bc..e0be1ab 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -1,5 +1,5 @@ {% extends "repo_master.html" %} -{% from "_formhelper.html" import render_field_in_row %} +{% from "_formhelper.html" import render_field_in_row, show_comment %} {% block title %}Pull request #{{ requestid }} - {{ repo.name }}{% endblock %} {%block tag %}home{% endblock %} @@ -158,6 +158,52 @@ +{% if pull_request and pull_request.comments%} +
+{% for comment in pull_request.discussion %} + {% if not comment.commit_id %} + {{ show_comment(comment.user, comment.date_created, comment.comment, + loop.index) }} + {% endif %} +{% endfor %} +
+{% endif %} + +
+{% if authenticated and mergeform and pull_request %} +
+ {{ mergeform.csrf_token }} +
+ + (supports the Markdown syntax) +
+
+ +
+
+ +
+
+
+
+
+ + +
+
+
+{% else %} +

Login to comment on this ticket.

+{% endif %} +
+ {% endblock %} @@ -223,6 +269,46 @@ } } ); + + $( "#tabs" ).tabs(); + + $( "#tabs" ).on('tabsactivate', + function(event, ui) { + if (ui.newPanel.selector == '#preview') { + var _text = $( "#comment" ).val(); + var _url = "{{ url_for('markdown_preview') }}"; + $.ajax({ + url: _url , + type: 'POST', + data: { + content: _text, + csrf_token: "{{ mergeform.csrf_token.current_token }}", + }, + dataType: 'html', + success: function(res) { + $( "#preview" ).html(res); + }, + error: function() { + alert('Unable to generate preview!'); + } + }); + return false; + } + } + ); + + $( ".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")); + } + ); {% endif %} });