filesafe/views/album.njk
Bobby Wibowo 9e9b0d4439
Updated
Updated some dev dependencies.

---

Gulp will now build CSS/JS files during development into dist-dev
directory, to prevent IDE's Git from unnecessarily building diff's.

Added dist-dev to ignore files.

---

The entire config fille will now be passed to Nunjuck templates for ease
of access of config values.

Root domain for use in Nunjuck templates will now be parsed from config.

Better page titles.

Updated help message for "Uploads history order" option in
homepage's config tab.

Added "Load images for preview" option to homepage's config tab.
Setting this to false will now prevent image uploads from loading
themselves for previews.

Uploads' original names in homepage's uploads history are now
selectable.

Min/max length for user/pass are now enforced in auth's front-end.

Improved performance of album public pages.
Their generated HTML pages will now be cached into memory.
Unfortunately, No-JS version of their pages will be cached separately,
so each album may take up to double the memory space.

File names in thumbnails no longer have their full URLs as tooltips.
I saw no point in that behavior.

Added video icons.
Homepage's uploads history will now display video icons for videos.

"View thumbnail" button in Dashboard is now renamed to "Show preview".
Their icons will also be changed depending on their file types.

Added max length for albums' title & description.
These will be enforced both in front-end and back-end.
Existing albums that have surpassed the limits will not be enforced.

A few other small improvements.
2019-09-17 11:13:41 +07:00

140 lines
5.0 KiB
Plaintext

{% set title = album.name %}
{% extends "_layout.njk" %}
{% set fileRoot = config.domain %}
{% set generateZips = config.uploads.generateZips %}
{% set usingCdn = config.cloudflare and config.cloudflare.purgeCache %}
{% block stylesheets %}
<!-- Stylesheets -->
<link rel="stylesheet" href="../libs/bulma/bulma.min.css?v={{ globals.v3 }}">
<link rel="stylesheet" href="../css/style.css?v={{ globals.v1 }}">
<link rel="stylesheet" href="../css/thumbs.css?v={{ globals.v1 }}">
<link rel="stylesheet" href="../css/album.css?v={{ globals.v1 }}">
{% endblock %}
{% block scripts %}
{% if not nojs -%}
<!-- Scripts -->
<script src="../libs/lazyload/lazyload.min.js?v={{ globals.v3 }}"></script>
<script src="../js/album.js?v={{ globals.v1 }}"></script>
<script src="../js/misc/utils.js?v={{ globals.v1 }}"></script>
{% endif %}
{% endblock %}
{% block opengraph %}
<!-- Open Graph tags -->
<meta property="og:type" content="website" />
<meta property="og:title" content="{{ album.name | safe }} &#8211; {{ files.length }} files" />
<meta property="og:url" content="{{ root }}/{{ album.url }}" />
<meta property="og:description" content="{{ album.description }}" />
<meta property="og:image" content="{{ fileRoot }}/{{ album.thumb }}" />
<meta property="og:locale" content="en_US" />
<!-- Twitter Card tags -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="{{ album.name | safe }} &#8211; {{ files.length }} files">
<meta name="twitter:description" content="{{ album.description }}">
<meta name="twitter:image" content="{{ fileRoot }}/{{ album.thumb }}">
{% endblock %}
{% block content %}
{{ super() }}
<section class="section">
<div class="container">
<nav class="level">
<div class="level-left">
<div class="level-item">
<h1 id="title" class="title">
{{ album.name | safe }}
</h1>
</div>
<div class="level-item">
<h1 id="count" class="subtitle">
{{ files.length }} files (<span class="file-size">{{ album.totalSize }} B</span>)
</h1>
</div>
</div>
{% if generateZips -%}
<div class="level-right">
<p class="level-item">
{% if not files.length -%}
<a class="button is-primary is-outlined" title="There are no files in the album" disabled>Download album</a>
{%- elif album.downloadLink -%}
{%- if usingCDN -%}
<a class="button is-primary is-outlined" title="Be aware that album archive may be cached by CDN" href="../{{ album.downloadLink }}">Download album</a>
{%- else -%}
<a class="button is-primary is-outlined" href="../{{ album.downloadLink }}">Download album</a>
{%- endif -%}
{%- else -%}
<a class="button is-primary is-outlined" title="The album's owner has chosen to disable download" disabled>Download disabled</a>
{%- endif %}
</p>
</div>
{%- endif %}
</nav>
{% if album.description -%}
<h2 class="subtitle description">
{{ album.description | safe }}
</h2>
{%- endif %}
<hr>
{% if nojs -%}
<article class="message">
<div class="message-body">
<p>You are viewing No-JS version of this album, so file size will be displayed in bytes.</p>
<p>Please <a href="../{{ album.url }}">click here</a> if you want to view its regular version.</p>
</div>
</article>
{%- endif %}
{% if files.length -%}
<div id="table" class="columns is-multiline is-mobile is-centered has-text-centered">
{% for file in files %}
<div class="image-container column">
<a class="image" href="{{ fileRoot }}/{{ file.name }}" target="_blank" rel="noopener">
{% if file.thumb -%}
{% if nojs -%}
<img alt="{{ file.name }}" src="{{ fileRoot }}/{{ file.thumb }}" width="200" height="200" loading="lazy">
{%- else -%}
<img alt="{{ file.name }}" data-src="{{ fileRoot }}/{{ file.thumb }}">
{%- endif %}
{%- else -%}
<h1 class="title">{{ file.extname | default('N/A') }}</h1>
{%- endif %}
</a>
<div class="details">
<p><span class="name">{{ file.name }}</span></p>
<p class="file-size">{{ file.size }} B</p>
</div>
</div>
{% endfor %}
</div>
{%- else -%}
<article class="message">
<div class="message-body">
There are no files in the album.
</div>
</article>
{%- endif %}
</div>
</section>
{% if not nojs -%}
<noscript>
<style>body > section:not(#noscript) { display: none !important; }</style>
<section id="noscript" class="hero is-fullheight">
<div class="hero-body">
<div class="container has-text-centered">
<p>You have JavaScript disabled, but this page requires JavaScript to function.</p>
<p>Please <a href="../{{ album.url }}?nojs">click here</a> if you want to view its No-JS version.</p>
</div>
</div>
</section>
</noscript>
{%- endif %}
{% endblock %}