OXYGENHUB
# 1ac84c62ba53 oxygenhub / templates / file.html
3.9 KiB · HTML · last changed Web edits and browser conflict resolution; landing under a policy 1 month ago source blame history raw
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
      {% if repo.can(crate::auth::Access::Write) %}<a href="{{ repo.url }}/edit/{{ f.target.label }}/{{ f.path }}">edit</a>{% endif %}
22
    </span>
23
  </header>
24
  {% 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 %}
25
  {% if is_image %}
26
    <p class="center"><img src="{{ repo.url }}/file/{{ f.target.label }}/{{ f.path }}?plain=1" alt="{{ f.name }}"></p>
27
  {% else %}
28
  {% match f.body %}
29
  {% 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>
30
  {% 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>
31
  {% when crate::repos::view::FileBody::Text(_) %}
32
    {% if let Some(html) = markdown_html %}
33
      <article class="doc" id="rendered">{{ html|safe }}</article>
34
    {% else %}
35
    <table class="code{% if blame.is_some() %} blamed{% endif %}">
36
    {% for line in lines %}
37
      {% let n = loop.index %}
38
      <tr id="L{{ n }}">
39
        {% if let Some(b) = blame %}{% let r = b[loop.index0] %}
40
          {% 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 %}
41
        {% endif %}
42
        <td class="n">{{ n }}</td>
43
        <td class="t"><pre>{{ line|safe }}</pre></td>
44
      </tr>
45
    {% endfor %}
46
    </table>
47
    {% endif %}
48
  {% endmatch %}
49
  {% endif %}
50
</section>
51
{% endblock %}