samjeston / openhub Public
Sam Jeston Working vertical 9aa3c45 · History
59 lines· 2.8 KB ·HTML
Raw
1{% extends "layout_repo.html" %}
2{% block page_title %}Branches · {% endblock %}
3{% block content %}
4{% let base = r.base() %}
5<div class="page-subheader">
6 <h2>Branches</h2>
7 <a class="btn btn-sm" href="{{ base }}/tags">{{ crate::web::fmt::icon("tag")|safe }} Tags</a>
8</div>
9{% if rows.is_empty() %}
10<div class="blankslate">
11 {{ crate::web::fmt::icon("git-branch")|safe }}
12 <h3>No branches yet</h3>
13 <p>Push to this repository to create a branch.</p>
14</div>
15{% else %}
16<div class="box">
17 <div class="box-row branch-row branch-header">
18 <div class="branch-main">Branch</div>
19 {% if rows.len() > 1 %}
20 <div class="ahead-behind" title="Commits behind and ahead of {{ r.repo.default_branch }}"><span class="ab-behind">Behind</span><span class="ab-divider"></span><span class="ab-ahead">Ahead</span></div>
21 {% endif %}
22 <div class="branch-actions"></div>
23 </div>
24 {% for row in rows %}
25 <div class="box-row branch-row">
26 <div class="branch-main">
27 <a class="branch-name" href="{{ base }}/tree/{{ crate::web::fmt::urlpath(row.branch.name) }}">{{ row.branch.name }}</a>
28 {% if row.is_default %}<span class="label">Default</span>{% endif %}
29 <div class="branch-meta">
30 Updated <time title="{{ crate::web::fmt::datetime_full(row.branch.commit.committer_time) }}">{{ crate::web::fmt::ago(row.branch.commit.committer_time) }}</time> by {{ row.branch.commit.author_name }}
31 </div>
32 </div>
33 {% if row.is_default %}
34 <div class="ahead-behind" aria-hidden="true"></div>
35 {% else %}
36 <div class="ahead-behind" title="{{ row.branch.behind }} commits behind, {{ row.branch.ahead }} commits ahead of {{ r.repo.default_branch }}">
37 <span class="ab-behind">{{ row.branch.behind }}</span>
38 <span class="ab-divider"></span>
39 <span class="ab-ahead">{{ row.branch.ahead }}</span>
40 </div>
41 {% endif %}
42 <div class="branch-actions">
43 {% if let Some(n) = row.pull %}
44 <a class="btn btn-sm" href="{{ base }}/pull/{{ n }}"><span class="state-color-open">{{ crate::web::fmt::icon("git-pull-request")|safe }}</span> #{{ n }}</a>
45 {% else if !row.is_default && row.branch.ahead > 0 %}
46 <a class="btn btn-sm" href="{{ base }}/compare/{{ crate::web::fmt::urlpath(r.repo.default_branch) }}...{{ crate::web::fmt::urlpath(row.branch.name) }}">New pull request</a>
47 {% endif %}
48 {% if r.access.write && !row.is_default %}
49 <form method="post" action="{{ base }}/branches/delete" data-confirm="Delete the branch “{{ row.branch.name }}”? This cannot be undone.">
50 <input type="hidden" name="branch" value="{{ row.branch.name }}">
51 <button class="btn btn-sm btn-danger btn-icon" type="submit" title="Delete branch">{{ crate::web::fmt::icon("trash-2")|safe }}</button>
52 </form>
53 {% endif %}
54 </div>
55 </div>
56 {% endfor %}
57</div>
58{% endif %}
59{% endblock %}