| 1 |
{% macro header(repo: Option<&Repository> = None, branches: Vec<String> = Vec::new(), current_ref: Option<&Ref> = None) %} |
| 2 |
{% if let Some(repo) = repo && let Some(current_ref) = current_ref %} |
| 3 |
<tr> |
| 4 |
<td class="logo" rowspan="2"><a href="/"><img src="/static/logo.png" alt="logo"></a></td> |
| 5 |
<td class="main"><a href="/">index</a> : <a title="{{ repo.name }}" href="/{{ repo.name }}/">{{ repo.name }}</a></td> |
| 6 |
<td class="form"> |
| 7 |
<form method="get"> |
| 8 |
<select name="h" onchange="this.form.submit();"> |
| 9 |
{% for branch in branches %} |
| 10 |
<option value="{{ branch }}" {% if branch == ¤t_ref.name %}selected{% endif %}>{{ branch }}</option> |
| 11 |
{% endfor %} |
| 12 |
</select> |
| 13 |
<input type="submit" value="switch"> |
| 14 |
</form> |
| 15 |
</td> |
| 16 |
</tr> |
| 17 |
<tr> |
| 18 |
<td class="sub" colspan="2">{{ repo.description }}</td> |
| 19 |
</tr> |
| 20 |
{% else %} |
| 21 |
<tr> |
| 22 |
<td class="logo" rowspan="2"><a href="/"><img src="/static/logo.png" alt="logo"></a></td> |
| 23 |
<td class="main">y2w8 Repos</td> |
| 24 |
</tr> |
| 25 |
<tr> |
| 26 |
<td class="sub">y2w8 git repositories, powered by rsgit</td> |
| 27 |
</tr> |
| 28 |
{% endif %} |
| 29 |
{% endmacro %} |
| 30 |
|
| 31 |
{% macro repo_tabs(repo: Repository, current_ref: Ref, query: PageQuery, active: str) %} |
| 32 |
<tr> |
| 33 |
<td> |
| 34 |
<a href="/{{ repo.name }}/about/{{ query.head_param() }}" class="{% if active == "about" %}active{% endif %}">about</a> |
| 35 |
<a href="/{{ repo.name }}/" class="{% if active == "summary" %}active{% endif %}">summary</a> |
| 36 |
<a href="/{{ repo.name }}/refs/{{ query.id_param() }}" class="{% if active == "refs" %}active{% endif %}">refs</a> |
| 37 |
<a href="/{{ repo.name }}/log/{{ query.head_param() }}" class="{% if active == "log" %}active{% endif %}">log</a> |
| 38 |
<a href="/{{ repo.name }}/tree/{{ query.id_or_head_param() }}" class="{% if active == "tree" %}active{% endif %}">tree</a> |
| 39 |
<a href="/{{ repo.name }}/commit/{{ query.id_or_head_param() }}" class="{% if active == "commit" %}active{% endif %}">commit</a> |
| 40 |
<a href="/{{ repo.name }}/diff/{{ query.id_or_head_param() }}" class="{% if active == "diff" %}active{% endif %}">diff</a> |
| 41 |
</td> |
| 42 |
<td class="form"> |
| 43 |
<form method="get" action="/{{ repo.name }}/log/"> |
| 44 |
<select name="qt"> |
| 45 |
<option value="msg" selected>msg</option> |
| 46 |
<option value="author">author</option> |
| 47 |
<option value="committer">committer</option> |
| 48 |
</select> |
| 49 |
<input type="search" name="v" size="10" value=""> |
| 50 |
<input type="submit" value="search"> |
| 51 |
</form> |
| 52 |
</td> |
| 53 |
</tr> |
| 54 |
{% endmacro %} |
| 55 |
|
| 56 |
{% macro diff_view(repo, diff, query) %} |
| 57 |
<table class="diffstat"> |
| 58 |
<tbody> |
| 59 |
{% for file_diff in diff.file_diffs %} |
| 60 |
<tr> |
| 61 |
<td class="mode">{{ file_diff.mode }}</td> |
| 62 |
<td class="upd"> |
| 63 |
<a href="/{{ repo.name }}/diff/{{ file_diff.path }}{% if let Some(id) = query.id %}?id={{ id }}{% endif %}" class="{{ file_diff.state }}">{{ file_diff.path }}</a> |
| 64 |
</td> |
| 65 |
<td class="right">{{ file_diff.total }}</td> |
| 66 |
<td class="graph"> |
| 67 |
<table summary="file diffstat" style="width: {{ file_diff.total_percentage }}%"> |
| 68 |
<tbody> |
| 69 |
<tr> |
| 70 |
{% if file_diff.total != 0 %} |
| 71 |
{% if file_diff.insertions_percentage > 0.0 %} |
| 72 |
<td class="diffstat-addition" style="width: {{ file_diff.insertions_percentage }}%;"></td> |
| 73 |
{% endif %} |
| 74 |
{% if file_diff.deletions_percentage > 0.0 %} |
| 75 |
<td class="diffstat-deletion" style="width: {{ file_diff.deletions_percentage }}%;"></td> |
| 76 |
{% endif %} |
| 77 |
{% endif %} |
| 78 |
</tr> |
| 79 |
</tbody> |
| 80 |
</table> |
| 81 |
</td> |
| 82 |
</tr> |
| 83 |
{% endfor %} |
| 84 |
</tbody> |
| 85 |
</table> |
| 86 |
<pre class="diff">{{ diff.stats }} |
| 87 |
{{ diff.output|safe }}</pre> |
| 88 |
{% endmacro %} |
| 89 |
|
| 90 |
{% macro branches(branches, branches_has_more, has_prev, page, mode) %} |
| 91 |
<thead> |
| 92 |
<tr> |
| 93 |
<th>Branch</th> |
| 94 |
<th>Commit message</th> |
| 95 |
<th>Author</th> |
| 96 |
<th>Age</th> |
| 97 |
</tr> |
| 98 |
</thead> |
| 99 |
<tbody> |
| 100 |
{% for branch in branches %} |
| 101 |
<tr> |
| 102 |
<td> |
| 103 |
<a href="/{{ repo.name }}/log/?h={{ branch.name }}">{{ branch.name }}</a> |
| 104 |
</td> |
| 105 |
<td class="msg"><span class="msg-text">{{ branch.last_commit.summary()? }}</span></td> |
| 106 |
<td class="author"> |
| 107 |
<span class="avatar"> |
| 108 |
<img class="inline" src="{{ branch.author.avatar_url(20) }}"> |
| 109 |
<img class="onhover" src="{{ branch.author.avatar_url(128) }}"> |
| 110 |
</span> |
| 111 |
{{ branch.author.name }} |
| 112 |
</td> |
| 113 |
{% let time = branch.last_commit.committer.time.format_relative() %} |
| 114 |
<td class="{{ time.1 }}" title="{{ branch.last_commit.committer.time.format() }}">{{ time.0 }}</td> |
| 115 |
</tr> |
| 116 |
{% endfor %} |
| 117 |
<tr class="no-background"> |
| 118 |
{% if mode == "heads" %} |
| 119 |
<td colspan="4" class="pagination"> |
| 120 |
{% if has_prev %} |
| 121 |
{% let offset = offset.saturating_sub(PAGE_SIZE) %} |
| 122 |
{% if offset > 0 %} |
| 123 |
<a href="/{{ repo.name }}/refs/heads/?ofs={{ offset }}">[prev]</a> |
| 124 |
{% else %} |
| 125 |
<a href="/{{ repo.name }}/refs/heads/">[prev]</a> |
| 126 |
{% endif %} |
| 127 |
{% endif %} |
| 128 |
|
| 129 |
{% if branches_has_more %} |
| 130 |
<a href="/{{ repo.name }}/refs/heads?ofs={{ offset.saturating_add(PAGE_SIZE) }}">[next]</a> |
| 131 |
{% endif %} |
| 132 |
</td> |
| 133 |
{% else if branches_has_more %} |
| 134 |
<td class="show_more"> |
| 135 |
<a href="/{{ repo.name }}/refs/heads">[...]</a> |
| 136 |
</td> |
| 137 |
{% endif %} |
| 138 |
</tr> |
| 139 |
</tbody> |
| 140 |
{% endmacro %} |
| 141 |
|
| 142 |
{% macro tags(tags, tags_has_more, has_prev, page, mode) %} |
| 143 |
<thead> |
| 144 |
<tr> |
| 145 |
<th>Tag</th> |
| 146 |
<th>Download</th> |
| 147 |
<th>Author</th> |
| 148 |
<th>Age</th> |
| 149 |
</tr> |
| 150 |
</thead> |
| 151 |
<tbody> |
| 152 |
{% for tag in tags %} |
| 153 |
<tr> |
| 154 |
<td><a href="/{{ repo.name }}/tag/?h={{ tag.name }}">{{ tag.name }}</a></td> |
| 155 |
<td> |
| 156 |
<a href="/{{ repo.name }}/snapshot/?h={{ tag.name }}">{{ tag.name }}.tar.gz</a> |
| 157 |
</td> |
| 158 |
<td> |
| 159 |
{% if let Some(tagger) = tag.tagger %} |
| 160 |
<span class="avatar"> |
| 161 |
<img class="inline" src="{{ tagger.avatar_url(20) }}"> |
| 162 |
<img class="onhover" src="{{ tagger.avatar_url(128) }}"> |
| 163 |
</span> |
| 164 |
{{ tagger.name }} |
| 165 |
{% endif %} |
| 166 |
</td> |
| 167 |
{% let time = tag.time.format_relative() %} |
| 168 |
<td class=" |
| 169 |
{{ time.1 }}" title="{{ tag.time.format() }}">{{ time.0 }}</td> |
| 170 |
</tr> |
| 171 |
{% endfor %} |
| 172 |
<tr class="no-background"> |
| 173 |
{% if mode == "tags" %} |
| 174 |
<td colspan="4" class="pagination"> |
| 175 |
{% if has_prev %} |
| 176 |
{% let offset = offset.saturating_sub(PAGE_SIZE) %} |
| 177 |
{% if offset > 0 %} |
| 178 |
<a href="/{{ repo.name }}/refs/tags/?ofs={{ offset }}">[prev]</a> |
| 179 |
{% else %} |
| 180 |
<a href="/{{ repo.name }}/refs/tags/">[prev]</a> |
| 181 |
{% endif %} |
| 182 |
{% endif %} |
| 183 |
|
| 184 |
{% if tags_has_more %} |
| 185 |
<a href="/{{ repo.name }}/refs/tags?ofs={{ offset.saturating_add(PAGE_SIZE) }}">[next]</a> |
| 186 |
{% endif %} |
| 187 |
</td> |
| 188 |
{% else if tags_has_more %} |
| 189 |
<td class="show_more"> |
| 190 |
<a href="/{{ repo.name }}/refs/tags">[...]</a> |
| 191 |
</td> |
| 192 |
{% endif %} |
| 193 |
</tr> |
| 194 |
</tbody> |
| 195 |
{% endmacro %} |
| 196 |
|
| 197 |
{% macro commits(commits, commits_has_more, has_prev, page, mode) %} |
| 198 |
<thead> |
| 199 |
<tr> |
| 200 |
<th>Age</th> |
| 201 |
<th>Commit message</th> |
| 202 |
<th>Author</th> |
| 203 |
</tr> |
| 204 |
</thead> |
| 205 |
<tbody> |
| 206 |
{% for commit in commits %} |
| 207 |
<tr> |
| 208 |
{% let time = commit.committer.time.format_relative() %} |
| 209 |
<td class="{{ time.1 }}" title="{{ commit.committer.time.format() }}">{{ time.0 }}</td> |
| 210 |
<td> |
| 211 |
<a href="/{{ repo.name }}/commit/?id={{ commit.id }}">{{ commit.summary()? | truncate(80)}}</a> |
| 212 |
{% if commit.is_head(repo)? %}<a href="/{{ repo.name }}/commit/?id={{ commit.id }}" class="badge_head">HEAD</a>{% endif %} |
| 213 |
{% for branch in commit.branch_tips(repo)? %} |
| 214 |
<a href="/{{ repo.name }}/log/?h={{ branch }}" class="badge_branch">{{ branch }}</a> |
| 215 |
{% endfor %} |
| 216 |
</td> |
| 217 |
<td> |
| 218 |
<span class="avatar"> |
| 219 |
<img class="inline" src="{{ commit.author.avatar_url(20) }}"> |
| 220 |
<img class="onhover" src="{{ commit.author.avatar_url(128) }}"> |
| 221 |
</span> |
| 222 |
{{ commit.author.name }} |
| 223 |
</td> |
| 224 |
</tr> |
| 225 |
{% endfor %} |
| 226 |
<tr class="no-background"> |
| 227 |
{% if mode == "log" %} |
| 228 |
<td colspan="3" class="pagination"> |
| 229 |
{% if has_prev %} |
| 230 |
{% let offset = offset.saturating_sub(PAGE_SIZE) %} |
| 231 |
{% if offset > 0 %} |
| 232 |
<a href="/{{ repo.name }}/log/?ofs={{ offset }}">[prev]</a> |
| 233 |
{% else %} |
| 234 |
<a href="/{{ repo.name }}/log/">[prev]</a> |
| 235 |
{% endif %} |
| 236 |
{% endif %} |
| 237 |
|
| 238 |
{% if commits_has_more %} |
| 239 |
<a href="/{{ repo.name }}/log/?ofs={{ offset.saturating_add(PAGE_SIZE) }}">[next]</a> |
| 240 |
{% endif %} |
| 241 |
</td> |
| 242 |
{% else if commits_has_more %} |
| 243 |
<td class="show_more"> |
| 244 |
<a href="/{{ repo.name }}/log/">[...]</a> |
| 245 |
</td> |
| 246 |
{% endif %} |
| 247 |
</tr> |
| 248 |
</tbody> |
| 249 |
{% endmacro %} |