d23464c0 Andy McCall 1 month ago ↶
1
{% extends "base.html" %}
2
{% import "repo_tabs.html" as m %}
6ae41081 Andy McCall 1 month ago ↶
3
{% block title %}{{ f.path }} at {{ f.target.short_label() }} · {{ repo.owner }}/{{ repo.name }}{% endblock %}
4
{% block bodyattrs %} data-repo="{{ repo.url }}" data-ref="{{ f.target.label }}"{% if let Some(p) = permalink %} data-permalink="{{ repo.url }}/file/{{ p }}/{{ f.path }}{% if blame.is_some() %}?blame=1{% endif %}"{% endif %}{% endblock %}
d23464c0 Andy McCall 1 month ago ↶
5
{% block tabs %}{% call m::tabs(repo, "code") %}{% endblock %}
6
{% block mainclass %} class="wide"{% endblock %}
7
{% block content %}
8
< div class = " bar " >
6ae41081 Andy McCall 1 month ago ↶
9
< span class = " ref px " > {% if f.target.kind == crate::repos::view::RefKind::Change %}# {{ f.target.short_label() }}{% else %}◆ {{ f.target.label }}{% endif %}</ span >
d23464c0 Andy McCall 1 month ago ↶
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 >
6ae41081 Andy McCall 1 month ago ↶
12
< div class = " file-layout " >
13
< nav class = " file-side " aria-label = " Files" >
14
< a class = " side-root " href = " {{ repo.url }}/tree/{{ f.target.label }}" > {{ repo.name }}</ a >
15
< ul >
16
{% for e in f.sidebar %}
17
< li style = " -- d : {{ e.depth }}" {% if e.on_path && !e.dir %} class = " here " aria-current = " page" {% endif %}>
18
{% if e.more %}< a class = " mute " href = " {{ repo.url }}/tree/{{ f.target.label }}/{{ e.path }}" > … {{ e.name }}</ a >
19
{% else if e.dir %}< a href = " {{ repo.url }}/tree/{{ f.target.label }}/{{ e.path }}" > < span class = " glyph " aria-hidden = " true" > {% if e.on_path %}▾{% else %}▸{% endif %}</ span > {{ e.name }}/</ a >
20
{% else %}< a href = " {{ repo.url }}/file/{{ f.target.label }}/{{ e.path }}" > {{ e.name }}</ a > {% endif %}
21
</ li >
22
{% endfor %}
23
</ ul >
24
</ nav >
25
< section class = " filebox file-main " >
d23464c0 Andy McCall 1 month ago ↶
26
< header >
27
< 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 >
28
< span class = " modes " >
29
{% 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 >
30
{% else %}< a href = " {{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}" {% if blame.is_none () %} class = " on " {% endif %}> source</ a > {% endif %}
31
< a href = " {{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?blame=1" {% if blame.is_some () %} class = " on " {% endif %}> blame</ a >
32
< a href = " {{ repo.url }}/changes/{{ f.target.label }}?path={{ f.path }}" > history</ a >
33
< a href = " {{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?plain=1" > raw</ a >
14530604 Andy McCall 1 month ago ↶
34
{% if repo.can(crate::auth::Access::Write) %}< a href = " {{ repo.url }}/edit/{{ f.target.label }}/{{ f.path }}" > edit</ a > {% endif %}
d23464c0 Andy McCall 1 month ago ↶
35
</ span >
36
</ header >
6ae41081 Andy McCall 1 month ago ↶
37
< div class = " linebar " hidden > < span class = " small mute " data-linebar-label > </ span > < button type = " button" class = " btn small " data-copy-lines > Copy lines</ button > {% if permalink.is_some() %}< button type = " button" class = " btn small " data-copy-permalink > Copy permalink</ button > {% endif %}</ div >
d23464c0 Andy McCall 1 month ago ↶
38
{% 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 %}
39
{% if is_image %}
40
< p class = " center " > < img src = " {{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?plain=1" alt = " {{ f.name }}" > </ p >
41
{% else %}
42
{% match f.body %}
43
{% 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 >
44
{% 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 >
45
{% when crate::repos::view::FileBody::Text(_) %}
46
{% if let Some(html) = markdown_html %}
47
< article class = " doc " id = " rendered " > {{ html|safe }}</ article >
48
{% else %}
49
< table class = " code{% if blame.is_some() %} blamed{% endif %} " >
50
{% for line in lines %}
51
{% let n = loop.index %}
52
< tr id = " L{{ n }} " >
53
{% if let Some(b) = blame %}{% let r = b[loop.index0] %}
6ae41081 Andy McCall 1 month ago ↶
54
{% if r.first %}< td class = " blame age-{{ r.age }} " 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 > {% if let Some(b) = r.before %} < a class = " before " href = " {{ repo.url }}/file/{{ b }}/{{ f.path }}?blame=1#L{{ n }}" title = " Blame the state before this change" > ↶</ a > {% endif %}</ td > {% endif %}
d23464c0 Andy McCall 1 month ago ↶
55
{% endif %}
56
< td class = " n " > {{ n }}</ td >
57
< td class = " t " > < pre > {{ line|safe }}</ pre > </ td >
58
</ tr >
59
{% endfor %}
60
</ table >
61
{% endif %}
62
{% endmatch %}
63
{% endif %}
64
</ section >
6ae41081 Andy McCall 1 month ago ↶
65
</ div >
d23464c0 Andy McCall 1 month ago ↶
66
{% endblock %}