[enh] move to template inheritance to avoid redudency

This commit is contained in:
Laurent Peuch 2016-02-09 22:03:18 +01:00
parent ef55e9baf2
commit 64c96f5122
3 changed files with 76 additions and 90 deletions

View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="static/css/fonts.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="static/css/style.css" media="screen,projection"/>
{% block css %}
{% endblock %}
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{{ settings.title }}</title>
</head>
<body>
<div class="gallery-header">
<img id="logo" src="static/img/logo.svg" />
<h1>{{ settings.title }}</h1>
{% if settings.sub_title -%}<h4>{{ settings.sub_title }}</h4>{% endif -%}
<hr>
{% if settings.menu -%}
{% include 'menu.html' %}
{% endif -%}
</div>
{% block content %}
{% endblock %}
<footer>
<p>Generated using <a href="https://github.com/psycojoker/prosopopee">Prosopopée</a> · content under <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a> · atom logo by <a href="https://thenounproject.com/jjjon/">Jonathan Li</a> under <a href="https://creativecommons.org/licenses/by/3.0/">CC-BY</a></p>
</footer>
</body>
</html>

View File

@ -1,53 +1,26 @@
<!DOCTYPE html> {% extends "base.html" %}
<html>
<head>
<meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="static/css/fonts.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="static/css/style.css" media="screen,projection"/>
<!--Let browser know website is optimized for mobile--> {% block content %}
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <div class="galleries-grid">
<title>{{ settings.title }}</title> {% for galleries_line in galleries|reverse|batch(3)|reverse %}
</head> <div class="galleries-line covers-{{ galleries_line|length }}">
{% for gallery in galleries_line|reverse %}<!-- comment tricks against space between inline-block
<body> --><div class="gallery-square">
<a href="{{ gallery.link }}">
<div class="gallery-header"> <div class="gallery-title">
<img id="logo" src="static/img/logo.svg" /> <h2>{{ gallery.title }}</h2>
<h1>{{ settings.title }}</h1> {% if gallery.sub_title %}<h3>{{ gallery.sub_title }}</h3>{% endif %}
{% if settings.sub_title -%}<h4>{{ settings.sub_title }}</h4>{% endif -%} {% if gallery.date %}<div class="gallery-datetime">{{ gallery.date.strftime("%d %B %Y") }}</div>{% endif %}
<hr> </div>
{% if settings.menu -%} </a>
{% include 'menu.html' %} {% set cover = Image(gallery.cover) %}
{% endif -%} {{ cover.copy() }}
<div class="gallery-cover" style="background-image: url('{{ cover.generate_thumbnail("x900") }}');"></div>
</div><!-- comment tricks against space between inline-block
-->{% endfor %}
</div> </div>
{% endfor %}
</div>
<p style="visibility: hidden">.</p>
<div class="galleries-grid"> {% endblock %}
{% for galleries_line in galleries|reverse|batch(3)|reverse %}
<div class="galleries-line covers-{{ galleries_line|length }}">
{% for gallery in galleries_line|reverse %}<!-- comment tricks against space between inline-block
--><div class="gallery-square">
<a href="{{ gallery.link }}">
<div class="gallery-title">
<h2>{{ gallery.title }}</h2>
{% if gallery.sub_title %}<h3>{{ gallery.sub_title }}</h3>{% endif %}
{% if gallery.date %}<div class="gallery-datetime">{{ gallery.date.strftime("%d %B %Y") }}</div>{% endif %}
</div>
</a>
{% set cover = Image(gallery.cover) %}
{{ cover.copy() }}
<div class="gallery-cover" style="background-image: url('{{ cover.generate_thumbnail("x900") }}');"></div>
</div><!-- comment tricks against space between inline-block
-->{% endfor %}
</div>
{% endfor %}
</div>
<p style="visibility: hidden">.</p>
<footer>
<p>Generated using <a href="https://github.com/psycojoker/prosopopee">Prosopopée</a> · content under <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a> · atom logo by <a href="https://thenounproject.com/jjjon/">Jonathan Li</a> under <a href="https://creativecommons.org/licenses/by/3.0/">CC-BY</a></p>
</footer>
</body>
</html>

View File

@ -1,48 +1,26 @@
<!DOCTYPE html> {% extends "base.html" %}
<html>
<head>
<meta charset="UTF-8">
<link type="text/css" rel="stylesheet" href="static/css/fonts.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="static/css/style.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="static/css/style-page.css" media="screen,projection"/>
<!--Let browser know website is optimized for mobile--> {% block css %}
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <link type="text/css" rel="stylesheet" href="static/css/style-page.css" media="screen,projection"/>
<title>{{ settings.title }}</title> {% endblock %}
</head>
<body> {% block content %}
<section class="text">
<div class="gallery-header static-header"> <h2>{{ pages.title }}</h2>
<img id="logo" src="static/img/logo.svg" /> </section>
<h1>{{ settings.title }}</h1>
{% if settings.sub_title -%}<h4>{{ settings.sub_title }}</h4>{% endif -%}
<hr>
{% if settings.menu -%}
{% include 'menu.html' %}
{% endif -%}
</div>
<section class="text">
<h2>{{ pages.title }}</h2>
</section>
{% for section in pages.sections %} {% for section in pages.sections %}
{% include "sections/" + section.type + ".html" %} {% include "sections/" + section.type + ".html" %}
{% endfor %} {% endfor %}
<div class="back-to-home"> <div class="back-to-home">
<hr> <hr>
<a href="./index.html"> <a href="./index.html">
<div id="logo" src="static/img/logo.svg"/> <div id="logo" src="static/img/logo.svg"/>
HOME HOME
</div> </div>
</a> </a>
</div> </div>
<script type="text/javascript" src="static/js/jquery-2.1.4.min.js" charset="utf-8"></script>
<footer> <script type="text/javascript" src="static/js/jquery-2.1.4.min.js" charset="utf-8"></script>
<p>Generated using <a href="https://github.com/psycojoker/prosopopee">Prosopopée</a> · content under <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a> · atom logo by <a href="https://thenounproject.com/jjjon/">Jonathan Li</a> under <a href="https://creativecommons.org/licenses/by/3.0/">CC-BY</a></p> {% endblock %}
</footer>
</body>
</html>