michal/tit

Browse tree · Show commit · Download archive

Blob: templates/repository.html

Raw · Blame

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

{% if has_head && page_kind != "summary" %}
  <p><a href="/{{ owner }}/{{ repository }}/tree/{{ commit_id }}">Browse tree</a> · <a href="/{{ owner }}/{{ repository }}/commit/{{ commit_id }}">Show commit</a> · <a href="/{{ owner }}/{{ repository }}/archive/{{ commit_id }}.tar">Download archive</a></p>
{% endif %}

{% if page_kind == "summary" %}
{% if has_head %}
  <nav class="repository-toolbar" aria-label="Repository files">
    <strong>{{ default_branch }}</strong>
    <a href="/{{ owner }}/{{ repository }}/tree/{{ commit_id }}">Browse files</a>
    <a href="/{{ owner }}/{{ repository }}/commit/{{ commit_id }}"><code title="{{ commit_id }}">{{ commit_id|short_id }}</code></a>
    <a href="/{{ owner }}/{{ repository }}/archive/{{ commit_id }}.tar">Download archive</a>
  </nav>
{% endif %}
  <div class="repository-summary-layout">
  <div class="repository-summary-main">
{% if has_head %}
  <section class="repository-panel repository-file-panel" aria-labelledby="files-heading">
    <h2 id="files-heading">Files</h2>
    <div class="table-scroll"><table class="repository-file-list">
      <thead><tr><th scope="col">Name</th><th scope="col">Type</th><th scope="col">Object</th></tr></thead>
      <tbody>
{% for item in entries %}
        <tr>
          <th scope="row"><a href="/{{ owner }}/{{ repository }}/{{ item.href }}">{{ item.name }}</a></th>
          <td>{{ item.kind }}</td>
          <td><code title="{{ item.id }}">{{ item.id|short_id }}</code></td>
        </tr>
{% endfor %}
      </tbody>
    </table></div>
  </section>
{% else %}
  <p>This repository has no commits.</p>
{% endif %}
  </div>
  <aside class="repository-sidebar" aria-label="Repository information">
  <section class="repository-panel" aria-labelledby="about-heading">
    <h2 id="about-heading">About</h2>
{% if description != "" %}
    <p class="repository-description">{{ description }}</p>
{% else %}
    <p>No description is available.</p>
{% endif %}
    <p>Created <time datetime="{{ created_at }}">{{ created_at|human_time }}</time></p>
  </section>
  <section class="repository-panel" aria-labelledby="clone-heading">
    <h2 id="clone-heading">Clone</h2>
    <dl>
      <dt>HTTP</dt><dd><code>{{ http_clone_url }}</code></dd>
      <dt>SSH</dt><dd><code>{{ ssh_clone_url }}</code></dd>
    </dl>
  </section>
  <section class="repository-panel" aria-labelledby="recent-heading">
    <h2 id="recent-heading">Recent</h2>
    <h3>Commits</h3>
{% if history.is_empty() %}
    <p>No commits are available.</p>
{% else %}
    <ol class="repository-recent-list">
{% for item in history %}
      <li><a href="/{{ owner }}/{{ repository }}/commit/{{ item.id }}" aria-label="Commit {{ item.id }}"><code title="{{ item.id }}">{{ item.id|short_id }}</code></a> {{ item.summary }}</li>
{% endfor %}
    </ol>
    <p><a href="/{{ owner }}/{{ repository }}/commits">View all commits</a></p>
{% endif %}
    <h3>Tags</h3>
{% if tags.is_empty() %}
    <p>No tags are available.</p>
{% else %}
    <ul class="repository-recent-list">
{% for tag in tags %}
      <li><a href="/{{ owner }}/{{ repository }}/commit/{{ tag.id }}">{{ tag.name }}</a> · <time datetime="{{ tag.committed_at }}">{{ tag.committed_at|human_time }}</time></li>
{% endfor %}
    </ul>
    <p><a href="/{{ owner }}/{{ repository }}/refs">View all refs</a></p>
{% endif %}
  </section>
  </aside>
  </div>
{% if has_readme %}
  <section class="repository-panel repository-readme" aria-labelledby="readme-heading">
    <h2 id="readme-heading">{{ readme_path }}</h2>
{% if readme_binary %}
    <p>Binary README content cannot be shown.</p>
{% else %}
    <div class="markdown">{{ readme_html|safe }}</div>
{% endif %}
  </section>
{% endif %}
{% endif %}

