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 @@ ...@@ -19,7 +19,7 @@
{% endfor %} {% endfor %}
</ul> </ul>
</nav> </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"> <section id="header-content">
{% block header-text %} {% block header-text %}
<p> <p>
...@@ -58,10 +58,16 @@ ...@@ -58,10 +58,16 @@
})(); })();
(function () { (function () {
var toggle = document.querySelector('#toggle--menu') document.querySelector('#toggle--menu')
.addEventListener('click', function () { .addEventListener('click', function () {
document.body.classList.toggle('menu--expanded'); 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>
<script src="{{ SITE_URL }}static/js/links.js"></script> <script src="{{ SITE_URL }}static/js/links.js"></script>
......
...@@ -37,11 +37,17 @@ ...@@ -37,11 +37,17 @@
} }
function showImage(path) { function showImage(path) {
var holder = document.getElementById('prolog'); var map = document.getElementById('map');
if (path && path != 'None') { if (path && path.toLowerCase() == 'none') {
holder.style.backgroundImage = 'url(' + path + ')'; path = null;
} else { }
holder.style.removeProperty('background-image'); if (path) {
map.style.backgroundImage = 'url(' + path + ')';
delete map.dataset.hidden;
}
else {
map.style.backgroundImage = '';
map.dataset.hidden = true;
} }
} }
...@@ -54,6 +60,7 @@ ...@@ -54,6 +60,7 @@
var container = document.querySelector('aside.home.event-detail'); var container = document.querySelector('aside.home.event-detail');
container.dataset.loading = 'true'; container.dataset.loading = 'true';
container.innerHTML = ''; container.innerHTML = '';
showImage(entry.dataset.image);
if (entry.id in eventCache) { if (entry.id in eventCache) {
delete container.dataset.loading; delete container.dataset.loading;
......
...@@ -323,7 +323,7 @@ body { ...@@ -323,7 +323,7 @@ body {
overflow: hidden; overflow: hidden;
display: grid; display: grid;
grid-template-columns: [left sidebar-start] minmax(200px, 1fr) [sidebar-end content-start] 1fr [content-middle] 1fr [content-end right]; 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-left: 2px solid black;
border-right: 2px solid black; border-right: 2px solid black;
} }
...@@ -375,6 +375,7 @@ main, footer { ...@@ -375,6 +375,7 @@ main, footer {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: right; background-position: right;
background-size: cover; background-size: cover;
height: 50vh;
} }
#header-content { #header-content {
...@@ -1137,4 +1138,8 @@ aside.event-detail .question { ...@@ -1137,4 +1138,8 @@ aside.event-detail .question {
content: "Loading..."; content: "Loading...";
text-align: center; text-align: center;
padding-top: calc(3 * var(--line-height)); 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