| 1 |
{% extends "base.html" %} |
| 2 |
{% import "repo_tabs.html" as m %} |
| 3 |
{% block title %}{{ f.path }} at {{ f.target.label|short }} · {{ repo.owner }}/{{ repo.name }}{% endblock %} |
| 4 |
{% block bodyattrs %} data-repo="{{ repo.url }}" data-ref="{{ f.target.label }}"{% endblock %} |
| 5 |
{% block tabs %}{% call m::tabs(repo, "code") %}{% endblock %} |
| 6 |
{% block mainclass %} class="wide"{% endblock %} |
| 7 |
{% block content %} |
| 8 |
<div class="bar"> |
| 9 |
<span class="ref px">{% if f.target.kind == crate::repos::view::RefKind::Change %}# {{ f.target.label|short }}{% else %}◆ {{ f.target.label }}{% endif %}</span> |
| 10 |
<span class="crumbs"><a href="{{ repo.url }}/tree/{{ f.target.label }}">{{ repo.name }}</a>{% for (n, p) in f.crumbs %} / {% if loop.last %}<strong>{{ n }}</strong>{% else %}<a href="{{ repo.url }}/tree/{{ f.target.label }}/{{ p }}">{{ n }}</a>{% endif %}{% endfor %}</span> |
| 11 |
</div> |
| 12 |
<section class="filebox"> |
| 13 |
<header> |
| 14 |
<span class="small mute">{{ f.size|bytes }}{% if let Some(l) = language %} · {{ l }}{% endif %}{% if f.exec %} · executable{% endif %}{% if f.kind == crate::repos::view::EntryKind::Symlink %} · symlink{% endif %}{% if f.kind == crate::repos::view::EntryKind::Subrepo %} · subrepository pin{% endif %}{% if let Some(c) = f.last_change %} · last changed <a href="{{ repo.url }}/change/{{ c.hash }}">{{ c.title }}</a> {{ c.when_ms|ago }}{% endif %}</span> |
| 15 |
<span class="modes"> |
| 16 |
{% if is_markdown %}<a href="{{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}"{% if markdown_html.is_some() %} class="on"{% endif %}>rendered</a><a href="{{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?view=source"{% if blame.is_none() && markdown_html.is_none() %} class="on"{% endif %}>source</a> |
| 17 |
{% else %}<a href="{{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}"{% if blame.is_none() %} class="on"{% endif %}>source</a>{% endif %} |
| 18 |
<a href="{{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?blame=1"{% if blame.is_some() %} class="on"{% endif %}>blame</a> |
| 19 |
<a href="{{ repo.url }}/changes/{{ f.target.label }}?path={{ f.path }}">history</a> |
| 20 |
<a href="{{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?plain=1">raw</a> |
| 21 |
</span> |
| 22 |
</header> |
| 23 |
{% if f.conflicted %}<div class="strip bad">This file is in conflict in this state; the markers below are the conflict. <a href="{{ repo.url }}/conflicts">All conflicts</a></div>{% endif %} |
| 24 |
{% if is_image %} |
| 25 |
<p class="center"><img src="{{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?plain=1" alt="{{ f.name }}"></p> |
| 26 |
{% else %} |
| 27 |
{% match f.body %} |
| 28 |
{% when crate::repos::view::FileBody::TooLarge %}<p class="empty">This file is larger than the render limit. <a href="{{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?plain=1">Download it</a>.</p> |
| 29 |
{% when crate::repos::view::FileBody::Binary %}<p class="empty">Binary file, {{ f.size|bytes }}. <a href="{{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?plain=1">Download it</a>.</p> |
| 30 |
{% when crate::repos::view::FileBody::Text(_) %} |
| 31 |
{% if let Some(html) = markdown_html %} |
| 32 |
<article class="doc" id="rendered">{{ html|safe }}</article> |
| 33 |
{% else %} |
| 34 |
<table class="code{% if blame.is_some() %} blamed{% endif %}"> |
| 35 |
{% for line in lines %} |
| 36 |
{% let n = loop.index %} |
| 37 |
<tr id="L{{ n }}"> |
| 38 |
{% if let Some(b) = blame %}{% let r = b[loop.index0] %} |
| 39 |
{% if r.first %}<td class="blame" rowspan="{{ r.run }}"><a class="px" href="{{ repo.url }}/change/{{ r.hash }}" title="{{ r.hash }}">{{ r.short }}</a> <span class="who">{{ r.author }}</span> <time class="mute" title="{{ r.when_ms|when }}">{{ r.when_ms|ago }}</time></td>{% endif %} |
| 40 |
{% endif %} |
| 41 |
<td class="n">{{ n }}</td> |
| 42 |
<td class="t"><pre>{{ line|safe }}</pre></td> |
| 43 |
</tr> |
| 44 |
{% endfor %} |
| 45 |
</table> |
| 46 |
{% endif %} |
| 47 |
{% endmatch %} |
| 48 |
{% endif %} |
| 49 |
</section> |
| 50 |
{% endblock %} |