OXYGENHUB
# 42cd46c9b09e oxygenhub / templates / repo_tabs.html
9.5 KiB · HTML · last changed Drops: per-user gists, each a small hidden Oxygen repository (#279) 16 days ago source blame history raw
1
{% macro tabs(repo, tab) %}
2
{% if repo.is_drop %}{# A drop (#279): its own bar, none of a repository's tabs. #}
3
<nav class="tabs" aria-label="Drop">
4
  <div class="tabs-in">
5
    <span class="crumb"><a href="/{{ repo.owner }}">{{ repo.owner }}</a> / <a href="/{{ repo.owner }}/drops">drops</a> / <a href="{{ repo.url }}"><strong>{% if repo.drop_title.is_empty() %}{{ repo.name }}{% else %}{{ repo.drop_title }}{% endif %}</strong></a> <span class="vis vis-{% if repo.visibility == "public" %}public{% else %}private{% endif %}">{% if repo.visibility == "public" %}public{% else %}secret{% endif %}</span></span>
6
    <a href="{{ repo.url }}"{% if tab == "code" %} class="on" aria-current="page"{% endif %}>Files</a>
7
    <a href="{{ repo.url }}/changes/{{ repo.default_bookmark }}"{% if tab == "changes" %} class="on" aria-current="page"{% endif %}>History</a>
8
  </div>
9
</nav>
10
{% else %}
11
<nav class="tabs" aria-label="Repository">
12
  <div class="tabs-in">
13
    <span class="crumb"><a href="/{{ repo.owner }}">{{ repo.owner }}</a> / <a href="{{ repo.url }}"><strong>{{ repo.name }}</strong></a>{% if repo.archived %} <span class="tag warn" title="This repository is archived: read-only">archived</span>{% endif %} <span class="vis vis-{{ repo.visibility }}" title="{% if repo.visibility == "public" %}Anyone can see this repository{% else if repo.visibility == "internal" %}Anyone signed in to this hub can see this repository{% else %}Only people given access can see this repository{% endif %}"><span aria-hidden="true">{% if repo.visibility == "public" %}◯{% else if repo.visibility == "internal" %}◐{% else %}●{% endif %}</span> {{ repo.visibility }}</span>{% if let Some(b) = repo.stored_in %} <span class="store store-{{ b.kind }}" tabindex="0" aria-label="Kept in its owner's {{ b.provider }}"><svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false">{% if b.kind == "gcs" %}<path d="M4.2 1.5h7.6L15.6 8l-3.8 6.5H4.2L.4 8z" fill="#4285f4"/><rect x="4.6" y="5" width="6.8" height="2" rx=".6" fill="#fff"/><rect x="4.6" y="9" width="6.8" height="2" rx=".6" fill="#fff"/>{% else if b.kind == "s3" %}<path d="M1.8 3.6 3.6 13.2c.2 1 2.2 1.6 4.4 1.6s4.2-.6 4.4-1.6l1.8-9.6z" fill="#7aa116"/><ellipse cx="8" cy="3.6" rx="6.2" ry="2.1" fill="#a4cc4c"/>{% else %}<rect x="1.5" y="2" width="13" height="12" rx="1.6" fill="#0078d4"/><rect x="4" y="5" width="8" height="1.6" fill="#fff"/><rect x="4" y="7.7" width="8" height="1.6" fill="#fff"/><rect x="4" y="10.4" width="5" height="1.6" fill="#fff"/>{% endif %}</svg><span class="store-card" role="tooltip"><strong>{{ b.provider }}</strong>{% if repo.can(crate::auth::Access::Admin) %}<dl><dt>{% if b.kind == "azure" %}Account / container{% else %}Bucket{% endif %}</dt><dd><code>{{ b.place }}</code></dd>{% if !b.prefix.is_empty() %}<dt>Prefix</dt><dd><code>{{ b.prefix }}</code></dd>{% endif %}{% if let Some(r) = b.region %}<dt>Region</dt><dd>{{ r }}</dd>{% endif %}<dt>URL</dt><dd><code>{{ b.url }}</code></dd></dl><a href="{{ repo.url }}/settings/storage">Storage settings and the last check</a>{% else %}<span class="mute">This repository's data is kept in its owner's own {{ b.provider }}, not on this server's disk.</span>{% endif %}</span></span>{% endif %}</span>
14
    <a href="{{ repo.url }}"{% if tab == "code" %} class="on" aria-current="page"{% endif %}>Code</a>
15
    <a href="{{ repo.url }}/changes/{{ repo.default_bookmark }}"{% if tab == "changes" %} class="on" aria-current="page"{% endif %}>Changes</a>
16
    <a href="{{ repo.url }}/proposals"{% if tab == "proposals" %} class="on" aria-current="page"{% endif %}>Proposals{% if repo.open_proposals > 0 %} <span class="count-chip">{{ repo.open_proposals }}</span>{% endif %}</a>
17
    <a href="{{ repo.url }}/issues"{% if tab == "issues" %} class="on" aria-current="page"{% endif %}>Issues{% if repo.open_issues > 0 %} <span class="count-chip">{{ repo.open_issues }}</span>{% endif %}</a>
18
    <a href="{{ repo.url }}/flow"{% if tab == "flow" %} class="on" aria-current="page"{% endif %}>Flow</a>
19
    <a href="{{ repo.url }}/releases"{% if tab == "releases" || tab == "tags" %} class="on" aria-current="page"{% endif %}>Releases</a>
20
    {% if repo.wiki || repo.can(crate::auth::Access::Write) %}<a href="{{ repo.url }}/wiki"{% if tab == "wiki" %} class="on" aria-current="page"{% endif %}>Wiki</a>{% endif %}
21
    {# Menus are <details>: they open without JavaScript; hub.js only closes them (oxygenhub#254). #}
22
    <details class="tab-menu" data-tab-menu>
23
      <summary{% if tab == "artifacts" || tab == "images" || tab == "terraform" || tab == "reports" || tab == "tests" || tab == "coverage" %} class="on"{% endif %}>Artifacts</summary>
24
      <div class="tab-menu-list">
25
        <a href="{{ repo.url }}/releases"{% if tab == "releases" %} aria-current="page"{% endif %}>Releases</a>
26
        <a href="{{ repo.url }}/artifacts"{% if tab == "artifacts" %} aria-current="page"{% endif %}>Build artifacts</a>
27
        <a href="{{ repo.url }}/images"{% if tab == "images" %} aria-current="page"{% endif %}>Images</a>
28
        <a href="{{ repo.url }}/terraform"{% if tab == "terraform" %} aria-current="page"{% endif %}>Terraform state</a>
29
        {% if repo.reports || repo.tests || repo.coverage %}<a href="{{ repo.url }}/reports"{% if tab == "reports" || tab == "tests" || tab == "coverage" %} aria-current="page"{% endif %}>Reports</a>{% endif %}
30
      </div>
31
    </details>
32
    <details class="tab-menu" data-tab-menu>
33
      <summary{% if tab == "bookmarks" || tab == "diffusion" || tab == "trust" || tab == "pushes" || tab == "conflicts" || tab == "insights" %} class="on"{% endif %}>More</summary>
34
      <div class="tab-menu-list">
35
        <a href="{{ repo.url }}/insights"{% if tab == "insights" %} aria-current="page"{% endif %}>Insights</a>
36
        <a href="{{ repo.url }}/bookmarks"{% if tab == "bookmarks" %} aria-current="page"{% endif %}>Bookmarks</a>
37
        <a href="{{ repo.url }}/tags"{% if tab == "tags" %} aria-current="page"{% endif %}>Tags</a>
38
        {% if repo.diffusion %}<a href="{{ repo.url }}/diffusion"{% if tab == "diffusion" %} aria-current="page"{% endif %}>Diffusion</a>{% endif %}
39
        <a href="{{ repo.url }}/trust"{% if tab == "trust" %} aria-current="page"{% endif %}>Trust</a>
40
        <a href="{{ repo.url }}/pushes"{% if tab == "pushes" %} aria-current="page"{% endif %}>Pushes</a>
41
        <a href="{{ repo.url }}/conflicts"{% if tab == "conflicts" %} aria-current="page"{% endif %}>Conflicts</a>
42
      </div>
43
    </details>
44
    {% if repo.can_maintain() %}<a href="{{ repo.url }}/settings"{% if tab == "settings" %} class="on" aria-current="page"{% endif %}>Settings</a>{% endif %}
45
  </div>
46
</nav>
47
{% endif %}
48
{% endmacro %}
49
50
{% macro sig(s) %}<span class="sig {{ s.class() }}" title="{{ s.title() }}">{{ s.glyph() }}</span>{% endmacro %}
51
52
{% macro labels(c) %}{% for l in c.labels %}<span class="lbl {% if l.kind == crate::repos::view::RefKind::Tag %}lbl-tag{% else %}lbl-bm{% endif %}">{{ l.name }}</span>{% endfor %}{% endmacro %}
53
54
{% macro change_row(repo, c) %}
55
<div class="chg">
56
  <div class="chg-main">
57
    <a class="title" href="{{ repo.url }}/change/{{ c.hash }}">{{ c.title|addresses }}</a>
58
    {% call labels(c) %}
59
    {% if c.resolution %}<span class="tag">resolution</span>{% endif %}
60
    {% if c.head %}<span class="tag head">head</span>{% endif %}
61
    <div class="meta"><span class="who">{% if let Some(a) = c.author.account %}<a href="/{{ a }}">{{ c.author.name }}</a>{% else %}{{ c.author.name }}{% endif %}{% if let Some(v) = c.via %} <span class="mute">via {{ v.name }}</span> <span class="tag{% if v.revoked %} bad{% endif %}" title="{{ v.title() }}">agent</span>{% endif %}</span> · <time title="{{ c.when_ms|when }}">{{ c.when_ms|ago }}</time></div>
62
  </div>
63
  <div class="chg-side">
64
    {% call sig(c.signature) %}
65
    <a class="hash px" href="{{ repo.url }}/change/{{ c.hash }}" title="{{ c.hash }}">{{ c.short }}</a>
66
  </div>
67
</div>
68
{% endmacro %}
69
70
{% macro line_text(l) %}<pre>{% if l.segments.is_empty() %}{{ l.text }}{% else %}{% for g in l.segments %}{% if g.changed %}<span class="wx">{{ g.text }}</span>{% else %}{{ g.text }}{% endif %}{% endfor %}{% endif %}</pre>{% endmacro %}
71
72
{% macro diff_bar(ignore_ws, keep) %}
73
<div class="diff-bar">
74
  <span class="modes" data-diff-modes hidden><a href="#" data-diff-mode="unified">unified</a><a href="#" data-diff-mode="split">split</a></span>
75
  <a class="small" href="?{{ keep }}w={% if ignore_ws %}0{% else %}1{% endif %}">{% if ignore_ws %}show whitespace changes{% else %}hide whitespace changes{% endif %}</a>
76
  <a class="small" href="#" data-diff-collapse hidden>collapse all</a>
77
</div>
78
{% endmacro %}
79
80
{% macro diff(files, ignore_ws, keep) %}
81
{% if !files.is_empty() %}{% call diff_bar(ignore_ws, keep) %}{% endif %}
82
{% for f in files %}
83
<details class="file-diff" id="{{ f.anchor }}"{% if f.lines.len() <= 400 %} open{% endif %}>
84
  <summary>
85
    <span class="kind kind-{{ f.kind }}">{{ f.kind }}</span>
86
    <strong>{% if let Some(from) = f.from %}{{ from }} → {% endif %}{{ f.path }}</strong>
87
    <span class="counts"><span class="add">+{{ f.added }}</span> <span class="del">−{{ f.removed }}</span></span>
88
  </summary>
89
  {% if f.lines.is_empty() %}<p class="empty">No line changes.</p>{% else %}
90
  <table class="code diff">
91
  {% for l in f.lines %}
92
    <tr class="{{ l.kind.class() }}">
93
      <td class="n">{% if let Some(n) = l.old_no %}{{ n }}{% endif %}</td>
94
      <td class="n">{% if let Some(n) = l.new_no %}{{ n }}{% endif %}</td>
95
      <td class="s">{{ l.kind.sign() }}</td>
96
      <td class="t">{% call line_text(l) %}</td>
97
    </tr>
98
  {% endfor %}
99
  </table>
100
  {% endif %}
101
</details>
102
{% endfor %}
103
{% endmacro %}