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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{% extends "layout.html" %}
{% block title %}{{ social.title }}{% endblock %}
{% block meta %}
{% include "partials/social_meta.html" %}
{% endblock %}
{% block head %}
{% if readme_html.is_some() %}
{% include "partials/katex.html" %}
{% endif %}
{% endblock %}
{% block content %}
<section class="kg-section">
<div class="kg-profile-head">
<img class="kg-avatar" src="{{ owner_avatar }}" alt="" />
<div class="kg-profile-head__main">
<h1 class="kg-title">
<a href="/{{ owner.username }}">{{ owner.username }}</a>
/
<strong>{{ repo.name }}</strong>
{% if repo.visibility == "private" %}<span class="kg-badge">private</span>{% endif %}
{% if repo.archived %}<span class="kg-badge kg-badge--closed">archived</span>{% endif %}
{% if forked_from.is_some() %}<span class="kg-badge">fork</span>{% endif %}
</h1>
{% if let Some((fo, fn_)) = forked_from %}
<p class="kg-meta">forked from <a href="/{{ fo }}/{{ fn_ }}">{{ fo }}/{{ fn_ }}</a></p>
{% endif %}
{% if !repo.description.is_empty() %}
<p class="kg-muted">{{ repo.description }}</p>
{% endif %}
</div>
<div class="kg-social">
{% if viewer.is_some() %}
<form method="post" action="/{{ owner.username }}/{{ repo.name }}/watch">
<button class="kg-btn kg-btn--ghost" type="submit">
<span class="kg-icon" style="--icon:url('/static/icons/eye.svg')"></span>
{% if watching %}unwatch{% else %}watch{% endif %}
<span class="kg-meta">{{ repo.watches_count }}</span>
</button>
</form>
<form method="post" action="/{{ owner.username }}/{{ repo.name }}/fork">
<button class="kg-btn kg-btn--ghost" type="submit">
<span class="kg-icon" style="--icon:url('/static/icons/git-fork.svg')"></span>
fork
<span class="kg-meta">{{ repo.forks_count }}</span>
</button>
</form>
<form method="post" action="/{{ owner.username }}/{{ repo.name }}/star">
<button class="kg-btn kg-btn--ghost" type="submit">
<span class="kg-icon" style="--icon:url('/static/icons/star.svg')"></span>
{% if starred %}unstar{% else %}star{% endif %}
<span class="kg-meta">{{ repo.stars_count }}</span>
</button>
</form>
{% else %}
<span class="kg-meta">
<span class="kg-icon" style="--icon:url('/static/icons/eye.svg')"></span> {{ repo.watches_count }}
·
<span class="kg-icon" style="--icon:url('/static/icons/git-fork.svg')"></span> {{ repo.forks_count }}
·
<span class="kg-icon" style="--icon:url('/static/icons/star.svg')"></span> {{ repo.stars_count }}
</span>
{% endif %}
</div>
</div>
{% let tab = "code" %}
{% let archive_ref = current_branch %}
{% include "partials/repo_tabs.html" %}
{% if empty %}
<p class="kg-muted">Empty repository. Push to get started.</p>
<div class="kg-clone-empty">
<code class="kg-clone">git clone {{ clone_http }}</code>
<code class="kg-clone">git clone {{ clone_ssh }}</code>
</div>
{% else %}
{% let branch = current_branch %}
{% let upload_path = "" %}
{% include "partials/branch_bar.html" %}
{% if !languages.is_empty() %}
<div class="kg-langbar" role="img" aria-label="Languages">
{% for lang in languages %}
<span style="width: {{ lang.percent }}%; background: {{ lang.color }}" title="{{ lang.name }} {{ lang.percent }}%"></span>
{% endfor %}
</div>
<ul class="kg-langlist">
{% for lang in languages %}
<li>
<span class="kg-langdot" style="background: {{ lang.color }}" aria-hidden="true"></span>
{{ lang.name }} <span class="kg-meta">{{ lang.percent }}%</span>
</li>
{% endfor %}
</ul>
{% endif %}
<ul class="kg-tree">
{% for e in entries %}
<li>
{% if e.is_dir %}
<span class="kg-icon" style="--icon:url('/static/icons/folder.svg')"></span>
<a href="/{{ owner.username }}/{{ repo.name }}/tree/{{ current_branch }}/{{ e.path }}">{{ e.name }}</a>
<span class="kg-tree__commit kg-meta" title="{{ e.commit_message }}">{{ e.commit_message }}</span>
<span class="kg-tree__time kg-meta">{{ e.commit_time }}</span>
<a class="kg-tree__dl kg-btn kg-btn--ghost" href="/{{ owner.username }}/{{ repo.name }}/archive.zip?ref={{ current_branch }}&path={{ e.path }}" title="Download {{ e.name }} as ZIP">
<span class="kg-icon" style="--icon:url('/static/icons/download.svg')"></span>
<span class="kg-sr-only">Download</span>
</a>
{% else %}
<span class="kg-icon" style="--icon:url('/static/icons/file.svg')"></span>
<a href="/{{ owner.username }}/{{ repo.name }}/blob/{{ current_branch }}/{{ e.path }}">{{ e.name }}</a>
<span class="kg-tree__commit kg-meta" title="{{ e.commit_message }}">{{ e.commit_message }}</span>
<span class="kg-tree__time kg-meta">{{ e.commit_time }}</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% if let Some(html) = readme_html %}
<article class="kg-readme">
{{ html|safe }}
</article>
{% endif %}
{% endif %}
</section>
{% endblock %}