samjeston / openhub Public
Sam Jeston Working vertical 9aa3c45 · History
69 lines· 3.5 KB ·HTML
Raw
1{% extends "layout_repo.html" %}
2{% block page_title %}{{ view.path }} at {{ view.refname }} · {% endblock %}
3{% block content %}
4{% let base = r.base() %}
5<div class="code-toolbar">
6 {% let refsel = view.refsel %}
7 {% include "partials/refsel.html" %}
8 <nav class="breadcrumbs" aria-label="Path">
9 <a href="{{ base }}/tree/{{ crate::web::fmt::urlpath(view.refname) }}"><strong>{{ r.repo.name }}</strong></a>
10 {% for c in view.crumbs %}<span class="crumb-sep">/</span><a href="{{ c.href }}">{{ c.name }}</a>{% endfor %}
11 <span class="crumb-sep">/</span><strong>{{ view.file_name }}</strong>
12 <button type="button" class="btn btn-sm btn-ghost btn-icon" data-copy-text="{{ view.path }}" title="Copy path">{{ crate::web::fmt::icon("copy")|safe }}</button>
13 </nav>
14</div>
15{% if let Some(c) = view.latest %}
16<div class="box latest-commit-box">
17 <div class="box-header latest-commit">
18 {{ crate::web::fmt::avatar(c.author_name, 22)|safe }}
19 <strong class="latest-author">{{ c.author_name }}</strong>
20 <a class="latest-message truncate" href="{{ base }}/commit/{{ c.id }}">{{ c.summary }}</a>
21 <span class="latest-meta">
22 <a class="text-mono text-muted" href="{{ base }}/commit/{{ c.id }}">{{ c.short_id }}</a>
23 <span class="dot">·</span>
24 <time title="{{ crate::web::fmt::datetime_full(c.committer_time) }}">{{ crate::web::fmt::ago(c.committer_time) }}</time>
25 </span>
26 <a class="history-link" href="{{ view.history_href }}">{{ crate::web::fmt::icon("history")|safe }} History</a>
27 </div>
28</div>
29{% endif %}
30<div class="box blob-box">
31 <div class="box-header blob-header">
32 <div class="blob-info">
33 {% if view.line_count > 0 %}<span>{{ crate::web::fmt::plural(view.line_count, "line") }}</span><span class="dot">·</span>{% endif %}
34 <span>{{ crate::web::fmt::bytes(view.size) }}</span>
35 {% if let Some(lang) = view.language %}<span class="dot">·</span><span>{{ lang }}</span>{% endif %}
36 </div>
37 <div class="blob-actions">
38 {% if view.is_markdown %}
39 <div class="btn-group">
40 <a class="btn btn-sm{% if !view.plain %} selected{% endif %}" href="?">Preview</a>
41 <a class="btn btn-sm{% if view.plain %} selected{% endif %}" href="?plain=1">Code</a>
42 </div>
43 {% endif %}
44 <a class="btn btn-sm" href="{{ view.raw_href }}">Raw</a>
45 <a class="btn btn-sm btn-icon" href="{{ view.raw_href }}" download="{{ view.file_name }}" title="Download">{{ crate::web::fmt::icon("download")|safe }}</a>
46 </div>
47 </div>
48 {% match view.content %}
49 {% when crate::web::code::BlobContent::Code with { lines } %}
50 <div class="code-scroll">
51 <table class="code-view" data-lines>
52 <tbody>
53 {% for line in lines %}
54 <tr id="L{{ loop.index }}"><td class="num"><a href="#L{{ loop.index }}">{{ loop.index }}</a></td><td class="code">{{ line|safe }}</td></tr>
55 {% endfor %}
56 </tbody>
57 </table>
58 </div>
59 {% when crate::web::code::BlobContent::Markdown with { html } %}
60 <article class="markdown-body">{{ html|safe }}</article>
61 {% when crate::web::code::BlobContent::Image with { src } %}
62 <div class="blob-image"><img src="{{ src }}" alt="{{ view.file_name }}"></div>
63 {% when crate::web::code::BlobContent::Binary %}
64 <div class="blob-note">Binary file not shown. <a href="{{ view.raw_href }}">View raw</a></div>
65 {% when crate::web::code::BlobContent::TooLarge %}
66 <div class="blob-note">This file is too large to display. <a href="{{ view.raw_href }}">View raw</a></div>
67 {% endmatch %}
68</div>
69{% endblock %}