refactor: ♻️ clean up unused Twig templates
This commit is contained in:
parent
d54d3077cb
commit
a7a7c738ec
12 changed files with 253 additions and 98 deletions
|
@ -68,33 +68,23 @@ if($SURI == '/') {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
echo $twig->render('directory.html', [
|
||||
echo $twig->render('post_types/directory.html', [
|
||||
"post" => $post,
|
||||
"subposts" => $post['subposts']
|
||||
]);
|
||||
}
|
||||
elseif($post['post_metadata']['type'] == 'text/markdown') {
|
||||
echo $twig->render('about.html', [
|
||||
echo $twig->render('post_types/markdown.html', [
|
||||
"post" => $post,
|
||||
"subposts" => $post['subposts']
|
||||
]);
|
||||
}
|
||||
elseif($post['post_metadata']['type'] == 'file') {
|
||||
echo $twig->render('image.html', [
|
||||
echo $twig->render('post_types/image.html', [
|
||||
"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 {
|
||||
echo $twig->render('rrror.html',[
|
||||
"error_code" => '404 Hoard not found!',
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
|
@ -6,8 +7,17 @@
|
|||
}
|
||||
|
||||
body {
|
||||
color: #B0B0B0;
|
||||
background: #201c2a;
|
||||
--bg_1: #0e0a2a;
|
||||
--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;
|
||||
|
||||
position: relative;
|
||||
|
@ -17,17 +27,17 @@ body {
|
|||
}
|
||||
|
||||
:link {
|
||||
color: cyan;
|
||||
color: var(--highlight_1);
|
||||
font-style: italic;
|
||||
text-decoration: none;
|
||||
|
||||
transition: color 0.2s;
|
||||
}
|
||||
a:visited {
|
||||
color: cyan;
|
||||
color: var(--highlight_1);
|
||||
}
|
||||
a:hover {
|
||||
color: lightblue;
|
||||
color: var(--highlight_2);
|
||||
}
|
||||
|
||||
#main_header {
|
||||
|
@ -89,20 +99,62 @@ a:hover {
|
|||
}
|
||||
|
||||
#main_content_wrapper {
|
||||
padding: 3vmin 1em 1em 1em;
|
||||
padding: 0em 1em 1em 1em;
|
||||
width: auto;
|
||||
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-top: 0px;
|
||||
|
||||
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 {
|
||||
background: #3e3554;
|
||||
color: #c6c3c3;
|
||||
border-radius: 0.3em;
|
||||
background: var(--bg_3);
|
||||
|
||||
border-radius: 0em 0em 0.8em 0.8em;
|
||||
box-shadow: 3px 7px 7px 0px #00000040;
|
||||
|
||||
padding: 0.75em;
|
||||
|
@ -115,6 +167,17 @@ a:hover {
|
|||
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 {
|
||||
display: flex;
|
||||
|
||||
|
|
36
www/static/directorystyle.css
Normal file
36
www/static/directorystyle.css
Normal 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;
|
||||
}
|
|
@ -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%}
|
30
www/templates/fragments/filepath_bar.html
Normal file
30
www/templates/fragments/filepath_bar.html
Normal 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>
|
|
@ -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%}
|
|
@ -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>
|
18
www/templates/pathed_content.html
Normal file
18
www/templates/pathed_content.html
Normal 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%}
|
45
www/templates/post_types/directory.html
Normal file
45
www/templates/post_types/directory.html
Normal 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%}
|
41
www/templates/post_types/image.html
Normal file
41
www/templates/post_types/image.html
Normal 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%}
|
7
www/templates/post_types/markdown.html
Normal file
7
www/templates/post_types/markdown.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
|
||||
|
||||
{% extends "pathed_content.html" %}
|
||||
|
||||
{%block content_article%}
|
||||
{{ post['post_content']|markdown_to_html }}
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue