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<p class="repo-commit-count">{{ commit_count }} {% if commit_count == 1 %}commit{% else %}commits{% endif %}</p>
21
22<details>
23  <summary>Clone</summary>
24  <ul>
25    <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>
26    <li><button data-url="https://{{ crate::hostname() }}/{{ name }}.git"><span>https://{{ crate::hostname() }}/{{ name }}.git</span><span>HTTPS</span></button></li>
27  </ul>
28</details>
29
30<details>
31  <summary>Branches <span>{{ branches.len() }}</span></summary>
32  <ul>
33    {% for branch in branches.iter().take(5) %}
34    <li><a href="/{{ name }}/branches/{{ branch.name }}"><span>{{ branch.name }}</span>{% if branch.is_default %}<span>default</span>{% endif %}<span>{{ branch.date }}</span></a></li>
35    {% endfor %}
36    {% if branches.len() > 5 %}
37    <li><a href="/{{ name }}/branches">see all {{ branches.len() }} branches</a></li>
38    {% endif %}
39    {% if branches.is_empty() %}
40    <li>no branches</li>
41    {% endif %}
42  </ul>
43</details>
44
45<details>
46  <summary>Tags <span>{{ tags.len() }}</span></summary>
47  <ul>
48    {% for tag in tags.iter().take(5) %}
49    <li><a href="/{{ name }}/tags/{{ tag.name }}"><span>{{ tag.name }}</span><span>{{ tag.date }}</span></a></li>
50    {% endfor %}
51    {% if tags.len() > 5 %}
52    <li><a href="/{{ name }}/tags">see all {{ tags.len() }} tags</a></li>
53    {% endif %}
54    {% if tags.is_empty() %}
55    <li>no tags</li>
56    {% endif %}
57  </ul>
58</details>
59
60{% if let Some(readme) = readme %}
61<article>
62  {{ readme | safe }}
63</article>
64{% endif %}
65{% endblock %}
66
67{% block scripts %}
68<script>
69  document.querySelectorAll('[data-url]').forEach(btn => {
70    const span = btn.querySelector('span:first-child');
71    const url = btn.dataset.url;
72    btn.addEventListener('click', () => {
73      navigator.clipboard.writeText(url);
74      span.style.opacity = '0';
75      setTimeout(() => { span.textContent = 'copied!'; span.style.opacity = '1'; }, 100);
76      setTimeout(() => {
77        span.style.opacity = '0';
78        setTimeout(() => { span.textContent = url; span.style.opacity = '1'; }, 100);
79      }, 1100);
80    });
81  });
82</script>
83{% endblock %}