Update web/templates/entry_view.html

This commit is contained in:
Joshua Laymon 2025-08-15 22:52:26 +00:00
parent ff69969ea8
commit 5c664232be

View File

@ -14,29 +14,19 @@
{% endif %} {% endif %}
</div> </div>
<div class="rt-right"> <div class="rt-right">
<form method="get" action="{% url 'nav_prev' %}" class="inline" style="display:inline;"> <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' }}"> <input type="hidden" name="i" value="{{ position|add:'-1' }}">
<button class="btn btn-lg" {% if position <= 1 %}disabled{% endif %}> Prev</button> <button class="btn btn-lg" {% if position <= 1 %}disabled{% endif %}> Prev</button>
</form> </form>
<form method="get" action="{% url 'nav_next' %}" class="inline">
<form method="get" action="{% url 'nav_next' %}" class="inline" style="display:inline;"> <!-- send current zero-based index (position-1); view will add 1 -->
<input type="hidden" name="i" value="{{ position|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> <button class="btn btn-lg btn-primary" {% if position >= count %}disabled{% endif %}>Next </button>
</form> </form>
<!-- Share Button -->
<button id="shareBtn" class="btn btn-lg" title="Share this illustration" style="margin-left:6px;">
<span style="display:inline-flex;align-items:center;gap:6px;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
viewBox="0 0 16 16">
<path d="M11 2a2 2 0 1 1 1.414 3.414l-6.657 3.89a2.005 2.005 0 0 1 0 .392l6.657 3.89A2 2 0 1 1 11 14a2 2 0 0 1-.723-.138l-6.657-3.89a2 2 0 1 1 0-4l6.657-3.89A2 2 0 0 1 11 2z"/>
</svg>
Share
</span>
</button>
{% if user.is_authenticated and user.is_staff %} {% if user.is_authenticated and user.is_staff %}
<a class="btn btn-outline" href="{% url 'entry_edit' entry.id %}">Edit</a> <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> <a class="btn btn-danger" href="{% url 'entry_delete' entry.id %}">Delete</a>
{% endif %} {% endif %}
</div> </div>
@ -63,7 +53,7 @@
<!-- ILLUSTRATION --> <!-- ILLUSTRATION -->
<div class="section"> <div class="section">
<div class="section-label">Illustration</div> <div class="section-label">Illustration</div>
<div id="illustrationText" class="section-body lead-text"> <div class="section-body lead-text">
{{ entry.illustration|linebreaksbr|default:"—" }} {{ entry.illustration|linebreaksbr|default:"—" }}
</div> </div>
</div> </div>
@ -71,7 +61,7 @@
<!-- APPLICATION --> <!-- APPLICATION -->
<div class="section"> <div class="section">
<div class="section-label">Application</div> <div class="section-label">Application</div>
<div id="applicationText" class="section-body lead-text"> <div class="section-body lead-text">
{{ entry.application|linebreaksbr|default:"—" }} {{ entry.application|linebreaksbr|default:"—" }}
</div> </div>
</div> </div>
@ -137,27 +127,6 @@
</div> </div>
<!-- Toast -->
<div id="toast" style="visibility:hidden;min-width:200px;margin-left:-100px;background:#333;color:#fff;text-align:center;border-radius:4px;padding:10px;position:fixed;z-index:1;left:50%;bottom:30px;font-size:14px;">
The Illustration was copied to the clipboard
</div>
<script>
document.getElementById("shareBtn").addEventListener("click", function() {
const ill = document.getElementById("illustrationText").innerText.trim();
const app = document.getElementById("applicationText").innerText.trim();
const textToCopy = ill + " " + app;
navigator.clipboard.writeText(textToCopy).then(function() {
const toast = document.getElementById("toast");
toast.style.visibility = "visible";
setTimeout(() => { toast.style.visibility = "hidden"; }, 5000);
}).catch(function(err) {
console.error("Failed to copy: ", err);
});
});
</script>
<style> <style>
.subject-pills{ .subject-pills{
display:flex; display:flex;
@ -174,7 +143,7 @@ document.getElementById("shareBtn").addEventListener("click", function() {
border:1px solid #d7e6f7; border:1px solid #d7e6f7;
color:#0f172a; color:#0f172a;
text-decoration:none; text-decoration:none;
text-transform: capitalize; text-transform: capitalize; /* Capitalize each word */
} }
.chip-subject:hover{ .chip-subject:hover{
background:#e2effc; background:#e2effc;