Skip to content

Commit

Permalink
Auto-Format Templates
Browse files Browse the repository at this point in the history
  • Loading branch information
lordiii committed Mar 27, 2024
1 parent 84cfade commit 24a18d7
Show file tree
Hide file tree
Showing 18 changed files with 573 additions and 553 deletions.
8 changes: 4 additions & 4 deletions templates/404.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% extends "base.html" %}

{% block content %}
<h1>404 - {{trans(key="not_found", lang="de")}}</h1>
<p class="fs-4">{{trans(key="not_found_content", lang="de")}}</p>
<h1 class="mt-5">404 - {{trans(key="not_found", lang="en")}}</h1>
<p class="fs-4">{{trans(key="not_found_content", lang="en")}}</p>
<h1>404 - {{ trans(key="not_found", lang="de") }}</h1>
<p class="fs-4">{{ trans(key="not_found_content", lang="de") }}</p>
<h1 class="mt-5">404 - {{ trans(key="not_found", lang="en") }}</h1>
<p class="fs-4">{{ trans(key="not_found_content", lang="en") }}</p>
{% endblock content %}
153 changes: 77 additions & 76 deletions templates/album/album-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,89 +2,90 @@
{% import "macros.html" as macros %}

{% block main %}
<h4>
{{ section.title }}
</h4>
<h4>
{{ section.title }}
</h4>

<div class="image-gallery">
{% for subsection in section.subsections | reverse %}
{% set subsection_data = get_section(path=subsection) %}
<div class="image-gallery">
{% for subsection in section.subsections | reverse %}
{% set subsection_data = get_section(path=subsection) %}

{% if subsection_data.pages | length > 0 %}

{% if subsection_data.extra.cover %}
{% set image_uri = subsection_data.extra.cover %}
{% set height = 200 %}
{% set width = 750 %}
{% else %}
{% set latest_page = subsection_data.pages | first %}
{% if subsection_data.pages | length > 0 %}

{% set scaling = 200 / latest_page.extra.height %}
{% set height = 200 %}
{% set width = latest_page.extra.width * scaling %}
{% if subsection_data.extra.cover %}
{% set image_uri = subsection_data.extra.cover %}
{% set height = 200 %}
{% set width = 750 %}
{% else %}
{% set latest_page = subsection_data.pages | first %}

{% if width > 1150 %}
{% set image_uri = latest_page.extra.file_uri %}
{% elif width > 700 %}
{% set image_uri = latest_page.extra.file_uri_1200 %}
{% elif width > 250 %}
{% set image_uri = latest_page.extra.file_uri_750 %}
{% else %}
{% set image_uri = latest_page.extra.file_uri_300 %}
{% endif %}
{% endif %}

{% if subsection_data.extra.image_count %}
{% set image_count = subsection_data.extra.image_count %}
{% else %}
{% set image_count = subsection_data.pages | length %}
{% endif %}

<a href="{{subsection_data.path}}"
class="text-decoration-none rounded-1 p-0 overflow-hidden border border-1"
style="height: {{height}}px; width: {{width}}px;">
<img alt=""
loading="lazy"
class="p-0 m-0"
decoding="async"
src="{{ image_uri }}"/>
<div class="float-start m-0 py-1 px-2 d-inline-flex flex-column position-relative"
style="background-color: rgba(var(--bs-secondary-bg-rgb), 0.75); top: -50%; left: 50%; z-index: 100; transform: translateX(-50%) translateY(-50%);">
<h3 class="p-0 m-0 text-white border-0"><span class="mx-auto">{{ subsection_data.extra.display_name }}</span></h3>
<span class="text-white">{{ subsection_data.pages | length }} {{ trans(key="images", lang=lang) }}</span>
</div>
</a>
{% else %}
<p>HIER MÜSSTE EIN LEERES ALBUM SEIN. <i>TODO</i></p>
{% endif %}
{% endfor %}

{% set scaling = 200 / latest_page.extra.height %}
{% set height = 200 %}
{% set width = latest_page.extra.width * scaling %}

{% for page in section.pages %}
{% if width > 1150 %}
{% set image_uri = latest_page.extra.file_uri %}
{% elif width > 700 %}
{% set image_uri = latest_page.extra.file_uri_1200 %}
{% elif width > 250 %}
{% set image_uri = latest_page.extra.file_uri_750 %}
{% else %}
{% set image_uri = latest_page.extra.file_uri_300 %}
{% endif %}
{% endif %}

{% set scaling = 200 / page.extra.height %}
{% set height = 200 %}
{% set width = page.extra.width * scaling %}

