refactor: ♻️ clean up unused Twig templates

This commit is contained in:
David Bailey 2023-12-11 22:52:30 +01:00
parent d54d3077cb
commit a7a7c738ec
12 changed files with 253 additions and 98 deletions

View file

@ -68,33 +68,23 @@ if($SURI == '/') {
exit(0); exit(0);
} }
echo $twig->render('directory.html', [ echo $twig->render('post_types/directory.html', [
"post" => $post, "post" => $post,
"subposts" => $post['subposts'] "subposts" => $post['subposts']
]); ]);
} }
elseif($post['post_metadata']['type'] == 'text/markdown') { elseif($post['post_metadata']['type'] == 'text/markdown') {
echo $twig->render('about.html', [ echo $twig->render('post_types/markdown.html', [
"post" => $post, "post" => $post,
"subposts" => $post['subposts'] "subposts" => $post['subposts']
]); ]);
} }
elseif($post['post_metadata']['type'] == 'file') { elseif($post['post_metadata']['type'] == 'file') {
echo $twig->render('image.html', [ echo $twig->render('post_types/image.html', [
"post" => $post "post" => $post
]); ]);
} }
} elseif(preg_match('/^\/about(.html)?$/', $SURI)) {
echo $twig->render('about.html');
} elseif(preg_match('/^\/gallery\/([^\?]+)/', $SURI)) {
echo $twig->render('/gallery/gallery_entry.html', [
'image_url' => '/static/banner/0.png',
'image_title' => 'Test!',
'image_desc' => 'A soft piece made by a dear friend',
'artist_name' => 'Doggonaut',
'artist_src_link' => 'https://twitter.com/doggonaut'
]);
} else { } else {
echo $twig->render('rrror.html',[ echo $twig->render('rrror.html',[
"error_code" => '404 Hoard not found!', "error_code" => '404 Hoard not found!',

View file

@ -1,4 +1,5 @@
* { * {
box-sizing: border-box; box-sizing: border-box;
margin: 0; margin: 0;
@ -6,8 +7,17 @@
} }
body { body {
color: #B0B0B0; --bg_1: #0e0a2a;
background: #201c2a; --bg_2: #2c2943;
--bg_3: #3f4148;
--highlight_1: #ee9015;
--highlight_2: #edd29e;
--text_1: #FFFFFF;
color: var(--text_1);
background: var(--bg_1);
margin: 0px; margin: 0px;
position: relative; position: relative;
@ -17,17 +27,17 @@ body {
} }
:link { :link {
color: cyan; color: var(--highlight_1);
font-style: italic; font-style: italic;
text-decoration: none; text-decoration: none;
transition: color 0.2s; transition: color 0.2s;
} }
a:visited { a:visited {
color: cyan; color: var(--highlight_1);
} }
a:hover { a:hover {
color: lightblue; color: var(--highlight_2);
} }
#main_header { #main_header {
@ -89,20 +99,62 @@ a:hover {
} }
#main_content_wrapper { #main_content_wrapper {
padding: 3vmin 1em 1em 1em; padding: 0em 1em 1em 1em;
width: auto; width: auto;
margin-left: max(0.75em, min(max(20vmin, 50vw - 30rem), 50vw - 25rem)); margin-left: max(0.75em, min(max(20vmin, 50vw - 30rem), 50vw - 25rem));
margin-right: max(0.75em, min(max(20vmin, 50vw - 30rem), 50vw - 25rem)); margin-right: max(0.75em, min(max(20vmin, 50vw - 30rem), 50vw - 25rem));
margin-top: 0px;
min-height: 100%; min-height: 100%;
background: #3e355479; background: var(--bg_2);
}
#post_file_bar {
position: sticky;
top: 0px;
background: var(--bg_2);
}
#post_file_titles {
display: flex;
flex-direction: row;
justify-content: left;
list-style-type: none;
padding: 0px;
}
#post_file_titles * {
padding: 0.5em;
font-style: bold;
font-size: 1.3em;
background: var(--highlight_1);
}
#post_file_path {
width: 100%;
font-style: italic;
padding-left: 0.5em;
background: var(--highlight_1);
display: flex;
flex-direction: row;
list-style-type: none;
}
#post_file_path a {
color: var(--text_1);
padding-right: 0.2em;
} }
#main_content_wrapper article { #main_content_wrapper article {
background: #3e3554; background: var(--bg_3);
color: #c6c3c3;
border-radius: 0.3em; border-radius: 0em 0em 0.8em 0.8em;
box-shadow: 3px 7px 7px 0px #00000040; box-shadow: 3px 7px 7px 0px #00000040;
padding: 0.75em; padding: 0.75em;
@ -115,6 +167,17 @@ a:hover {
border-bottom: solid 1px darkgrey; border-bottom: solid 1px darkgrey;
} }
#main_content_wrapper article img {
display: block;
max-width: 100%;
max-height: 80vh;
margin: 1vmin;
margin-right: auto;
margin-left: auto;
}
#main_footer { #main_footer {
display: flex; display: flex;

View file

