OXYGENHUB
# 951aed50c2f5 oxygenhub / templates / drop.html
5.1 KiB · HTML · last changed Embed a drop (closes #280) 15 days ago source blame history raw
1
{% extends "base.html" %}
2
{% import "repo_tabs.html" as m %}
3
{% block title %}{{ title }} · {{ repo.owner }}'s drop{% endblock %}
4
{% block bodyattrs %} data-repo="{{ repo.url }}"{% endblock %}
5
{% block tabs %}{% call m::tabs(repo, "code") %}{% endblock %}
6
{% block content %}
7
<div class="drop-head">
8
  <div class="drop-id">
9
    <h1>{{ title }}{% if !at_default %} <small>at {{ target }}</small>{% endif %}</h1>
10
    {% if !description.is_empty() %}<p class="drop-desc">{{ description }}</p>{% endif %}
11
    <p class="small mute">A drop by <a href="/{{ repo.owner }}">{{ repo.owner }}</a> · {{ files.len() }} file{% if files.len() != 1 %}s{% endif %} · created <time title="{{ created_ms|when_i }}">{{ created_ms|ago_i }}</time> · updated <time title="{{ updated_ms|when_i }}">{{ updated_ms|ago_i }}</time> · <a href="{{ repo.url }}/changes/{{ repo.default_bookmark }}">history</a>{% if !signed_in && stars > 0 %} · {{ stars }} star{% if stars != 1 %}s{% endif %}{% endif %}{% if let Some(f) = forked_from %} · forked from <a href="{{ f }}">{{ f }}</a>{% endif %}</p>
12
  </div>
13
  {% if signed_in || can_edit || can_delete || can_fork %}<div class="drop-actions">{% if signed_in %}<form class="inline" method="post" action="{{ repo.url }}/star"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit" title="{% if starred %}Take your star back{% else %}Star this drop{% endif %}" aria-pressed="{% if starred %}true{% else %}false{% endif %}">{% if starred %}★ STARRED{% else %}☆ STAR{% endif %} {{ stars }}</button></form>{% endif %}{% if can_fork %}<form class="inline" method="post" action="{{ repo.url }}/fork"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit" title="A copy of this drop, history and all, as a drop of yours">FORK</button></form>{% endif %}{% if can_edit %}<a class="go" href="{{ repo.url }}/edit">EDIT</a>{% endif %}{% if can_delete %}<form class="inline" method="post" action="{{ repo.url }}/delete" data-confirm="Delete this drop and its history? Its address stops working."><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit" class="danger-btn">DELETE</button></form>{% endif %}</div>{% endif %}
14
</div>
15
{% if secret %}<div class="strip">Secret: this drop is listed nowhere, but anyone with its address can read it.</div>{% endif %}
16
<div class="drop-clone"><label for="embed">Embed</label><input type="text" id="embed" class="code" readonly value="{{ embed }}" data-select><button type="button" class="small" data-copy="{{ embed }}">copy</button></div>
17
<div class="drop-clone"><label for="clone">Clone</label><input type="text" id="clone" class="code" readonly value="oxy clone {{ clone_url }}" data-select><button type="button" class="small" data-copy="oxy clone {{ clone_url }}">copy</button></div>
18
{% if files.is_empty() %}<p class="empty">No files.</p>{% endif %}
19
{% for f in files %}
20
<section class="filebox drop-filebox" id="{{ f.anchor }}">
21
  <header>
22
    <strong>{{ f.path }}</strong> <span class="small mute">{{ f.size|bytes }}{% if let Some(l) = f.language %} · {{ l }}{% endif %}</span>
23
    <span class="modes"><a href="{{ repo.url }}/raw/{{ target }}/{{ f.path }}">raw</a><a href="{{ repo.url }}/changes/{{ target }}?path={{ f.path }}">history</a></span>
24
  </header>
25
  {% if let Some(html) = f.markdown %}
26
  <article class="doc">{{ html|safe }}</article>
27
  {% else if let Some(note) = f.note %}
28
  <p class="empty">{{ note }} <a href="{{ repo.url }}/raw/{{ target }}/{{ f.path }}">Download it</a>.</p>
29
  {% else %}
30
  <table class="code">
31
  {% for line in f.lines %}
32
    <tr id="{{ f.anchor }}-L{{ loop.index }}"><td class="n">{{ loop.index }}</td><td class="t"><pre>{{ line|safe }}</pre></td></tr>
33
  {% endfor %}
34
  </table>
35
  {% endif %}
36
</section>
37
{% endfor %}
38
<section class="card-box drop-comments" id="comments">
39
  <div class="card-head"><h2>Comments</h2><span class="count-chip">{{ comments.len() }}</span></div>
40
  {% if comments.is_empty() %}<p class="empty small">No comments yet.</p>{% else %}
41
  <ul class="rows drop-comment-rows">{% for c in comments %}
42
    <li id="comment-{{ c.id }}">
43
      <div class="drop-comment">
44
        <div class="small mute"><a href="/{{ c.author }}">{{ c.author }}</a> · <time title="{{ c.created_ms|when_i }}">{{ c.created_ms|ago_i }}</time></div>
45
        <div class="doc">{{ c.html|safe }}</div>
46
      </div>
47
      {% if c.may_delete %}<form class="inline" method="post" action="{{ repo.url }}/comment/{{ c.id }}/delete" data-confirm="Delete this comment?"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button class="small danger">Delete</button></form>{% endif %}
48
    </li>{% endfor %}
49
  </ul>{% endif %}
50
  {% if signed_in %}<form class="pad drop-comment-form" method="post" action="{{ repo.url }}/comment">
51
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
52
    <label for="comment-body" class="small mute">Comment (Markdown)</label>
53
    <textarea id="comment-body" name="body" rows="4" required maxlength="65536"></textarea>
54
    <div class="actions"><button type="submit">COMMENT</button></div>
55
  </form>{% else %}<p class="small mute pad">Sign in to comment.</p>{% endif %}
56
</section>
57
{% endblock %}