Files
pastable2/templates/list.html
T
2026-11-14 17:54:29 +01:00

53 lines
2.3 KiB
HTML

{% extends "base.html" %}
{% block title %}Your pastes · Pastable{% endblock %}
{% block content %}
<h1>Your pastes and short links</h1>
<div class="table-scroll">
<table>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Type</th>
<th scope="col">Content</th>
<th scope="col">Language</th>
<th scope="col">Views / limit</th>
<th scope="col">Created at</th>
<th scope="col">Updated at</th>
<th scope="col">Expires at</th>
</tr>
</thead>
<tbody>
{% for note in notes %}
<tr>
{% match note.paste_type %}
{% when PasteType::TextV1 %}
<td><a href="/{{ note.id|urlencode_strict }}">{{ note.id }}</a></td>
<td>Paste</td>
{% when PasteType::UrlV1 %}
<td><a href="/to/{{ note.id|urlencode_strict }}">{{ note.id }}</a></td>
<td>URL</td>
{% endmatch %}
<td><pre><code>{{ note.content }}</code></pre></td>
<td>{% match note.language %}{% when Some with (language) %}{{ language }}{% when None %}—{% endmatch %}</td>
<td>{{ note.views }} / {% match note.max_views %}{% when Some with (max) %}{{ max }}{% when None %}∞{% endmatch %}</td>
<td><time data-unix="{{ note.created_at }}">{{ note.created_at }}</time></td>
<td>{% match note.updated_at %}{% when Some with (updated) %}<time data-unix="{{ updated }}">{{ updated }}</time>{% when None %}—{% endmatch %}</td>
<td>{% match note.expiration %}{% when Some with (expiration) %}<time data-unix="{{ expiration }}">{{ expiration }}</time>{% when None %}Never{% endmatch %}</td>
</tr>
{% else %}
<tr><td colspan="8">No pastes or short links yet.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
<script>
document.querySelectorAll('time[data-unix]').forEach(time => {
const date = new Date(Number(time.dataset.unix) * 1000);
if (!Number.isNaN(date.getTime())) {
time.dateTime = date.toISOString();
time.textContent = date.toLocaleString();
}
});
</script>
{% endblock %}