1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{# Expects: owner, repo, branch, latest_commit: Option<CommitView>, access, upload_path, commit_count #}
<div class="kg-toolbar">
<a class="kg-btn kg-btn--ghost kg-toolbar__branch" href="/{{ owner.username }}/{{ repo.name }}/branches">
<span class="kg-icon" style="--icon:url('/static/icons/git-branch.svg')"></span>
{{ branch }}
</a>
<div class="kg-toolbar__actions">
{% if upload_path != "" %}
<a class="kg-btn kg-btn--ghost" href="/{{ owner.username }}/{{ repo.name }}/archive.zip?ref={{ branch }}&path={{ upload_path }}" title="Download this folder as ZIP">
<span class="kg-icon" style="--icon:url('/static/icons/download.svg')"></span>
download folder
</a>
{% else %}
<a class="kg-btn kg-btn--ghost" href="/{{ owner.username }}/{{ repo.name }}/archive.zip?ref={{ branch }}" title="Download repository as ZIP">
<span class="kg-icon" style="--icon:url('/static/icons/download.svg')"></span>
download
</a>
{% endif %}
{% if access.can_write() %}
<details class="kg-dropdown">
<summary class="kg-btn kg-btn--ghost">
<span class="kg-icon" style="--icon:url('/static/icons/upload.svg')"></span>
upload
<span class="kg-icon" style="--icon:url('/static/icons/chevron-down.svg')"></span>
</summary>
<div class="kg-dropdown__panel kg-dropdown__panel--upload">
<form class="kg-upload" method="post" action="/{{ owner.username }}/{{ repo.name }}/upload" enctype="multipart/form-data">
<input type="hidden" name="branch" value="{{ branch }}" />
<input type="hidden" name="path" value="{{ upload_path }}" />
<label class="kg-upload__file">
<span class="kg-meta">File</span>
<input type="file" name="file" required />
</label>
<label class="kg-upload__message">
<span class="kg-meta">Commit message</span>
<input type="text" name="message" placeholder="Commit message" value="Upload file" />
</label>
<button class="kg-btn" type="submit">
<span class="kg-icon" style="--icon:url('/static/icons/upload.svg')"></span>
commit file
</button>
</form>
</div>
</details>
{% endif %}
</div>
</div>
{% if let Some(c) = latest_commit %}
<div class="kg-latest">
<div class="kg-latest__main">
{% if let Some(uname) = c.author_username %}
<a class="kg-latest__author" href="/{{ uname }}">{{ c.author }}</a>
{% else %}
<span class="kg-latest__author">{{ c.author }}</span>
{% endif %}
<a class="kg-latest__msg" href="/{{ owner.username }}/{{ repo.name }}/commit/{{ c.id }}" title="{{ c.message }}">{{ c.message }}</a>
</div>
<div class="kg-latest__meta">
<a class="kg-latest__sha" href="/{{ owner.username }}/{{ repo.name }}/commit/{{ c.id }}" title="{{ c.id }}">
<code>{{ c.short_id }}</code>
</a>
{% let show_unverified = false %}
{% include "partials/verified_badge.html" %}
<time class="kg-meta kg-latest__time">{{ c.time_display() }}</time>
<a class="kg-latest__count kg-meta" href="/{{ owner.username }}/{{ repo.name }}/commits" title="{{ commit_count }} commits">
{{ commit_count }} commits
</a>
</div>
</div>
{% endif %}