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 >
65be9f9c Andy McCall 1 month ago ↶
24
{% if !functions.is_empty() %}
25
< p class = " side-root " id = " functions " > Functions</ p >
26
< ul class = " functions " >
27
{% for fnc in functions %}
28
< li > < a href = " {{ repo.url }}/function/{{ f.target.label }}/{{ f.path }}?start={{ fnc.start }}&end={{ fnc.end }}&name={{ fnc.name|urlencode }}" title = " History of {{ fnc.name }}, lines {{ fnc.start }}–{{ fnc.end }}" > {{ fnc.name }}</ a > < a class = " small mute " href = " #L{{ fnc.start }}" > L{{ fnc.start }}</ a > </ li >
29
{% endfor %}
30
</ ul >
31
{% endif %}
6ae41081 Andy McCall 1 month ago ↶
32
</ nav >
33
< section class = " filebox file-main " >
d23464c0 Andy McCall 1 month ago ↶
34
< header >
35
< 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 >
36
< span class = " modes " >
37
{% 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 >
38
{% else %}< a href = " {{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}" {% if blame.is_none () %} class = " on " {% endif %}> source</ a > {% endif %}
39
< a href = " {{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?blame=1" {% if blame.is_some () %} class = " on " {% endif %}> blame</ a >
40
< a href = " {{ repo.url }}/changes/{{ f.target.label }}?path={{ f.path }}" > history</ a >
41
< a href = " {{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?plain=1" > raw</ a >
14530604 Andy McCall 1 month ago ↶
42
{% 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 ↶
43
</ span >
44
</ header >
6ae41081 Andy McCall 1 month ago ↶
45
< 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 ↶
46
{% 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 %}
47
{% if is_image %}
48
< p class = " center " > < img src = " {{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?plain=1" alt = " {{ f.name }}" > </ p >
49
{% else %}
50
{% match f.body %}
51
{% 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 >
52
{% 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 >
53
{% when crate::repos::view::FileBody::Text(_) %}
54
{% if let Some(html) = markdown_html %}
55
< article class = " doc " id = " rendered " > {{ html|safe }}</ article >
56
{% else %}
57
< table class = " code{% if blame.is_some() %} blamed{% endif %} " >
58
{% for line in lines %}
59
{% let n = loop.index %}
60
< tr id = " L{{ n }} " >
61
{% if let Some(b) = blame %}{% let r = b[loop.index0] %}
6ae41081 Andy McCall 1 month ago ↶
62
{% 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 ↶
63
{% endif %}
64
< td class = " n " > {{ n }}</ td >
65
< td class = " t " > < pre > {{ line|safe }}</ pre > </ td >
66
</ tr >
67
{% endfor %}
68
</ table >
69
{% endif %}
70
{% endmatch %}
71
{% endif %}
72
</ section >
6ae41081 Andy McCall 1 month ago ↶
73
</ div >
d23464c0 Andy McCall 1 month ago ↶
74
{% endblock %}