Commit b27465e0 authored by gijs's avatar gijs
Browse files

Hide map if there is no cover picture attached to the active event.

parent d3da0a26
......@@ -19,7 +19,7 @@
{% endfor %}
</ul>
</nav>
<section id="map" style="background-image:url({% block sidebar_image %}{{ SITE_URL }}static/images/maps/reading-room8-cover.png{% endblock %});"></section>
<section id="map" style="background-image:url({% block sidebar_image %}{% endblock %});"></section>
<section id="header-content">
{% block header-text %}
<p>
......@@ -58,10 +58,16 @@
})();
(function () {
var toggle = document.querySelector('#toggle--menu')
document.querySelector('#toggle--menu')
.addEventListener('click', function () {
document.body.classList.toggle('menu--expanded');
});
var map = document.querySelector('#map'),
bgImg = map.style.backgroundImage;
if (!bgImg || bgImg == 'url()' || bgImg == 'url("")' || bgImg == 'url("None")' || bgImg == 'url("null")') {
map.dataset.hidden = true;
}
})();
</script>
<script src="{{ SITE_URL }}static/js/links.js"></script>
......
......@@ -37,11 +37,17 @@
}
function showImage(path) {
var holder = document.getElementById('prolog');
if (path && path != 'None') {
holder.style.backgroundImage = 'url(' + path + ')';
} else {
holder.style.removeProperty('background-image');
var map = document.getElementById('map');
if (path && path.toLowerCase() == 'none') {
path = null;
}
if (path) {
map.style.backgroundImage = 'url(' + path + ')';
delete map.dataset.hidden;
}
else {
map.style.backgroundImage = '';
map.dataset.hidden = true;
}
}
......@@ -54,6 +60,7 @@
var container = document.querySelector('aside.home.event-detail');
container.dataset.loading = 'true';
container.innerHTML = '';
showImage(entry.dataset.image);
if (entry.id in eventCache) {
delete container.dataset.loading;
......
......@@ -323,7 +323,7 @@ body {
overflow: hidden;
display: grid;
grid-template-columns: [left sidebar-start] minmax(200px, 1fr) [sidebar-end content-start] 1fr [content-middle] 1fr [content-end right];
grid-template-rows: [top navbar] min-content [map] 2fr [header-content] 1fr [footer] min-content [bottom]; /* possible add 'main' and 'aside' as names for top line. But might be more confusing than adding clarity */
grid-template-rows: [top navbar] min-content [map] min-content [header-content] 1fr [footer] min-content [bottom]; /* possible add 'main' and 'aside' as names for top line. But might be more confusing than adding clarity */
border-left: 2px solid black;
border-right: 2px solid black;
}
......@@ -375,6 +375,7 @@ main, footer {
background-repeat: no-repeat;
background-position: right;
background-size: cover;
height: 50vh;
}
#header-content {
......@@ -1137,4 +1138,8 @@ aside.event-detail .question {
content: "Loading...";
text-align: center;
padding-top: calc(3 * var(--line-height));
}
#map[data-hidden="true"] {
display: none;
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment