Parent [>]
1{% extends "base.html" %}
2
3{% block title %}
4{{ name }}
5{% endblock %}
6
7{% block breadcrumbs %}
8<ul>
9  <li><a href="/">{{ crate::hostname() }}</a></li>
10  <li><a href="/{{ name }}">{{ name }}</a></li>
11</ul>
12{% endblock %}
13
14{% block content %}
15<h1>{{ name }}</h1>
16
17{% if let Some(description) = description %}
18<p>{{ description }}</p>
19{% endif %}
20<details>
21  <summary><svg class="summary-icon"><use href="#icon-copy"/></svg>Clone</summary>
22  <ul>
23    <li><button data-url="git@{{ crate::hostname() }}:{{ crate::ssh_prefix() }}{{ name }}.git"><span>git@{{ crate::hostname() }}:{{ crate::ssh_prefix() }}{{ name }}.git</span><span>SSH</span></button></li>
24    <li><button data-url="https://{{ crate::hostname() }}/{{ name }}.git"><span>https://{{ crate::hostname() }}/{{ name }}.git</span><span>HTTPS</span></button></li>
25  </ul>
26</details>
27
28<details>
29  <summary><svg class="summary-icon"><use href="#icon-branch"/></svg>Branches <span>[{{ branches.len() }}]</span></summary>
30  <ul>
31    {% for branch in branches.iter().take(5) %}
32    <li><a href="/{{ name }}/branches/{{ branch.name }}"><span class="branch-name">{{ branch.name }}</span>{% if branch.is_default %}<span>default</span>{% endif %}<span>{{ branch.date }}</span></a></li>
33    {% endfor %}
34    {% if branches.len() > 5 %}
35    <li><a href="/{{ name }}/branches">see all {{ branches.len() }} branches</a></li>
36    {% endif %}
37    {% if branches.is_empty() %}
38    <li>no branches</li>
39    {% endif %}
40  </ul>
41</details>
42
43<details>
44  <summary><svg class="summary-icon"><use href="#icon-tag"/></svg>Tags <span>[{{ tags.len() }}]</span></summary>
45  <ul>
46    {% for tag in tags.iter().take(5) %}
47    <li><a href="/{{ name }}/tags/{{ tag.name }}"><span class="tag-name">{{ tag.name }}</span><span>{{ tag.date }}</span></a></li>
48    {% endfor %}
49    {% if tags.len() > 5 %}
50    <li><a href="/{{ name }}/tags">see all {{ tags.len() }} tags</a></li>
51    {% endif %}
52    {% if tags.is_empty() %}
53    <li>no tags</li>
54    {% endif %}
55  </ul>
56</details>
57
58<div class="repo-nav">
59  {% if let Some(sha) = head_sha %}
60  <a href="/{{ name }}/commits/{{ sha }}/tree" class="repo-nav-item">
61    <svg class="summary-icon"><use href="#icon-tree"/></svg>
62    <span>Tree</span>
63    <span class="repo-nav-item-meta">[{{ sha[..8] }}]</span>
64    <span class="repo-nav-item-arrow">[&gt;]</span>
65  </a>
66  {% endif %}
67  <a href="/{{ name }}/commits" class="repo-nav-item">
68    <svg class="summary-icon"><use href="#icon-commits"/></svg>
69    <span>Commits</span>
70    <span class="repo-nav-item-meta">[{{ commit_count }}]</span>
71    <span class="repo-nav-item-arrow">[&gt;]</span>
72  </a>
73</div>
74
75{% if let Some(readme) = readme %}
76<article>
77  {{ readme | safe }}
78</article>
79{% endif %}
80{% endblock %}
81
82{% block scripts %}
83<script>
84  document.querySelectorAll('[data-url]').forEach(btn => {
85    const span = btn.querySelector('span:first-child');
86    const url = btn.dataset.url;
87    btn.addEventListener('click', () => {
88      navigator.clipboard.writeText(url);
89      span.style.opacity = '0';
90      setTimeout(() => { span.textContent = 'copied!'; span.style.opacity = '1'; }, 100);
91      setTimeout(() => {
92        span.style.opacity = '0';
93        setTimeout(() => { span.textContent = url; span.style.opacity = '1'; }, 100);
94      }, 1100);
95    });
96  });
97</script>
98{% endblock %}