OXYGENHUB
# 17ca6cddc534 oxygenhub / templates / overview.html
10.7 KiB · HTML · last changed feat(web): sidebar cards, a shaded tree head, icons, aligned Diffusion tables (closes #152) 23 days ago source blame history raw
d23464c0 Andy McCall ↶ 1
{% extends "base.html" %}
2
{% import "repo_tabs.html" as m %}
3
{% block title %}{{ repo.owner }}/{{ repo.name }}{% endblock %}
4
{% block bodyattrs %} data-repo="{{ repo.url }}" data-ref="{{ repo.default_bookmark }}"{% endblock %}
5
{% block tabs %}{% call m::tabs(repo, "code") %}{% endblock %}
6
{% block content %}
7
<div class="side-layout rev">
8
  <div>
83d5052b Andy McCall ↶ 9
    {% if o.heads > 1 %}<div class="strip warn">{{ repo.default_bookmark }} has {{ o.heads }} heads; the tree below is their union. <a href="{{ repo.url }}/bookmarks">Bookmarks</a></div>{% endif %}
10
    {% if o.conflicted %}<div class="strip bad">This state carries conflicts. <a href="{{ repo.url }}/conflicts">See them</a></div>{% endif %}
d23464c0 Andy McCall ↶ 11
    <div class="bar">
12
      <span class="ref px"><a href="{{ repo.url }}/bookmarks">◆ {{ repo.default_bookmark }}</a></span>
c9aacc0e Andy McCall ↶ 13
      {% if o.latest.is_none() %}<a class="go small" href="{{ repo.url }}/changes/{{ repo.default_bookmark }}">{{ o.changes|plural("change", "changes") }}</a>{% endif %}
14530604 Andy McCall ↶ 14
      {% if repo.can(crate::auth::Access::Write) %}<a class="go small" href="{{ repo.url }}/newfile/{{ repo.default_bookmark }}">new file</a>{% endif %}
3f4b0ea6 Andy McCall ↶ 15
      <form class="find inline-find" method="get" action="{{ repo.url }}/search"><input type="search" name="q" placeholder="Search code…"></form>
83d5052b Andy McCall ↶ 16
      <details class="clone-pop">
6ad368c5 Andy McCall ↶ 17
        <summary class="go small" aria-haspopup="true">⤓ Clone</summary>
83d5052b Andy McCall ↶ 18
        <div class="clone-panel" role="group" aria-label="Clone this repository">
19
          <label for="clone-cmd" class="small mute">Clone with oxy</label>
20
          <div class="clone"><input id="clone-cmd" type="text" readonly value="oxy clone {{ repo.clone_url }}" onfocus="this.select()" onclick="this.select()"><button type="button" class="small" data-copy="oxy clone {{ repo.clone_url }}">copy</button></div>
21
          <p class="small mute">The URL alone: <code>{{ repo.clone_url }}</code></p>
22
        </div>
23
      </details>
d23464c0 Andy McCall ↶ 24
    </div>
4edcf240 Andy McCall ↶ 25
    {% if let Some(q) = quickstart %}
26
    {% include "quickstart.html" %}
27
    {% else %}
c9aacc0e Andy McCall ↶ 28
    <div class="tree-box">
29
    {% if let Some(c) = o.latest %}<div class="tree-head">
30
      <span class="tree-title">{% if let Some(a) = c.author.account %}<a class="who" href="/{{ a }}"><img class="avatar" src="/avatar/{{ a }}" alt="" width="20" height="20"> {{ a }}</a>{% else %}<span class="who">{{ c.author.name }}</span>{% endif %} <a class="t" href="{{ repo.url }}/change/{{ c.hash }}" title="{{ c.title }}">{{ c.title }}</a></span>
31
      <span class="tree-meta"><a href="{{ repo.url }}/change/{{ c.hash }}"><code>{{ c.short }}</code></a><time class="ago" title="{{ c.when_ms|when }}">{{ c.when_ms|ago }}</time><a class="hist" href="{{ repo.url }}/changes/{{ repo.default_bookmark }}">{{ crate::web::icons::svg("history")|safe }} {{ o.changes|plural("change", "changes") }}</a></span>
32
    </div>{% endif %}
d23464c0 Andy McCall ↶ 33
    {% include "tree_table.html" %}
c9aacc0e Andy McCall ↶ 34
    </div>
4edcf240 Andy McCall ↶ 35
    {% endif %}
d23464c0 Andy McCall ↶ 36
    {% if let Some(html) = readme_html %}
37
    <article class="doc readme"><h2 class="small mute">{{ o.tree.readme.as_ref().unwrap().path }}</h2>{{ html|safe }}</article>
38
    {% endif %}
39
  </div>
c9aacc0e Andy McCall ↶ 40
  <aside class="side cards">
41
    <section class="side-card"><h3>About</h3><div class="body">
d23464c0 Andy McCall ↶ 42
    {% if repo.description.is_empty() %}<p class="mute small">No description.</p>{% else %}<p>{{ repo.description }}</p>{% endif %}
07b1a5bb Andy McCall ↶ 43
    {% if let Some(up) = fork.upstream %}<p class="small">forked from <a href="/{{ up.owner }}/{{ up.name }}">{{ up.owner }}/{{ up.name }}</a></p>{% endif %}
c9aacc0e Andy McCall ↶ 44
    {% if !topics.is_empty() %}<p class="topics">{% for t in topics %}<a class="topic" href="/explore?topic={{ t }}">{{ t }}</a>{% endfor %}</p>{% endif %}
07b1a5bb Andy McCall ↶ 45
    <div class="bar">
1553bfc9 Andy McCall ↶ 46
    <p class="small mute counts-line"><span title="stars">★ {{ stars }}</span> · <span title="watchers">👁 {{ watchers }}</span></p>
47
    {% if shell.user.is_some() %}<form class="inline" method="post" action="{{ repo.url }}/star"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit" class="small">{% if starred %}★ UNSTAR{% else %}☆ STAR{% endif %}</button></form>
48
    <form class="inline" method="post" action="{{ repo.url }}/watch"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit" class="small">{% if watching %}UNWATCH{% else %}WATCH{% endif %}</button></form>
07b1a5bb Andy McCall ↶ 49
    <a class="go small" href="{{ repo.url }}/fork">fork</a>{% endif %}
50
    {% if fork.forks > 0 %}<a class="small" href="{{ repo.url }}/forks">{{ fork.forks|plural("fork", "forks") }}</a>{% endif %}
51
    </div>
52
    {% if let Some(up) = fork.upstream %}{% if shell.user.is_some() %}<a class="go small" href="/{{ up.owner }}/{{ up.name }}/proposals/new?source={{ repo.owner }}/{{ repo.name }}:{{ repo.default_bookmark }}">propose to {{ up.owner }}/{{ up.name }}</a>{% endif %}{% endif %}
c9aacc0e Andy McCall ↶ 53
    {% if let Some(l) = o.license %}<p class="small">Licence: <a href="{{ repo.url }}/file/{{ repo.default_bookmark }}/{{ l }}">{{ l }}</a></p>{% endif %}
54
    </div></section>
55
    {% if let Some(rel) = latest_release %}<section class="side-card"><h3>Latest release</h3><div class="body"><p><a href="{{ repo.url }}/releases/tag/{{ rel.tag }}">{{ rel.title }}</a> <span class="small mute">{{ rel.created_ms|ago_i }}</span></p></div></section>{% endif %}
56
    {% if !follows.is_empty() || !used_by.is_empty() %}
57
    <section class="side-card"><h3>Diffusion <a class="more" href="{{ repo.url }}/diffusion">details ›</a></h3><div class="body">
58
    {% if !follows.is_empty() %}<h4>Takes from</h4>
59
    <ul class="plain df-list">{% for (up, c) in follows %}<li><a class="df-name" href="/{{ up.owner }}/{{ up.name }}" title="pinned at {{ c.path }}">{{ up.owner }}/{{ up.name }}</a>
60
      <span class="df-line"><span class="df-pill" role="img" aria-label="upstream {{ c.upstream.word }}, here {{ c.downstream.word }}"><span class="df-half {{ c.upstream.class }}" title="Upstream: {{ c.upstream.title }}">{{ c.upstream.word }}</span><span class="df-half {{ c.downstream.class }}" title="Here: {{ c.downstream.title }}">{{ c.downstream.word }}</span></span>{% if let Some(n) = c.bump %}<a href="{{ repo.url }}/proposal/{{ n }}">bump #{{ n }}</a>{% endif %}</span></li>{% endfor %}</ul>{% endif %}
61
    {% if !used_by.is_empty() %}<h4>Diffuses to <span class="count-chip">{{ used_by.len() }}</span></h4>
62
    <ul class="plain df-list">{% for c in used_by %}<li><a class="df-name" href="/{{ c.owner }}/{{ c.name }}">{{ c.owner }}/{{ c.name }}</a>
63
      <span class="df-line"><span class="df-pill" role="img" aria-label="here {{ c.upstream.word }}, {{ c.name }} {{ c.downstream.word }}"><span class="df-half {{ c.upstream.class }}" title="Here: {{ c.upstream.title }}">{{ c.upstream.word }}</span><span class="df-half {{ c.downstream.class }}" title="{{ c.owner }}/{{ c.name }}: {{ c.downstream.title }}">{{ c.downstream.word }}</span></span>{% match c.behind %}{% when Some(0) %}{% when Some(n) %}<span class="mute">{{ n }} behind</span>{% when None %}{% endmatch %}</span></li>{% endfor %}</ul>{% endif %}
64
    </div></section>
65
    {% endif %}
83d5052b Andy McCall ↶ 66
    {% if !o.contributors.is_empty() %}
c9aacc0e Andy McCall ↶ 67
    <section class="side-card"><h3>Contributors <span class="count-chip">{{ o.contributors.len() }}</span></h3><div class="body">
83d5052b Andy McCall ↶ 68
    <ul class="plain contributors">{% for c in o.contributors.iter().take(10) %}
c9aacc0e Andy McCall ↶ 69
      <li class="c">{% if let Some(u) = c.account %}<img class="avatar sm" src="/avatar/{{ u }}" alt="" width="20" height="20"><a class="who" href="/{{ u }}" title="{{ c.name }}">{{ u }} <span class="mute small">{{ c.name }}</span></a>{% else if c.hub %}<img class="avatar sm" src="/favicon.svg" alt="" width="20" height="20"><span class="who" title="{{ c.name }}: this hub's delegate key, signing the changes made in the browser for people who allowed it">{{ c.name }}</span>{% else %}<span class="avatar-none" aria-hidden="true">○</span><span class="who" title="{{ c.name }}">{{ c.name }}</span>{% endif %}<span class="n mute small" title="changes">{{ c.changes }}</span>{% if !c.via.is_empty() %}<ul class="plain via-list">{% for v in c.via %}<li><span class="mute" aria-hidden="true">↳</span> <span class="mute small">via</span> <img class="avatar sm" src="/avatar/agent/{{ v.0 }}" alt="" width="16" height="16"> {{ v.0 }} <span class="mute small" title="changes signed by this agent for them">· {{ v.1 }}</span></li>{% endfor %}</ul>{% endif %}</li>
83d5052b Andy McCall ↶ 70
    {% endfor %}</ul>
71
    {% if o.contributors.len() > 10 %}<p class="small mute">and {{ o.contributors.len() - 10 }} more</p>{% endif %}
c9aacc0e Andy McCall ↶ 72
    </div></section>
83d5052b Andy McCall ↶ 73
    {% endif %}
74
    {% if !o.languages.is_empty() %}
c9aacc0e Andy McCall ↶ 75
    <section class="side-card"><h3>Languages</h3><div class="body">
83d5052b Andy McCall ↶ 76
    <div class="lang-bar" role="img" aria-label="{% for l in o.languages %}{{ l.name }} {{ "{:.1}"|format(l.percent) }}%{% if !loop.last %}, {% endif %}{% endfor %}">{% for l in o.languages %}<span style="width: {{ "{:.3}"|format(l.percent) }}%; background: {{ l.colour }}" title="{{ l.name }} {{ "{:.1}"|format(l.percent) }}%"></span>{% endfor %}</div>
77
    <ul class="plain langs">{% for l in o.languages %}<li><span class="lang-dot" style="background: {{ l.colour }}" aria-hidden="true"></span> <strong>{{ l.name }}</strong> <span class="mute">{{ "{:.1}"|format(l.percent) }}%</span></li>{% endfor %}</ul>
c9aacc0e Andy McCall ↶ 78
    </div></section>
83d5052b Andy McCall ↶ 79
    {% endif %}
c9aacc0e Andy McCall ↶ 80
    <section class="side-card"><h3>Bookmarks <span class="count-chip">{{ o.bookmarks.len() }}</span>{% if o.bookmarks.len() > 10 %}<a class="more" href="{{ repo.url }}/bookmarks">all {{ o.bookmarks.len() }} ›</a>{% endif %}</h3><div class="body">
81
    <ul class="plain bookmarks">{% for b in o.recent_bookmarks() %}<li><a href="{{ repo.url }}/tree/{{ b.name }}" title="{{ b.name }}">{{ b.name }}</a>{% if b.heads.len() > 1 %}<span class="tag warn">{{ b.heads.len() }} heads</span>{% endif %}{% if b.conflicted %}<span class="tag bad">conflicts</span>{% endif %}<time class="small mute" title="{{ b.latest_ms|when }}">{{ b.latest_ms|ago }}</time></li>{% endfor %}</ul>
82
    </div></section>
83
    <section class="side-card"><h3>Tags</h3><div class="body">
d23464c0 Andy McCall ↶ 84
    {% if o.tags.is_empty() %}<p class="mute small">None.</p>{% else %}<ul class="plain">{% for t in o.tags %}<li><a href="{{ repo.url }}/tree/{{ t.name }}">{{ t.name }}</a>{% if t.signer.is_some() %} <span class="sig sig-valid" title="signed">✔</span>{% endif %}</li>{% endfor %}</ul>{% endif %}
c9aacc0e Andy McCall ↶ 85
    </div></section>
86
    <section class="side-card"><h3>Trust</h3><div class="body">
d23464c0 Andy McCall ↶ 87
    {% match o.policy %}
88
    {% when crate::repos::view::PolicyBadge::Active %}<p><a href="{{ repo.url }}/trust"><span class="sig sig-valid">✔</span> policy in force</a></p>
89
    {% when crate::repos::view::PolicyBadge::Expired %}<p><a href="{{ repo.url }}/trust"><span class="sig sig-invalid">✘</span> policy expired</a></p>
90
    {% when crate::repos::view::PolicyBadge::None %}<p><a href="{{ repo.url }}/trust"><span class="sig sig-unsigned">○</span> no policy</a></p>
91
    {% endmatch %}
c9aacc0e Andy McCall ↶ 92
    </div></section>
d23464c0 Andy McCall ↶ 93
  </aside>
94
</div>
95
{% endblock %}