summaryrefslogtreecommitdiffstats
path: root/gitsrht/templates/refs.html
blob: 4a7c985f8fe621d5a374d27eb59d5d09f087ab39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{% extends "repo.html" %}
{% import "utils.html" as utils %}
{% block title %}
<title>{{repo.owner.canonical_name}}/{{repo.name}} refs - {{cfg("sr.ht", "site-name")}} git</title>
{% endblock %}
{% block content %}
<div class="container">
  <div class="row">
    <div class="col-md-8">
      <div class="event-list">
        {% for tag in tags %}
        {% set ref = tag[0] %}
        {% set tag = tag[1] %}
        {% if isinstance(tag, pygit2.Commit) %}
        {% set commit = tag %}
        {% else %}
        {% set commit = git_repo.get(tag.target) %}
        {% endif %}
        <div class="event">
          <h4 style="margin-bottom: 0.5rem">
            {% if isinstance(tag, pygit2.Commit) %}
              {{ref[len("refs/tags/"):]}}
            {% else %}
            <a href="#">
              {{tag.name}}
            </a>
            {% endif %}
            <small class="pull-right text-muted">
              {{commit_time(tag) | date}}
              <a
                style="margin-left: 0.5rem"
                href="{{url_for("repo.archive",
                  owner=repo.owner.canonical_name,
                  repo=repo.name, ref=tag.name)}}"
              >.tar.gz {{icon("caret-right")}}</a>
              <a
                style="margin-left: 0.5rem"
                href="{{url_for("repo.tree",
                  owner=repo.owner.canonical_name,
                  repo=repo.name, ref=tag.name)}}"
              >browse {{icon("caret-right")}}</a>
            </small>
          </h4>
          {% if tag.message %}
          <pre style="padding-bottom: 0;">{{tag.message}}</pre>
          {% endif %}
        </div>
        {% endfor %}
        {{ pagination() }}
      </div>
    </div>
    <div class="col-md-4">
      <h3>Branches</h3>
      <div class="event-list">
        {% for branch in branches %}
        {% set name = branch[0] %}
        {% set commit = branch[2] %}
        {% set branch = branch[1] %}
        <div class="event">
          {{name}}
          {{ utils.commit_event(repo, commit, commit_time,
            trim_commit, skip_body=True) }}
          <a
            href="{{url_for("repo.tree",
              owner=repo.owner.canonical_name,
              repo=repo.name, ref=name)}}"
            class="btn btn-block {{ "btn-primary"
                if branch.name == git_repo.default_branch().name
                else "btn-default" }}"
          >browse {{icon("caret-right")}}</a>
        </div>
        {% endfor %}
      </div>
    </div>
  </div>
</div>
{% endblock %}