michal/tit

Browse tree · Show commit · Download archive

Blob: templates/pull_requests.html

Raw · Blame

{% extends "base.html" %}
{% block title %}Pull requests · {{ owner }}/{{ repository }} · tit{% endblock %}
{% block content %}
  <header class="repository-header">
    <h1><a href="/{{ owner }}">{{ owner }}</a>/<a href="/{{ owner }}/{{ repository }}">{{ repository }}</a></h1>
{% include "repository-nav.html" %}
  </header>

  <header class="page-section-header">
    <h2>Pull requests</h2>
  </header>
  <section class="collection-panel" aria-label="Pull requests">
    <form class="filter-form" method="get" action="/{{ owner }}/{{ repository }}/pulls">
      <div class="field">
        <label for="pull-request-state">State</label>
        <select id="pull-request-state" name="state">
          <option value="open"{% if state_open %} selected{% endif %}>Open</option>
          <option value="closed"{% if state_closed %} selected{% endif %}>Closed</option>
          <option value="merged"{% if state_merged %} selected{% endif %}>Merged</option>
          <option value="all"{% if state_all %} selected{% endif %}>All</option>
        </select>
      </div>
      <button type="submit">Filter</button>
    </form>
{% if pull_requests.is_empty() %}
    <p>This repository has no pull requests.</p>
{% else %}
    <ol class="issue-list">
{% for pull_request in pull_requests %}
      <li>
        <a class="issue-title" href="/{{ owner }}/{{ repository }}/pulls/{{ pull_request.number }}">#{{ pull_request.number }} {{ pull_request.title }}</a>
        <span class="issue-meta">{{ pull_request.state }} · opened by {{ pull_request.author }} · updated <time datetime="{{ pull_request.updated_at }}">{{ pull_request.updated_at|human_time }}</time></span>
      </li>
{% endfor %}
    </ol>
{% if has_previous || has_next %}
    <nav class="pagination" aria-label="Pull-request pages">
{% if has_previous %}
      <a href="/{{ owner }}/{{ repository }}/pulls?state={{ state }}&page={{ previous_page }}">Newer pull requests</a>
{% endif %}
{% if has_next %}
      <a href="/{{ owner }}/{{ repository }}/pulls?state={{ state }}&page={{ next_page }}">Older pull requests</a>
{% endif %}
    </nav>
{% endif %}
{% endif %}
{% if !can_create %}
    <p class="collection-action">You need write access to open a pull request.</p>
{% endif %}
  </section>

{% if can_create %}
  <section aria-labelledby="new-pull-request-heading">
    <h2 id="new-pull-request-heading">Open a pull request</h2>
    <form method="post" action="/{{ owner }}/{{ repository }}/pulls">
      <input type="hidden" name="csrf" value="{{ csrf }}">
      <div class="field">
        <label for="pull-request-title">Title</label>
        <input id="pull-request-title" name="title" maxlength="200" required>
      </div>
      <div class="field">
        <label for="pull-request-body">Description (Markdown)</label>
        <textarea id="pull-request-body" name="body" maxlength="262144" rows="10"></textarea>
      </div>
      <div class="field">
        <label for="pull-request-base">Base branch</label>
        <input id="pull-request-base" name="base-ref" list="repository-branches" maxlength="1024" value="{{ default_branch }}" required>
      </div>
      <div class="field">
        <label for="pull-request-head">Head branch</label>
        <input id="pull-request-head" name="head-ref" list="repository-branches" maxlength="1024" placeholder="refs/heads/feature" required>
      </div>
      <datalist id="repository-branches">
{% for branch in branches %}
        <option value="{{ branch }}"></option>
{% endfor %}
      </datalist>
      <button type="submit">Open pull request</button>
    </form>
  </section>
{% endif %}
{% endblock %}