From f6a0788afaba3a1a26352517d5901d62a5a3a9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Sun, 17 Aug 2014 17:42:22 -0700 Subject: [PATCH] post comment directly from issue page --- issue/templates/issue/issue.html | 49 +++++++++++++++++++------------- issue/views.py | 6 ++++ 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/issue/templates/issue/issue.html b/issue/templates/issue/issue.html index 7e6d723..2e38d11 100644 --- a/issue/templates/issue/issue.html +++ b/issue/templates/issue/issue.html @@ -2,10 +2,15 @@ {% load humanize %} {% load django_markdown %} +{% load bootstrap_tags %} {% load issue_tags %} {% block issuetab %} class="active"{% endblock %} +{% block media %} +{{ form.media }} +{% endblock %} + {% block content %} @@ -67,28 +72,32 @@ {% endfor %} -
- -
- Add a comment +
+
+ Comment
- -
- Edit this issue +
+ {% if perm.add_comment %} +
+ {% csrf_token %} +
+ {{ form.comment }} +
+
+ {% if perm.manage_issue %} + {% if issue.closed %} + Reopen this issue + {% else %} + Close this issue + {% endif %} + {% endif %} + +
+
+ {% else %} + To post a comment, please login. + {% endif %}
- -
- {% if issue.closed %} - Reopen this issue - {% else %} - Close this issue - {% endif %} -
- - -
diff --git a/issue/views.py b/issue/views.py index 6b44af7..2f5b170 100644 --- a/issue/views.py +++ b/issue/views.py @@ -432,12 +432,18 @@ def issue(request, project, issue): events = issue.events.all() + if request.user.has_perm('create_comment', project): + form = CommentForm(request.POST or None) + else: + form = None + c = { 'labels': labels, 'milestones': milestones, 'project': project, 'issue': issue, 'events': events, + 'form': form, } return render(request, 'issue/issue.html', c)