Update web/templates/entry_view.html

This commit is contained in:
Joshua Laymon 2025-08-14 18:33:24 +00:00
parent 20be6c706a
commit afbb52ed8a

View File

@ -1,119 +1,125 @@
{% extends "base.html" %}
{% block body_class %}themed-bg{% endblock %}
{% load static %}
{% block content %}
<div class="result-wrap">
<div class="entry-view">
<!-- Top bar: back + counter + clear Prev/Next -->
<div class="result-toolbar">
<div class="rt-left">
<a class="btn btn-secondary" href="{% url 'search' %}">← Back to Search</a>
{% if count %}
<span class="rt-count">{{ position }} of {{ count }}</span>
{% endif %}
</div>
<div class="rt-right">
<form method="get" action="{% url 'nav_prev' %}" class="inline">
<!-- send current zero-based index (position-1); view will subtract 1 -->
<input type="hidden" name="i" value="{{ position|add:'-1' }}">
<button class="btn btn-lg" {% if position <= 1 %}disabled{% endif %}> Prev</button>
</form>
<form method="get" action="{% url 'nav_next' %}" class="inline">
<!-- send current zero-based index (position-1); view will add 1 -->
<input type="hidden" name="i" value="{{ position|add:'-1' }}">
<button class="btn btn-lg btn-primary" {% if position >= count %}disabled{% endif %}>Next </button>
</form>
{% if user.is_authenticated and user.is_staff %}
<a class="btn btn-outline" href="{% url 'entry_edit' entry.id %}">Unlock / Edit</a>
<a class="btn btn-danger" href="{% url 'entry_delete' entry.id %}">Delete</a>
<!-- SUBJECT PILLS -->
<div class="section" style="margin-top:0;">
<div class="subject-chip-row" style="display:flex;flex-wrap:wrap;gap:10px;margin:0 0 14px;">
{% if subject_list %}
{% for s in subject_list %}
<a
class="chip chip-link chip-subject"
href="https://wol.jw.org/en/wol/l/r1/lp-e?q={{ s }}"
target="_blank" rel="noopener"
title="Search WOL for {{ s }}"
>{{ s }}</a>
{% endfor %}
{% else %}
<span class="chip chip-muted">(no subject)</span>
{% endif %}
</div>
</div>
<!-- Main card -->
<div class="result-card">
<!-- SUBJECTS as clickable WOL chips (replaces big title) -->
<div class="section" style="margin-top:0;">
<div class="subject-chip-row" style="display:flex;flex-wrap:wrap;gap:8px;margin:0 0 10px;">
{% if subject_list %}
{% for s in subject_list %}
<a
class="chip chip-link"
href="https://wol.jw.org/en/wol/l/r1/lp-e?q={{ s|urlencode }}"
target="_blank" rel="noopener"
title="Search WOL for {{ s }}"
>{{ s }}</a>
{% endfor %}
{% else %}
<span class="chip chip-muted">(no subject)</span>
{% endif %}
</div>
<!-- SCRIPTURES -->
{% if scripture_list %}
<div class="section scripture-links" style="display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px;">
{% for sc in scripture_list %}
<a
class="chip chip-link"
href="https://wol.jw.org/en/wol/l/r1/lp-e?q={{ sc }}"
target="_blank" rel="noopener"
title="Search WOL for {{ sc }}"
>{{ sc }}</a>
{% endfor %}
</div>
{% endif %}
<!-- ILLUSTRATION -->
<!-- Illustration -->
{% if entry.illustration %}
<div class="section">
<div class="section-label">Illustration</div>
<div class="section-body lead-text">
{{ entry.illustration|linebreaksbr|default:"—" }}
</div>
<h2>Illustration</h2>
<p>{{ entry.illustration|linebreaksbr }}</p>
</div>
{% endif %}
<!-- APPLICATION -->
<!-- Application -->
{% if entry.application %}
<div class="section">
<div class="section-label">Application</div>
<div class="section-body lead-text">
{{ entry.application|linebreaksbr|default:"—" }}
</div>
<h2>Application</h2>
<p>{{ entry.application|linebreaksbr }}</p>
</div>
{% endif %}
<!-- Meta (smaller) -->
<div class="meta-grid">
<div class="meta-item">
<div class="meta-label">Source</div>
<div class="meta-value">{{ entry.source|default:"—" }}</div>
</div>
<div class="meta-item">
<div class="meta-label">Scripture</div>
<div class="meta-value">
{% if scripture_list %}
{% for sc in scripture_list %}
<a
class="chip chip-link"
href="https://wol.jw.org/en/wol/l/r1/lp-e?q={{ sc|urlencode }}"
target="_blank" rel="noopener"
title="Search WOL for {{ sc }}"
>{{ sc }}</a>
{% endfor %}
{% else %}—{% endif %}
</div>
</div>
<div class="meta-item">
<div class="meta-label">Code</div>
<div class="meta-value">{{ entry.entry_code|default:"—" }}</div>
</div>
<div class="meta-item">
<div class="meta-label">Talk</div>
<div class="meta-value">
{% if entry.talk_title %}{{ entry.talk_title }}{% else %}—{% endif %}
{% if entry.talk_number %}<span class="chip chip-muted">#{{ entry.talk_number }}</span>{% endif %}
</div>
</div>
<div class="meta-item">
<div class="meta-label">Dates</div>
<div class="meta-value small">
{% if entry.date_added %}Added: {{ entry.date_added }}{% else %}Added: —{% endif %}
{% if entry.date_edited %} • Edited: {{ entry.date_edited }}{% endif %}
</div>
</div>
<!-- Source -->
{% if entry.source %}
<div class="section">
<h2>Source</h2>
<p>{{ entry.source }}</p>
</div>
{% endif %}
<!-- Talk Info -->
{% if entry.talk_number or entry.talk_title %}
<div class="section">
<h2>Talk Info</h2>
{% if entry.talk_number %}
<p><strong>Number:</strong> {{ entry.talk_number }}</p>
{% endif %}
{% if entry.talk_title %}
<p><strong>Title:</strong> {{ entry.talk_title }}</p>
{% endif %}
</div>
{% endif %}
<!-- Navigation Buttons -->
<div class="nav-buttons" style="margin-top: 20px; display:flex;gap:10px;flex-wrap:wrap;">
<a class="btn btn-secondary" href="{% url 'nav_prev' %}?i={{ position|add:'-1' }}">Previous</a>
<a class="btn btn-secondary" href="{% url 'nav_next' %}?i={{ position|add:'-1' }}">Next</a>
{% if user.is_authenticated %}
<a class="btn btn-primary" href="{% url 'entry_edit' entry.id %}">Edit</a>
{% if user.is_staff %}
<a class="btn btn-danger" href="{% url 'entry_delete' entry.id %}">Delete</a>
{% endif %}
{% endif %}
</div>
</div>
<style>
.chip-subject {
font-weight: bold;
font-size: 1rem;
padding: 6px 12px;
border-radius: 20px;
background: #eef2f7;
border: 1px solid #d1d5db;
color: #1f2937;
text-decoration: none;
display: inline-flex;
align-items: center;
transition: background 0.15s, border-color 0.15s;
}
.chip-subject:hover {
background: #dbeafe;
border-color: #93c5fd;
}
.chip {
padding: 4px 10px;
border-radius: 12px;
background: #f3f4f6;
border: 1px solid #d1d5db;
font-size: 0.9rem;
text-decoration: none;
color: inherit;
}
.chip-link:hover {
background: #e5e7eb;
border-color: #cbd5e1;
}
.section h2 {
margin-bottom: 6px;
}
</style>
{% endblock %}