we've got a website, sorta!

This commit is contained in:
xenofem 2024-01-22 07:01:41 -05:00
parent 7680a174fc
commit 6c94a346c4
10 changed files with 314 additions and 3 deletions

15
templates/base.html Normal file
View file

@ -0,0 +1,15 @@
{% from 'utils.html' import root with context -%}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="dark">
<title>{% if title %}{{ title }} - {% else %}{% endif %}DLibrary</title>
<link rel="stylesheet" type="text/css" href="{{ root() }}static/dlibrary.css">
{% block head %}{% endblock %}
</head>
<body>
{% block body required %}{% endblock %}
</body>
</html>

20
templates/list.html Normal file
View file

@ -0,0 +1,20 @@
{% extends 'base.html' %}
{% block body %}
{% from 'utils.html' import root with context %}
<h1 id="list-title"><a href={{ root() }}>DLibrary</a> {% block list_title %}{% endblock %}</h1>
<div class="card-listing">
{% for work in works %}
<div class="card">
<a href="{{ root() }}works/{{ work['id'] }}/">
<img src="{{ root() }}thumbnails/{{ work['id'] }}.jpg">
<div class="card-authors">
[{% if work['circle'] %}{{ work['circle'] }}{% endif %}{% if work['circle'] and work['authors'] %} ({% endif %}{{ ', '.join(work['authors']) }}{% if work['circle'] and work['authors'] %}){% endif %}]
</div>
<div class="card-title">
{{ work['title'] }}
</div>
</a>
</div>
{% endfor %}
</div>
{% endblock %}

1
templates/utils.html Normal file
View file

@ -0,0 +1 @@
{% macro root() %}{% for i in range(depth) %}../{% endfor %}{% endmacro %}

21
templates/viewer.html Normal file
View file

@ -0,0 +1,21 @@
{% extends 'base.html' %}
{% from 'utils.html' import root with context %}
{% block head %}
<link rel="stylesheet" type="text/css" href="{{ root() }}static/viewer.css">
<script>
const WORK_ID = "{{ work['id'] }}";
const ROOT = "{{ root() }}";
</script>
<script src="{{ root() }}static/viewer.js"></script>
{% endblock %}
{% block body %}
<div id="viewer-images">
{% for filename in images %}
<img src="{{ root() }}images/{{ work['id'] }}/{{ filename }}" class="viewer-image">
{% endfor %}
</div>
<div id="progress"></div>
<div id="page-num"></div>
<div id="duration"></div>
<div id="image-container"></div>
{% endblock %}