Add support of menu
This commit is contained in:
parent
aef17acbce
commit
17c0fdbaab
@ -11,7 +11,7 @@ from jinja2 import Environment, FileSystemLoader
|
|||||||
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")]))
|
templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")]))
|
||||||
index_template = templates.get_template("index.html")
|
index_template = templates.get_template("index.html")
|
||||||
gallery_index_template = templates.get_template("gallery-index.html")
|
gallery_index_template = templates.get_template("gallery-index.html")
|
||||||
|
menu_template = templates.get_template("menu.html")
|
||||||
|
|
||||||
class Cache(object):
|
class Cache(object):
|
||||||
cache_file_path = os.path.join(os.getcwd(), ".prosopopee_cache")
|
cache_file_path = os.path.join(os.getcwd(), ".prosopopee_cache")
|
||||||
@ -147,6 +147,11 @@ def main():
|
|||||||
|
|
||||||
front_page_galleries_cover = reversed(sorted(front_page_galleries_cover, key=lambda x: x["date"]))
|
front_page_galleries_cover = reversed(sorted(front_page_galleries_cover, key=lambda x: x["date"]))
|
||||||
|
|
||||||
|
if settings.get('menu'):
|
||||||
|
for item in settings["menu"]:
|
||||||
|
item_file = item.replace(" ", "_").lower()
|
||||||
|
open(os.path.join("build", item_file+".html"), "w").write(menu_template.render(settings=yaml.safe_load(open(item_file+".yaml", "r")), galleries=front_page_galleries_cover, helpers=TemplateFunctions(os.getcwd(), os.path.join(os.getcwd(), "build"), has_gm=has_gm)).encode("Utf-8"))
|
||||||
|
|
||||||
open(os.path.join("build", "index.html"), "w").write(index_template.render(settings=settings, galleries=front_page_galleries_cover, helpers=TemplateFunctions(os.getcwd(), os.path.join(os.getcwd(), "build"), has_gm=has_gm)).encode("Utf-8"))
|
open(os.path.join("build", "index.html"), "w").write(index_template.render(settings=settings, galleries=front_page_galleries_cover, helpers=TemplateFunctions(os.getcwd(), os.path.join(os.getcwd(), "build"), has_gm=has_gm)).encode("Utf-8"))
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,10 @@ body {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
.galleries-grid {
|
.galleries-grid {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -95,6 +99,10 @@ body {
|
|||||||
margin-bottom: 6.5em;
|
margin-bottom: 6.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.static-header {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
#logo {
|
#logo {
|
||||||
width: 10%;
|
width: 10%;
|
||||||
}
|
}
|
||||||
@ -167,3 +175,61 @@ footer a {
|
|||||||
font-family: 'montserrat', sans-serif;
|
font-family: 'montserrat', sans-serif;
|
||||||
color: #111;
|
color: #111;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
background-color: #FBFBFB;
|
||||||
|
width: 100%;
|
||||||
|
height: 56px;
|
||||||
|
line-height: 56px;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav .nav-wrapper {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0px auto;
|
||||||
|
max-width: 1280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav ul {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav ul li {
|
||||||
|
padding: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav a.first-item-menu {
|
||||||
|
margin-left: -42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav ul li.active {
|
||||||
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
nav ul a {
|
||||||
|
transition: background-color .3s;
|
||||||
|
font-size: 1rem;
|
||||||
|
display: block;
|
||||||
|
padding: 0 15px;
|
||||||
|
cursor: pointer;
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin: 0px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #424242;
|
||||||
|
font-style: normal !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center, .center-align {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav ul li > a.item-menu::before {
|
||||||
|
content: "/";
|
||||||
|
margin-right: 22px;
|
||||||
|
font-size: 18px;
|
||||||
|
line-height: 1;
|
||||||
|
color: #ebebeb;
|
||||||
|
}
|
||||||
|
@ -15,10 +15,26 @@
|
|||||||
<div class="gallery-header">
|
<div class="gallery-header">
|
||||||
<img id="logo" src="static/img/logo.svg" />
|
<img id="logo" src="static/img/logo.svg" />
|
||||||
<h1>{{ settings.title }}</h1>
|
<h1>{{ settings.title }}</h1>
|
||||||
{% if settings.sub_title %}<h4>{{ settings.sub_title }}</h4>{% endif %}
|
{% if settings.sub_title -%}<h4>{{ settings.sub_title }}</h4>{% endif -%}
|
||||||
<hr>
|
<hr>
|
||||||
|
{% if settings.menu -%}
|
||||||
|
<nav>
|
||||||
|
<div class="nav-wrapper">
|
||||||
|
<ul>
|
||||||
|
{% for line in settings.menu -%}
|
||||||
|
{% if loop.first -%}
|
||||||
|
<li><a href={{ line.lower().replace(" ", "_") }}.html class=first-item-menu>{{ line }}</a></li>
|
||||||
|
{% else -%}
|
||||||
|
<li><a href={{ line.lower().replace(" ", "_") }}.html class=item-menu>{{ line }}</a></li>
|
||||||
|
{% endif -%}
|
||||||
|
{% endfor -%}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
{% endif -%}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="galleries-grid">
|
<div class="galleries-grid">
|
||||||
{% for galleries_line in galleries|reverse|batch(3)|reverse %}
|
{% for galleries_line in galleries|reverse|batch(3)|reverse %}
|
||||||
<div class="galleries-line covers-{{ galleries_line|length }}">
|
<div class="galleries-line covers-{{ galleries_line|length }}">
|
||||||
|
60
prosopopee/templates/menu.html
Normal file
60
prosopopee/templates/menu.html
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<!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"/>
|
||||||
|
<link type="text/css" rel="stylesheet" href="static/css/style-page.css" media="screen,projection"/>
|
||||||
|
|
||||||
|
<!--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 static-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 -%}
|
||||||
|
<nav>
|
||||||
|
<div class="nav-wrapper">
|
||||||
|
<ul>
|
||||||
|
{% for line in settings.menu -%}
|
||||||
|
{% if loop.first -%}
|
||||||
|
<li><a href=# class=first-item-menu>{{ line }}</a></li>
|
||||||
|
{% else -%}
|
||||||
|
<li><a href=# class=item-menu>{{ line }}</a></li>
|
||||||
|
{% endif -%}
|
||||||
|
{% endfor -%}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
{% endif -%}
|
||||||
|
</div>
|
||||||
|
<section class="text">
|
||||||
|
<h2>{{ settings.menu_title }}</h2>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
{% for section in settings.sections %}
|
||||||
|
{% include "sections/" + section.type + ".html" %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<div class="back-to-home">
|
||||||
|
<hr>
|
||||||
|
<a href="./index.html">
|
||||||
|
<div id="logo" src="static/img/logo.svg"/>
|
||||||
|
HOME
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="static/js/jquery-2.1.4.min.js" charset="utf-8"></script>
|
||||||
|
|
||||||
|
<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>
|
Loading…
x
Reference in New Issue
Block a user