Blob Blame Raw
{% extends "repo_master.html" %}
{% from "_formhelper.html" import render_field %}

{% block title %}Issue #{{ issueid }} - {{ repo.name }}{% endblock %}
{%block tag %}home{% endblock %}

{% macro show_comment(user, date, content, aside=False) %}
  <section class="issue_comment">
    <header>
      {{ user.user | avatar(16) | safe }}
      <a href="{{ url_for('view_user', username=user.user)}}">
        {{ user.user }}
      </a> - {{ date | humanize}}
      {% if aside %}
        <aside class="issue_action">
        {% if authenticated and form %}
          <form action="{{ url_for('view_issue', username=username,
                   repo=repo.name, issueid=issueid) }}" method="post">
            {{ render_field(form.status) }}
            <input type="submit" class="submit positive button" value="Update">
            {{ form.csrf_token }}
          </form>
        {% else %}
            Status: {{ issue.status }}
        {% endif %}
        </aside>
      {% endif %}
    </header>
    <div class="comment_body">
      {% autoescape false %}
        {{ content | markdown }}
      {% endautoescape %}
    </div>
  </section>
{% endmacro %}

{% block repo %}

<h2>
    <span class="issueid">#{{ issueid }}</span> {{ issue.title }}
    {% if authenticated %}
    -  <a href="{{ url_for('edit_issue', username=username,
                  repo=repo.name, issueid=issueid) }}">
        Edit</a>
    {% endif %}
</h2>

{{ show_comment(issue.user, issue.date_created, issue.content, True) }}

{% if issue.comments %}
  {% for comment in issue.comments %}
    {{ show_comment(comment.user, comment.date_created, comment.comment) }}
  {% endfor %}
{% endif %}

<section class="issue_comment add_comment">
{% if authenticated %}
  <form action="{{ url_for('add_comment_issue', username=username,
                   repo=repo.name, issueid=issueid) }}" method="post">
    <header>
      <label for="comment">Add new comment</label>
      (supports the <a href="http://daringfireball.net/projects/markdown/syntax"
        target="_blank">Markdown syntax</a>)
    </header>
    <div>
      <textarea id="comment" name="comment" placeholder="Enter your comment here"></textarea>
      {{ form_comment.csrf_token }}
    </div>
    <div>
      <input type="submit" class="submit positive button" value="Comment">
    </div>
  </form>
{% else %}
  <p><a href="{{ url_for('auth_login') }}">Login</a> to comment on this ticket.</p>
{% endif %}
</section>

{% endblock %}