Merge pull request #65 from titoko/master

Add a back button in subIndex
This commit is contained in:
Laurent Peuch 2016-11-02 19:44:36 +01:00 committed by GitHub
commit 4f4da7c3b0
5 changed files with 103 additions and 5 deletions

View File

@ -308,7 +308,7 @@ def process_directory(gallery_name, settings, parent_templates, parent_gallery_p
process_directory(subgallery.name, settings, subgallery_templates, gallery_path) process_directory(subgallery.name, settings, subgallery_templates, gallery_path)
) )
build_index(settings, sub_page_galleries_cover, subgallery_templates, gallery_path) build_index(settings, sub_page_galleries_cover, subgallery_templates, gallery_path, sub_index=True)
gallery_cover['sub_gallery'] = sub_page_galleries_cover gallery_cover['sub_gallery'] = sub_page_galleries_cover
return gallery_cover return gallery_cover
@ -398,8 +398,7 @@ def build_gallery(settings, gallery_settings, gallery_path, template):
open(Path("build").joinpath(gallery_light_path, "index.html"), "w").write(html) open(Path("build").joinpath(gallery_light_path, "index.html"), "w").write(html)
def build_index(settings, galleries_cover, templates, gallery_path='', sub_index=False):
def build_index(settings, galleries_cover, templates, gallery_path=''):
index_template = templates.get_template("index.html") index_template = templates.get_template("index.html")
galleries_cover = reversed(sorted(filter(lambda x: x != {}, galleries_cover), key=lambda x: x["date"])) galleries_cover = reversed(sorted(filter(lambda x: x != {}, galleries_cover), key=lambda x: x["date"]))
@ -414,6 +413,7 @@ def build_index(settings, galleries_cover, templates, gallery_path=''):
html = index_template.render( html = index_template.render(
settings=settings, settings=settings,
galleries=galleries_cover, galleries=galleries_cover,
sub_index=sub_index,
Image=Image, Image=Image,
Video=Video Video=Video
).encode("Utf-8") ).encode("Utf-8")

View File

@ -265,3 +265,43 @@ nav ul li > a.item-menu::before {
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
.back-to-home {
text-align: center;
}
.back-to-home hr {
width: 14%;
color: #DDD;
}
.back-to-home #logo {
background: transparent url("../img/logo.svg") no-repeat scroll center top / cover;
border-radius: 100em;
border: 7px solid black;
margin: auto;
margin-top: 1em;
height: 150px;
width: 150px;
color: transparent;
font-size: 40px;
}
.back-to-home a {
position: relative;
text-decoration: none;
color: transparent;
}
.back-to-home #logo:hover {
background-color: black;
text-decoration: none;
color: white;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
text-transform: uppercase;
font-family: 'montserrat', sans-serif;
font-weight: bold;
}

View File

@ -6,7 +6,18 @@
{% endblock %} {% endblock %}
{% block logo %} {% block logo %}
<img id="logo" src="static/img/logo.svg" /> {% if sub_index %}
<div class="back-to-home">
<hr>
<a href="../">
<div id="logo" src="static/img/logo.svg">
Back
</div>
</a>
</div>
{% else %}
<img id="logo" src="static/img/logo.svg"/>
{% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}

View File

@ -263,3 +263,39 @@ nav ul li > a.item-menu::before {
.gallery-cover img.fillWidth { .gallery-cover img.fillWidth {
height: 100%; height: 100%;
} }
.back-to-home hr {
width: 14%;
color: #DDD;
}
.back-to-home #logo {
background: transparent url("../img/logo.svg") no-repeat scroll center top / cover;
border-radius: 100em;
border: 7px solid black;
margin: auto;
margin-top: 1em;
height: 150px;
width: 150px;
color: transparent;
font-size: 40px;
}
.back-to-home a {
position: relative;
text-decoration: none;
color: transparent;
}
.back-to-home #logo:hover {
background-color: black;
text-decoration: none;
color: white;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
text-transform: uppercase;
font-family: 'montserrat', sans-serif;
font-weight: bold;
}

View File

@ -6,7 +6,18 @@
{% endblock %} {% endblock %}
{% block logo %} {% block logo %}
<img id="logo" src="static/img/logo.svg" /> {% if sub_index %}
<div class="back-to-home">
<hr>
<a href="../">
<div id="logo" src="static/img/logo.svg">
Back
</div>
</a>
</div>
{% else %}
<img id="logo" src="static/img/logo.svg"/>
{% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}