{% if page_kind == "commits" %}
  <h2>All commits</h2>
{% if has_head %}
  <ol class="commit-list">
{% for item in history %}
    <li><a href="/{{ owner }}/{{ repository }}/commit/{{ item.id }}" aria-label="Commit {{ item.id }}"><code title="{{ item.id }}">{{ item.id|short_id }}</code></a> {{ item.summary }} — {{ item.author_name }}</li>
{% endfor %}
  </ol>
{% if has_previous_page || has_next_page %}
  <nav class="pagination" aria-label="Commit pages">
{% if has_previous_page %}
    <a href="/{{ owner }}/{{ repository }}/commits?page={{ previous_page }}">Newer commits</a>
{% endif %}
{% if has_next_page %}
    <a href="/{{ owner }}/{{ repository }}/commits?page={{ next_page }}">Older commits</a>
{% endif %}
  </nav>
{% endif %}
{% else %}
  <p>This repository has no commits.</p>
{% endif %}
{% endif %}

{% if page_kind == "refs" %}
  <h2>Refs</h2>
  <div class="table-scroll"><table>
    <thead><tr><th scope="col">Name</th><th scope="col">Target</th><th scope="col">Details</th></tr></thead>
    <tbody>
{% for item in refs %}
      <tr>
        <th scope="row">{{ item.name }}</th>
        <td><a href="/{{ owner }}/{{ repository }}/commit/{{ item.href }}" aria-label="Commit {{ item.target }}"><code title="{{ item.target }}">{{ item.target|short_id }}</code></a></td>
        <td>{% if item.symbolic != "" %}→ {{ item.symbolic }}{% endif %}{% if item.peeled != "" %}peeled <code title="{{ item.peeled }}">{{ item.peeled|short_id }}</code>{% endif %}</td>
      </tr>
{% endfor %}
    </tbody>
  </table></div>
{% endif %}

{% if page_kind == "tree" %}
  <h2>Tree{% if path != "" %}: {{ path }}{% endif %}</h2>
  <div class="table-scroll"><table>
    <thead><tr><th scope="col">Mode</th><th scope="col">Type</th><th scope="col">Name</th><th scope="col">Object</th></tr></thead>
    <tbody>
{% for item in entries %}
      <tr>
        <td><code>{{ item.mode }}</code></td><td>{{ item.kind }}</td>
        <th scope="row"><a href="/{{ owner }}/{{ repository }}/{{ item.href }}">{{ item.name }}</a></th>
        <td><code title="{{ item.id }}">{{ item.id|short_id }}</code></td>
      </tr>
{% endfor %}
    </tbody>
  </table></div>
{% endif %}

{% if page_kind == "blob" %}
  <h2>Blob: {{ path }}</h2>
  <p><a href="/{{ owner }}/{{ repository }}/raw/{{ commit_id }}/{{ encoded_path }}">Raw</a> · <a href="/{{ owner }}/{{ repository }}/blame/{{ commit_id }}/{{ encoded_path }}">Blame</a></p>
{% if blob_binary %}
  <p>Binary content cannot be shown. Use the raw link to download it.</p>
{% else %}
  <pre>{{ blob_content }}</pre>
{% endif %}
{% endif %}