{% if width > 1150 %}
{% set image_uri = page.extra.file_uri %}
{% elif width > 700 %}
{% set image_uri = page.extra.file_uri_1200 %}
{% elif width > 250 %}
{% set image_uri = page.extra.file_uri_750 %}
{% else %}
{% set image_uri = page.extra.file_uri_300 %}
{% endif %}
{% if subsection_data.extra.image_count %}
{% set image_count = subsection_data.extra.image_count %}
{% else %}
{% set image_count = subsection_data.pages | length %}
{% endif %}

<a href="{{ page.path }}" style="height: {{height}}px; width: {{width}}px;">
<img alt=""
loading="lazy"
class="p-0"
decoding="async"
src="{{ image_uri }}"/>
</a>
<a href="{{ subsection_data.path }}"
class="text-decoration-none rounded-1 p-0 overflow-hidden border border-1"
style="height: {{ height }}px; width: {{ width }}px;">
<img alt=""
loading="lazy"
class="p-0 m-0"
decoding="async"
src="{{ image_uri }}"/>
<div class="float-start m-0 py-1 px-2 d-inline-flex flex-column position-relative"
style="background-color: rgba(var(--bs-secondary-bg-rgb), 0.75); top: -50%; left: 50%; z-index: 100; transform: translateX(-50%) translateY(-50%);">
<h3 class="p-0 m-0 text-white border-0"><span
class="mx-auto">{{ subsection_data.extra.display_name }}</span></h3>
<span class="text-white">{{ subsection_data.pages | length }} {{ trans(key="images", lang=lang) }}</span>
</div>
</a>
{% else %}
<p>HIER MÜSSTE EIN LEERES ALBUM SEIN. <i>TODO</i></p>
{% endif %}
{% endfor %}

{% endfor %}
</div>

{% for page in section.pages %}

{% set scaling = 200 / page.extra.height %}
{% set height = 200 %}
{% set width = page.extra.width * scaling %}

{% if width > 1150 %}
{% set image_uri = page.extra.file_uri %}
{% elif width > 700 %}
{% set image_uri = page.extra.file_uri_1200 %}
{% elif width > 250 %}
{% set image_uri = page.extra.file_uri_750 %}
{% else %}
{% set image_uri = page.extra.file_uri_300 %}
{% endif %}

<a href="{{ page.path }}" style="height: {{ height }}px; width: {{ width }}px;">
<img alt=""
loading="lazy"
class="p-0"
decoding="async"
src="{{ image_uri }}"/>
</a>

{% endfor %}
</div>

{% endblock content %}
88 changes: 46 additions & 42 deletions templates/album/album-single.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,57 @@

{% block extra_meta %}

<meta property="og:type" content="article"/>
{{ macros::ifs_metadata(image_filename=page.extra.file_uri, width=page.extra.width, title=page.title, height=page.extra.height) }}
<meta property="og:type" content="article"/>
{{ self::ifs_metadata(image_filename=page.extra.file_uri, width=page.extra.width, title=page.title, height=page.extra.height) }}

{% endblock extra_meta %}

{% block content %}

