| 1 |
{% extends "base.html" %} |
| 2 |
|
| 3 |
{% block title %}{{ item.title }} - Library - Makenotwork{% endblock %} |
| 4 |
{% block body_attrs %} class="padded-page library-page"{% endblock %} |
| 5 |
|
| 6 |
{% block head %} |
| 7 |
<meta name="robots" content="noindex"> |
| 8 |
{% endblock %} |
| 9 |
|
| 10 |
{% block content %} |
| 11 |
{% include "partials/site_header.html" %} |
| 12 |
|
| 13 |
<div class="container"> |
| 14 |
<p class="library-back"> |
| 15 |
<a href="/i/{{ item.id }}">← Store page</a> · |
| 16 |
<a href="/library">Your library</a> |
| 17 |
</p> |
| 18 |
|
| 19 |
{# A creator may save an empty cover_image_url (Some("")). Treat that |
| 20 |
like None so we don't reserve a 200px column with broken-image alt |
| 21 |
text. The cover wrapper is omitted entirely; CSS .no-cover collapses |
| 22 |
the grid to a single column. #} |
| 23 |
<div class="library-header{% if item.cover_image_url.as_deref().unwrap_or("").is_empty() %} no-cover{% endif %}"> |
| 24 |
{% if let Some(img) = item.cover_image_url %}{% if !img.is_empty() %} |
| 25 |
<div class="library-cover"> |
| 26 |
<img src="{{ img }}" alt="{{ item.title }}"> |
| 27 |
</div> |
| 28 |
{% endif %}{% endif %} |
| 29 |
<div class="library-header-body"> |
| 30 |
<h1 class="library-title">{{ item.title }}</h1> |
| 31 |
<p class="library-creator"> |
| 32 |
by <a href="/u/{{ creator_username }}">{{ creator_username }}</a> |
| 33 |
· <a href="/p/{{ project_slug }}">{{ project_title }}</a> |
| 34 |
</p> |
| 35 |
</div> |
| 36 |
</div> |
| 37 |
|
| 38 |
{% if !versions.is_empty() %} |
| 39 |
<section class="downloads-hero"> |
| 40 |
<h2 class="section-header">Downloads</h2> |
| 41 |
{% for version in versions %} |
| 42 |
{% if version.has_file %} |
| 43 |
<div class="download-row"> |
| 44 |
<span class="download-version">v{{ version.number }}</span> |
| 45 |
{% if let Some(label) = version.label %} |
| 46 |
<span class="download-label">{{ label }}</span> |
| 47 |
{% else %} |
| 48 |
<span class="download-label download-label--empty">{% match version.file_name %}{% when Some with (name) %}{{ name }}{% when None %}Download{% endmatch %}</span> |
| 49 |
{% endif %} |
| 50 |
<span class="download-size">{{ version.size }}</span> |
| 51 |
<button class="btn-secondary btn-download-compact" |
| 52 |
onclick="downloadVersion('{{ version.id }}')">Download</button> |
| 53 |
</div> |
| 54 |
{% endif %} |
| 55 |
{% endfor %} |
| 56 |
</section> |
| 57 |
|
| 58 |
<div class="download-notice"> |
| 59 |
Software downloads are provided by third-party creators. Every file is |
| 60 |
run through our |
| 61 |
<a href="/docs/content-scanning">six-layer scanning pipeline</a> |
| 62 |
(content-type, structural, archive, YARA, ClamAV, MalwareBazaar) before |
| 63 |
it's released, but scanning can't prove a file is safe — use antivirus |
| 64 |
software and download at your own risk. Report concerns to |
| 65 |
<a href="mailto:reports@makenot.work">reports@makenot.work</a>. |
| 66 |
</div> |
| 67 |
{% endif %} |
| 68 |
|
| 69 |
{% if !bundle_items.is_empty() %} |
| 70 |
<section class="library-section"> |
| 71 |
<h2 class="section-header">Included in this bundle ({{ bundle_items.len() }})</h2> |
| 72 |
{% for child in bundle_items %} |
| 73 |
<div class="bundle-child"> |
| 74 |
<span class="bundle-child-type">{{ child.item_type }}</span> |
| 75 |
<span class="bundle-child-title"> |
| 76 |
<a href="/l/{{ child.id }}">{{ child.title }}</a> |
| 77 |
</span> |
| 78 |
</div> |
| 79 |
{% endfor %} |
| 80 |
</section> |
| 81 |
{% endif %} |
| 82 |
|
| 83 |
{% if !item.description.is_empty() %} |
| 84 |
<section class="library-section"> |
| 85 |
<details> |
| 86 |
<summary class="lib-summary">Description</summary> |
| 87 |
<div class="lib-summary-body"> |
| 88 |
<p>{{ item.description }}</p> |
| 89 |
</div> |
| 90 |
</details> |
| 91 |
</section> |
| 92 |
{% endif %} |
| 93 |
|
| 94 |
{% if !sections.is_empty() %} |
| 95 |
<section class="library-section"> |
| 96 |
<div class="section-tabs"> |
| 97 |
{% for section in sections %} |
| 98 |
<button class="section-tab{% if loop.first %} is-selected{% endif %}" |
| 99 |
data-tab="section-{{ section.slug }}" |
| 100 |
onclick="switchSectionTab(this, 'section-{{ section.slug }}')">{{ section.title }}</button> |
| 101 |
{% endfor %} |
| 102 |
</div> |
| 103 |
{% for section in sections %} |
| 104 |
<div class="section-panel{% if loop.first %} active{% endif %}" id="section-{{ section.slug }}"> |
| 105 |
{{ section.body_html|safe }} |
| 106 |
</div> |
| 107 |
{% endfor %} |
| 108 |
</section> |
| 109 |
{% endif %} |
| 110 |
|
| 111 |
{% if item.license_preset.is_some() %} |
| 112 |
<section class="library-section"> |
| 113 |
<h2 class="section-header">License</h2> |
| 114 |
<p class="lib-license-name"> |
| 115 |
{% if item.license_preset.as_deref() == Some("personal_use") %}Personal Use Only |
| 116 |
{% else if item.license_preset.as_deref() == Some("royalty_free") %}Royalty-Free Commercial |
| 117 |
{% else if item.license_preset.as_deref() == Some("mit") %}MIT License |
| 118 |
{% else if item.license_preset.as_deref() == Some("apache2") %}Apache License 2.0 |
| 119 |
{% else if item.license_preset.as_deref() == Some("cc_by_4") %}CC BY 4.0 |
| 120 |
{% else if item.license_preset.as_deref() == Some("cc_by_nc_4") %}CC BY-NC 4.0 |
| 121 |
{% else if item.license_preset.as_deref() == Some("cc0") %}Public Domain (CC0) |
| 122 |
{% else if item.license_preset.as_deref() == Some("custom") %}Custom License |
| 123 |
{% else %}License |
| 124 |
{% endif %} |
| 125 |
</p> |
| 126 |
<p> |
| 127 |
<a href="/api/items/{{ item.id }}/license.txt" download="LICENSE.txt" class="lib-license-download">Download LICENSE.txt</a> |
| 128 |
</p> |
| 129 |
</section> |
| 130 |
{% endif %} |
| 131 |
|
| 132 |
{% include "partials/discussion_section.html" %} |
| 133 |
|
| 134 |
<footer class="item-footer"> |
| 135 |
<p>Powered by <a href="/">Makenot<span class="dot">.</span>work</a></p> |
| 136 |
<p class="item-footer-sub"> |
| 137 |
{% if is_owner %} |
| 138 |
<a href="/dashboard/item/{{ item.id }}">Edit</a> · |
| 139 |
{% endif %} |
| 140 |
<a href="/i/{{ item.id }}">Store page</a> · |
| 141 |
<a href="/library">Your library</a> |
| 142 |
</p> |
| 143 |
</footer> |
| 144 |
</div> |
| 145 |
{% endblock %} |
| 146 |
|
| 147 |
{% block scripts %} |
| 148 |
<script> |
| 149 |
function switchSectionTab(btn, panelId) { |
| 150 |
document.querySelectorAll('.section-tab').forEach(function(t) { t.classList.remove('is-selected'); }); |
| 151 |
document.querySelectorAll('.section-panel').forEach(function(p) { p.classList.remove('active'); }); |
| 152 |
btn.classList.add('is-selected'); |
| 153 |
var panel = document.getElementById(panelId); |
| 154 |
if (panel) panel.classList.add('active'); |
| 155 |
history.replaceState(null, '', '#' + panelId); |
| 156 |
} |
| 157 |
|
| 158 |
(function() { |
| 159 |
var hash = window.location.hash.replace('#', ''); |
| 160 |
if (hash) { |
| 161 |
var panel = document.getElementById(hash); |
| 162 |
var tab = document.querySelector('[data-tab="' + hash + '"]'); |
| 163 |
if (panel && tab) switchSectionTab(tab, hash); |
| 164 |
} |
| 165 |
})(); |
| 166 |
|
| 167 |
function downloadVersion(versionId) { |
| 168 |
fetch('/api/versions/' + versionId + '/download') |
| 169 |
.then(function(res) { |
| 170 |
if (!res.ok) throw new Error('Failed to get download URL'); |
| 171 |
return res.json(); |
| 172 |
}) |
| 173 |
.then(function(data) { |
| 174 |
window.location.href = data.download_url; |
| 175 |
}) |
| 176 |
.catch(function(err) { |
| 177 |
showToast(err.message || 'Download failed'); |
| 178 |
}); |
| 179 |
} |
| 180 |
</script> |
| 181 |
{% endblock %} |
| 182 |
|