{% if page_kind == "commit" %}
  <article>
    <h2>Commit <code title="{{ commit.id }}">{{ commit.id|short_id }}</code></h2>
    <p><a href="/{{ owner }}/{{ repository }}/commit/{{ commit.id }}.patch">Download patch</a></p>
    <dl>
      <dt>Author</dt><dd>{{ commit.author_name }} &lt;{{ commit.author_email }}&gt;</dd>
      <dt>Committed</dt><dd><time datetime="{{ commit.committed_at }}">{{ commit.committed_at|human_time }}</time></dd>
      <dt>Tree</dt><dd><a href="/{{ owner }}/{{ repository }}/tree/{{ commit.id }}"><code title="{{ commit.tree }}">{{ commit.tree|short_id }}</code></a></dd>
{% for parent in commit.parents %}
      <dt>Parent</dt><dd><a href="/{{ owner }}/{{ repository }}/commit/{{ parent }}"><code title="{{ parent }}">{{ parent|short_id }}</code></a> · <a href="/{{ owner }}/{{ repository }}/diff/{{ parent }}/{{ commit.id }}">Diff</a></dd>
{% endfor %}
    </dl>
    <pre>{{ commit.message }}</pre>
  </article>
{% endif %}

{% if page_kind == "diff" %}
  <h2>Diff</h2>
  <p><code title="{{ secondary_id }}">{{ secondary_id|short_id }}</code> → <code title="{{ commit_id }}">{{ commit_id|short_id }}</code></p>
{% for file in diffs %}
  <section>
    <h3>{{ file.path }}</h3>
    <p>Mode <code>{{ file.old_mode }}</code> → <code>{{ file.new_mode }}</code>; object <code title="{{ file.old_id }}">{{ file.old_id|short_id }}</code> → <code title="{{ file.new_id }}">{{ file.new_id|short_id }}</code></p>
{% if file.binary %}
    <p>Binary content changed.</p>
{% else %}
    <pre>{{ file.hunks }}</pre>
{% endif %}
  </section>
{% endfor %}
{% endif %}

{% if page_kind == "blame" %}
  <h2>Blame: {{ path }}</h2>
  <p><a href="/{{ owner }}/{{ repository }}/blob/{{ commit_id }}/{{ encoded_path }}">Blob</a> · <a href="/{{ owner }}/{{ repository }}/raw/{{ commit_id }}/{{ encoded_path }}">Raw</a></p>
{% if blob_binary %}
  <p>Binary content cannot be blamed.</p>
{% else %}
  <ol class="blame-list">
{% for item in blame %}
    <li value="{{ item.start_line }}"><a href="/{{ owner }}/{{ repository }}/commit/{{ item.commit_id }}"><code title="{{ item.commit_id }}">{{ item.commit_id|short_id }}</code></a> current lines {{ item.start_line }}–{{ item.current_end_line }}; source lines {{ item.source_start_line }}–{{ item.source_end_line }}{% if item.source_path != "" %} from {{ item.source_path }}{% endif %}<pre>{{ item.content }}</pre></li>
{% endfor %}
  </ol>
{% endif %}
{% endif %}

{% if page_kind == "search" %}
  <h2>Source search</h2>
{% if has_head %}
  <form method="get" action="/{{ owner }}/{{ repository }}/search">
    <div class="field">
      <label for="search-query">Text</label>
      <input id="search-query" name="q" type="search" value="{{ search_query }}" required maxlength="256">
    </div>
    <div class="field">
      <label for="search-ref">Ref</label>
      <select id="search-ref" name="ref">
{% for item in search_refs %}
        <option value="{{ item.name }}"{% if item.selected %} selected{% endif %}>{{ item.name }}</option>
{% endfor %}
      </select>
    </div>
    <button type="submit">Search</button>
  </form>
{% if search_done %}
  <p>Scanned {{ search_files }} files and {{ search_bytes }} bytes. Found {{ search_matches.len() }} matching lines.{% if search_truncated %} More results exist. Refine the search text.{% endif %}</p>
  <ol class="search-results">
{% for item in search_matches %}
    <li><a href="/{{ owner }}/{{ repository }}/blob/{{ commit_id }}/{{ item.encoded_path }}">{{ item.path }}:{{ item.line_number }}</a><pre>{{ item.line }}</pre></li>
{% endfor %}
  </ol>
{% endif %}
{% else %}
  <p>This repository has no commits to search.</p>
{% endif %}
{% endif %}
{% endblock %}