<h4 class="d-flex justify-content-between">
{{ page.title }}
<a class="btn btn-secondary btn-sm" href="{{ page.path }}..">
<h4 class="d-flex justify-content-between">
{{ page.title }}
<!--{# TODO: BETTER BUTTON PLACEMENT #}-->
<!--{# TODO: TOTAL AMOUNT #}-->
</a>
</h4>

<div class="d-flex justify-content-around">

{% if page.lower %}
<a class="btn btn-sm my-auto btn-secondary h-100" href="{{ page.lower.path }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-bar-left" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M12.5 15a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5M10 8a.5.5 0 0 1-.5.5H3.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L3.707 7.5H9.5a.5.5 0 0 1 .5.5"/>
</svg>
</a>
{% endif %}

<a target="_blank"
href="{{ page.extra.file_uri }}">
<img alt=""
class="mx-auto"
style="width: 750px;"
loading="lazy"
decoding="async"
src="{{ page.extra.file_uri_1200 }}"
/>
</a>

{% if page.higher %}
<a class="btn btn-sm my-auto btn-secondary h-100" href="{{ page.higher.path }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-bar-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M6 8a.5.5 0 0 0 .5.5h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L12.293 7.5H6.5A.5.5 0 0 0 6 8m-2.5 7a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5"/>
</svg>
</a>
{% endif %}

</div>

{{ page.content | safe }}
<a class="btn btn-secondary btn-sm" href="{{ page.path }}..">
{{ page.title }}
<!--{# TODO: BETTER BUTTON PLACEMENT #}-->
<!--{# TODO: TOTAL AMOUNT #}-->
</a>
</h4>

<div class="d-flex justify-content-around">

{% if page.lower %}
<a class="btn btn-sm my-auto btn-secondary h-100" href="{{ page.lower.path }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-arrow-bar-left" viewBox="0 0 16 16">
<path fill-rule="evenodd"
d="M12.5 15a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5M10 8a.5.5 0 0 1-.5.5H3.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L3.707 7.5H9.5a.5.5 0 0 1 .5.5"></path>
</svg>
</a>
{% endif %}

<a target="_blank"
href="{{ page.extra.file_uri }}">
<img alt=""
class="mx-auto"
style="width: 750px;"
loading="lazy"
decoding="async"
src="{{ page.extra.file_uri_1200 }}"
/>
</a>

{% if page.higher %}
<a class="btn btn-sm my-auto btn-secondary h-100" href="{{ page.higher.path }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-arrow-bar-right" viewBox="0 0 16 16">
<path fill-rule="evenodd"
d="M6 8a.5.5 0 0 0 .5.5h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L12.293 7.5H6.5A.5.5 0 0 0 6 8m-2.5 7a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5"></path>
</svg>
</a>
{% endif %}

</div>

{{ page.content | safe }}

{% endblock content %}
60 changes: 30 additions & 30 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
{% if lang == config.default_language %}
{% set lang_stub = "" %}
{% set lang_stub = "" %}
{% else %}
{% set lang_stub = "." ~ lang %}
{% set lang_stub = "." ~ lang %}
{% endif %}

<!DOCTYPE html>
<html lang="{{lang}}" prefix="og: https://ogp.me/ns#" data-bs-theme="light">
<html lang="{{ lang }}" prefix="og: https://ogp.me/ns#" data-bs-theme="light">
<head>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:site_name" content="{{ config.title }}"/>
<meta property="og:locale" content='{{ trans(key="locale_name", lang=lang) }}'/>
<meta property="og:locale:alternate" content='{{ trans(key="locale_name", lang="de") }}'/>
<meta property="og:locale:alternate" content='{{trans(key="locale_name", lang="en") }}'/>
<meta property="og:locale:alternate" content='{{ trans(key="locale_name", lang="en") }}'/>
{% if current_path %}
<meta property="og:url" content="https://mainframe.io{{ current_path }}"/>
<meta property="og:url" content="https://mainframe.io{{ current_path }}"/>
{% endif %}

{% if page.authors %}
{% set page_author = page.authors | join(sep=", ") %}
{% set page_author = page.authors | join(sep=", ") %}
{% else %}
{% set page_author = config.author %}
{% set page_author = config.author %}
{% endif %}

<meta name="author" content="{{ page_author }}">

{% block extra_meta %}
<meta property="og:type" content="website"/>
<meta property="og:type" content="website"/>
{% endblock extra_meta %}

{% if section.title %}

{% set title = section.extra.og_title | default(value=section.title ~ " | " ~ config.title) %}
{% set description = section.extra.og_description | default(value=config.description) %}
{% set title = section.extra.og_title | default(value=section.title ~ " | " ~ config.title) %}
{% set description = section.extra.og_description | default(value=config.description) %}

{% elif page.title %}

{% set title = page.extra.og_title | default(value=page.title ~ " | " ~ config.title) %}
{% set description = page.extra.og_description | default(value=config.description) %}
{% set title = page.extra.og_title | default(value=page.title ~ " | " ~ config.title) %}
{% set description = page.extra.og_description | default(value=config.description) %}

{% else %}

{% set title = config.title %}
{% set description = config.description %}
{% set title = config.title %}
{% set description = config.description %}

{% endif %}

Expand Down Expand Up @@ -73,22 +73,22 @@
{% include "navbar.html" %}

{% block main %}
<main id="content" class="row">
<div class="col-md-9 main-content">
{% block content %}
{% if page.content %}
{{ page.content | safe }}
{% elif section.content %}
{{ section.content | safe }}
{% endif %}
{% endblock content %}
</div>
<div class="col-md-3">
{% block sidebar %}
{% include "sidebar.html" %}
{% endblock sidebar %}
</div>
</main>
<main id="content" class="row">
<div class="col-md-9 main-content">
{% block content %}
{% if page.content %}
{{ page.content | safe }}
{% elif section.content %}
{{ section.content | safe }}
{% endif %}
{% endblock content %}
</div>
<div class="col-md-3">
{% block sidebar %}
{% include "sidebar.html" %}
{% endblock sidebar %}
</div>
</main>
{% endblock main %}

<footer id="footer" class="border-top pt-2 mt-5 row">
Expand Down
Loading

0 comments on commit 24a18d7

Please sign in to comment.