Illustrations/web/templates/entry_view.html

148 lines
6.2 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block body_class %}themed-bg{% endblock %}
{% block content %}
<div class="container">
<!-- Toolbar -->
<div class="result-toolbar">
<div class="rt-left">
<a class="btn btn-secondary" href="{% url 'search' %}">← Back to Results</a>
<span class="rt-count">#{{ entry.id }}</span>
</div>
<div class="rt-right">
<a class="btn btn-primary" href="{% url 'entry_view' entry.next_id %}">Next</a>
<!-- Share button -->
<button id="share-btn" class="btn btn-primary" style="margin-left:6px;">
<span style="display:flex;align-items:center;gap:4px;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M13.5 1a1.5 1.5 0 0 1 1.5 1.5v3a.5.5 0 0 1-1 0V2.707l-6.146 6.147a.5.5 0 0 1-.708-.708L13.293 2H11.5a.5.5 0 0 1 0-1h3z"/>
<path d="M3.5 5a1.5 1.5 0 0 0-1.5 1.5v7A1.5 1.5 0 0 0 3.5 15h7a1.5 1.5 0 0 0 1.5-1.5V9a.5.5 0 0 1 1 0v4.5A2.5 2.5 0 0 1 10.5 16h-7A2.5 2.5 0 0 1 1 13.5v-7A2.5 2.5 0 0 1 3.5 4H8a.5.5 0 0 1 0 1H3.5z"/>
</svg>
Share
</span>
</button>
<a class="btn btn-secondary" href="{% url 'entry_edit' entry.id %}">Edit</a>
</div>
</div>
<!-- Card -->
<div class="card entry-view">
<div class="entry-section">
<div class="entry-label">Subject</div>
<div class="entry-value">{{ entry.subject|default:"—" }}</div>
</div>
<div class="entry-section">
<div class="entry-label">Illustration</div>
<div class="entry-value" id="illustration-text">{{ entry.illustration|linebreaksbr|default:"—" }}</div>
</div>
<div class="entry-section">
<div class="entry-label">Application</div>
<div class="entry-value" id="application-text">{{ entry.application|linebreaksbr|default:"—" }}</div>
</div>
<!-- Meta -->
<div class="meta-grid">
<div class="meta-item">
<div class="meta-label">Scripture</div>
<div class="meta-value">{{ entry.scripture_raw|default:"—" }}</div>
</div>
<!-- Fixed Source block -->
<div class="meta-item">
<div class="meta-label">Source</div>
<div class="meta-value">
{% if entry.source %}
{% with s=entry.source|default:"" %}
{% with sl=s|lower|cut:" " %}
{% if
sl|slice:":2" == "w " or sl|startswith:"w" or
sl|slice:":2" == "wp" or sl|slice:":2" == "ws" or sl|slice:":1" == "g" or
sl|slice:":2" == "yb" or sl|slice:":2" == "kt" or
sl|slice:":2" == "km" or sl|slice:":3" == "mwb" or
sl|slice:":2" == "ap" or sl|slice:":3" == "apf" or sl|slice:":2" == "be" or sl|slice:":2" == "bh" or
sl|slice:":2" == "br" or sl|slice:":2" == "bt" or sl|slice:":3" == "btg" or sl|slice:":2" == "cf" or
sl|slice:":2" == "cl" or sl|slice:":2" == "ct" or sl|slice:":2" == "dp" or sl|slice:":2" == "fg" or
sl|slice:":2" == "fy" or sl|slice:":2" == "gt" or sl|slice:":2" == "hb" or sl|slice:":2" == "im" or
sl|slice:":2" == "ip" or sl|slice:":2" == "it" or sl|slice:":2" == "jv" or sl|slice:":2" == "ka" or
sl|slice:":2" == "kj" or sl|slice:":2" == "kl" or sl|slice:":2" == "lf" or sl|slice:":3" == "lff" or
sl|slice:":2" == "ll" or sl|slice:":2" == "ly" or sl|slice:":2" == "my" or sl|slice:":2" == "od" or
sl|slice:":2" == "pe" or sl|slice:":2" == "po" or sl|slice:":2" == "pt" or sl|slice:":2" == "rr" or
sl|slice:":2" == "rs" or sl|slice:":2" == "sg" or sl|slice:":2" == "sh" or sl|slice:":2" == "si" or
sl|slice:":2" == "td" or sl|slice:":2" == "tp" or sl|slice:":2" == "tr" or sl|slice:":2" == "ts" or
sl|slice:":2" == "un"
%}
<a class="chip chip-link"
href="https://wol.jw.org/en/wol/l/r1/lp-e?q={{ s|urlencode }}"
target="_blank" rel="noopener noreferrer">
{{ s }}
</a>
{% else %}
<a class="chip chip-link"
href="https://www.google.com/search?q={{ s|urlencode }}"
target="_blank" rel="noopener noreferrer">
{{ s }}
</a>
{% endif %}
{% endwith %}
{% endwith %}
{% else %}—{% endif %}
</div>
</div>
<div class="meta-item">
<div class="meta-label">Talk Title</div>
<div class="meta-value">{{ entry.talk_title|default:"—" }}</div>
</div>
<div class="meta-item">
<div class="meta-label">Talk Number</div>
<div class="meta-value">{{ entry.talk_number|default:"—" }}</div>
</div>
<div class="meta-item">
<div class="meta-label">Entry Code</div>
<div class="meta-value">{{ entry.entry_code|default:"—" }}</div>
</div>
<div class="meta-item">
<div class="meta-label">Date Added</div>
<div class="meta-value">{{ entry.date_added|date:"Y-m-d" }}</div>
</div>
<div class="meta-item">
<div class="meta-label">Date Edited</div>
<div class="meta-value">{{ entry.date_edited|date:"Y-m-d" }}</div>
</div>
</div>
</div>
</div>
<!-- Toast -->
<div id="copy-toast"
style="position:fixed;bottom:20px;left:50%;transform:translateX(-50%);
background:#333;color:#fff;padding:10px 16px;border-radius:6px;
font-size:14px;display:none;z-index:9999;">
The Illustration was copied to the clipboard
</div>
<script>
document.getElementById('share-btn').addEventListener('click', function() {
const illustration = document.getElementById('illustration-text').innerText.trim();
const application = document.getElementById('application-text').innerText.trim();
const textToCopy = illustration + " " + application;
navigator.clipboard.writeText(textToCopy).then(() => {
const toast = document.getElementById('copy-toast');
toast.style.display = 'block';
setTimeout(() => { toast.style.display = 'none'; }, 5000);
}).catch(err => {
alert('Failed to copy: ' + err);
});
});
</script>
{% endblock %}