Files
flowers/templates/show.html
T

83 lines
3.2 KiB
HTML
Raw Normal View History

2025-03-25 20:32:26 +00:00
{% extends "common.html" %}
2026-07-18 20:27:19 +02:00
{% block title %}{{ flower.organization }} · Flowers{% endblock %}
2025-03-25 20:32:26 +00:00
{% block menuoptions %}
2026-07-18 20:27:19 +02:00
<form action="{{ url_for('flower_vase.application') }}" method="post">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<input type="hidden" name="action" value="list">
<input type="hidden" name="filter" value="{{ filter|default('') }}">
2026-07-18 21:16:07 +02:00
<button class="button ghost compact" type="submit">Back to bouquet</button>
2026-07-18 20:27:19 +02:00
</form>
{% endblock %}
2025-03-25 20:32:26 +00:00
{% block content %}
2026-07-18 20:27:19 +02:00
<section class="detail-card card">
<div class="detail-heading">
<span class="entry-icon large" aria-hidden="true">{{ flower.organization[:1]|upper }}</span>
<div>
2026-07-18 21:16:07 +02:00
<p class="eyebrow">Flower</p>
2026-07-18 20:27:19 +02:00
<h1>{{ flower.organization }}</h1>
{% if flower.dateCreated not in ('STORED', 'FAILED') %}<p class="muted">Version from {{ flower.dateCreated[:10] }}</p>{% endif %}
</div>
</div>
<dl class="details">
<div><dt>Name</dt><dd>{{ flower.myName or '—' }}</dd></div>
<div><dt>Login</dt><dd>{{ flower.myID }}</dd></div>
<div>
<dt>Secret</dt>
<dd class="secret-line">
<span id="secret" data-secret="{{ flower.mySecret }}">••••••••••••</span>
<button class="icon-button" id="reveal" type="button">Reveal</button>
<button class="icon-button" id="copy" type="button">Copy</button>
</dd>
2025-03-25 20:32:26 +00:00
</div>
2026-07-18 20:27:19 +02:00
</dl>
{% if flower.dateCreated not in ('STORED', 'FAILED') %}
<div class="detail-actions">
2026-08-06 22:24:28 +02:00
<form id="edit-form" action="{{ url_for('flower_vase.application') }}" method="post">
2026-07-18 20:27:19 +02:00
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<input type="hidden" name="action" value="edit">
<input type="hidden" name="organization" value="{{ flower.organization }}">
<input type="hidden" name="datetime" value="{{ flower.dateCreated }}">
<button class="button primary" type="submit">Edit entry</button>
</form>
</div>
{% endif %}
</section>
<script>
const secret = document.querySelector('#secret');
const reveal = document.querySelector('#reveal');
const copy = document.querySelector('#copy');
2026-08-06 22:24:28 +02:00
const editForm = document.querySelector('#edit-form');
2026-07-18 20:27:19 +02:00
let visible = false;
2026-08-06 22:24:28 +02:00
const returnToList = window.setTimeout(() => {
window.location.assign('{{ url_for("flower_vase.application") }}');
}, 8000);
if (editForm) {
editForm.addEventListener('submit', () => window.clearTimeout(returnToList));
}
2026-07-18 20:27:19 +02:00
reveal.addEventListener('click', () => {
visible = !visible;
secret.textContent = visible ? secret.dataset.secret : '••••••••••••';
reveal.textContent = visible ? 'Hide' : 'Reveal';
});
copy.addEventListener('click', async () => {
2026-07-18 21:00:33 +02:00
try {
await navigator.clipboard.writeText(secret.dataset.secret);
copy.textContent = 'Copied';
} catch (_) {
const field = document.createElement('textarea');
field.value = secret.dataset.secret;
field.style.position = 'fixed';
field.style.opacity = '0';
document.body.appendChild(field);
field.select();
copy.textContent = document.execCommand('copy') ? 'Copied' : 'Select and copy';
field.remove();
}
2026-07-18 20:27:19 +02:00
window.setTimeout(() => copy.textContent = 'Copy', 1400);
});
2025-03-25 20:32:26 +00:00
</script>
{% endblock %}