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 }}/{{ repository }}">{{ owner }}/{{ repository }}</a></h1>
{% include "repository-nav.html" %}
  </header>

  <h2>Pull requests</h2>
{% 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 href="/{{ owner }}/{{ repository }}/pulls/{{ pull_request.number }}">#{{ pull_request.number }} {{ pull_request.title }}</a> — {{ pull_request.state }}, opened by {{ pull_request.author }}, updated <time datetime="{{ pull_request.updated_at }}">{{ pull_request.updated_at|human_time }}</time></li>
{% endfor %}
  </ol>
{% endif %}

{% 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="refs/heads/main" 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>
{% else %}
  <p>You need write access to open a pull request.</p>
{% endif %}
{% endblock %}