@ -0,0 +1,36 @@
table.directory {
width: 100%;
}
table.directory caption {
text-align: left;
font-size: 1.5em;
padding-left: 2em;
}
table.directory td {
padding: 0.2em;
text-align: left;
}
table.directory th {
padding: 0.2em;
text-align: left;
padding-bottom: 0.05em;
}
table.directory tr.entry:hover {
background: rgba(255, 255, 255, 0.1);
}
table.directory tr.entry .entry_title {
width: 100%;
}
table.directory .entry_update_time {
display: block;
width: 10em;
}

View file

@ -1,25 +0,0 @@
{% extends "root.html" %}
{% block second_title %}
<h2> {{ post.post_metadata.title }} </h2>
{% endblock %}
{%block main_content%}
<article>
{{ post['post_content']|markdown_to_html }}
</article>
{% if subposts|length > 0 %}
<article>
<h3>Related:</h3>
<ul>
{% for subpost in subposts %}
<li><a href={{subpost.post_path}}>{{ subpost.post_metadata.title }}</a></li>
{% endfor %}
</ul>
</article>
{%endif%}
{%endblock%}

View file

@ -0,0 +1,30 @@
<div id="post_file_bar">
<menu id="post_file_titles">
<li>
{{ post.post_metadata.title }}
</li>
</menu>
<menu id="post_file_path">
{% set split_post = post.post_path |split('/') %}
{% for i in range(0, split_post|length - 1) %}
<li>
{% if i != 0 %}
>
{% endif %}
{% if i != 0 %}
<a href="{{split_post|slice(0,i+1)|join('/')}}">
{{ split_post[i] }}
</a>
{% else %}
<a href="/">root</a>
{% endif %}
</li>
{% endfor %}
<li style="margin-left: auto;">
<a href="/raw{{post.post_path}}">raw</a>
<a href="/api/posts{{post.post_path}}">api</a>
</li>
</menu>
</div>

View file

@ -1,19 +0,0 @@
{% extends "root.html" %}
{% block second_title %}
<h2> Abouts </h2>
{% endblock %}
{%block main_content%}
<article>
{{ include('about.md')|markdown_to_html }}
</article>
<ul>
{% for subpost in subposts %}
<li> {{ subpost.title }} </li>
{% endfor %}
</ul>
{%endblock%}

View file

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Lucidragons' Fire</title>
<link rel="stylesheet" href="/dergstyle.css">
</head>
<body>
<h1 id="big_title">The dergsite</h1>
<div id="title_separator"></div>
<ul>
<li><a href="/about"> About </a></li>
<li><a href="/blog"> Blog </a></li>
<li><a href="/projects"> Projects </a></li>
<li><a href="/artwork"> Artworks </a></li>
</ul>
<div id="main_content_wrapper">
{% block content %}<h3>Soon there shall be content!</h3>{% endblock %}
</div>
<div id="sidebar-wrapper">
{%block sidebar %}
<ul>
<li> Test 1 </li>
</ul>
{% endblock %}
</div>
</body>
</html>

View file

@ -0,0 +1,18 @@
{% extends "root.html" %}
{% block second_title %}
<h2> {{ post.post_metadata.title }} </h2>
{% endblock %}
{%block main_content%}
{{ include('fragments/filepath_bar.html') }}
<article>
{%block content_article %}
{%endblock%}
</article>
{%endblock%}

View file

@ -0,0 +1,45 @@
{% extends "pathed_content.html" %}
{% block extra_head %}
<link rel="stylesheet" href="/static/directorystyle.css">
{%endblock%}
{%block content_article%}
{% if subposts|length > 0 %}
<table class="directory">
<caption>Directory contents:</caption>
<tr>
<th></th>
<th>Name</th>
<th>Title</th>
<th>Modified</th>
</tr>
{% for subpost in subposts %}
<tr class="entry">
<td>
ICN
</td>
<td>
<a href={{subpost.post_path}}>{{subpost.post_basename}}</a>
</td>
<td class="entry_title">
{{ subpost.post_metadata.title }}
</td>
<td class="entry_update_time">
{{ subpost.post_update_time }}
</td>
</tr>
{% endfor %}
</table>
{%else%}
<h4>This directory appears to be empty...</h4>
<span>This shouldn't happen, sorry!</span>
{% endif %}
{% if post.readme.found %}
{{ post.readme.post_content|markdown_to_html }}
{% endif %}
{%endblock%}

View file

@ -0,0 +1,41 @@
{% extends "root.html" %}
{% block extra_head %}
<link rel="stylesheet" href="/static/imagestyle.css">
{%endblock%}
{%block main_content%}
<div id="post_file_bar">
<menu id="post_file_titles">
<li>
{{ post.post_metadata.title }}
</li>
</menu>
<menu id="post_file_path">
{% set split_post = post.post_path |split('/') %}
{% for i in range(0, split_post|length - 1) %}
<li>
{% if i != 0 %}
>
{% endif %}
{% if i != 0 %}
<a href="{{split_post|slice(0,i+1)|join('/')}}">
{{ split_post[i] }}
</a>
{% else %}
<a href="/">root</a>
{% endif %}
</li>
{% endfor %}
</menu>
</div>
<article>
<a target="_blank" href="{{post['post_file_dir']}}">
<img id="gallery_image" src="{{post['post_file_dir']}}"></img>
</a>
</article>
{%endblock%}

View file

@ -0,0 +1,7 @@
{% extends "pathed_content.html" %}
{%block content_article%}
{{ post['post_content']|markdown_to_html }}
{% endblock %}