Compare commits

...
Author SHA1 Message Date
bence eae7cefae1 MAPG-172 don't close the cookie DIV if not the agree button was clicked 2020-06-24 23:00:26 +02:00
bence 212728e138 Merged in bugfix/MAPG-172-create-cookie-notice (pull request #143)
MAPG-172 quote I agree
2020-06-24 20:55:36 +00:00
bence 0d627f297e MAPG-172 quote I agree 2020-06-24 22:55:13 +02:00
bence f07ae979a2 Merged in feature/MAPG-175-unify-styles (pull request #142)
MAPG-175 align noPano middle and center as other elements
2020-06-24 20:37:59 +00:00
bence 8bdbbafcff MAPG-175 align noPano middle and center as other elements 2020-06-24 22:37:33 +02:00
bence 3856ccb576 Merged in feature/MAPG-174-adjust-map-description-style (pull request #141)
MAPG-174 create separate div for description and align description vertically middle
2020-06-24 20:34:00 +00:00
bence 9f839d3f5d MAPG-174 create separate div for description and align description vertically middle 2020-06-24 22:32:54 +02:00
bence 721b611cdb Merged in feature/MAPG-174-adjust-map-description-style (pull request #140)
MAPG-174 align description center
2020-06-24 20:11:08 +00:00
bence 70fb30f673 MAPG-174 align description center 2020-06-24 22:10:24 +02:00
bence e200dab2a4 Merged in feature/MAPG-172-create-cookie-notice (pull request #139)
Feature/MAPG-172 create cookie notice
2020-06-24 20:03:29 +00:00
bence e8c246f002 MAPG-172 add cookie consent DIV and JS handler 2020-06-24 21:57:41 +02:00
bence 251bf1be3d MAPG-172 add new styles 2020-06-24 21:57:40 +02:00
bence 0be20a6097 MAPG-172 don't send session if user didn't consent the cookies 2020-06-24 21:57:40 +02:00
7 changed files with 94 additions and 31 deletions

No files matched your search

+3 -1
View File
@@ -16,6 +16,8 @@
#noPano {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
z-index: 2;
visibility: hidden;
@@ -23,7 +25,7 @@
}
#noPano>p {
margin: auto;
text-align: center;
}
#control {
+14 -1
View File
@@ -84,7 +84,7 @@ hr {
}
p.small, span.small {
font-size: 12px;
font-size: 14px;
}
.justify {
@@ -148,6 +148,13 @@ button, a.button {
line-height: 35px;
}
button.small {
font-size: 14px;
padding: 0 12px;
height: 32px;
line-height: 32px;
}
button:enabled:hover, button:enabled:focus, a.button:hover, a.button:focus {
background-color: #29457f;
outline: none;
@@ -336,6 +343,12 @@ div.buttonContainer>button {
margin: 0 auto;
}
#cookiesNotice {
background-color: #eeeeee;
padding: 10px;
text-align: center;
}
#loading {
position: fixed;
width: 64px;
+6
View File
@@ -46,6 +46,12 @@ div.mapItem>div.inner>div.info {
grid-template-columns: auto auto;
}
div.mapItem>div.inner>div.description {
display: flex;
justify-content: center;
align-items: center;
}
div.mapItem>div.inner>div.info>p:nth-child(1) {
text-align: left;
}
+23 -21
View File
@@ -30,7 +30,9 @@ $cssFiles = [
-->~ <?= $map['area'][0] ?> <?= $map['area'][1] ?><sup>2</sup>
</p>
</div>
<p class="small justify marginTop"><?= $map['description'] ?></p>
<div class="description marginTop">
<p class="small center"><?= $map['description'] ?></p>
</div>
</div>
<?php if ($isAdmin): ?>
<div class="buttonContainer">
@@ -64,7 +66,7 @@ $cssFiles = [
const GOOGLE_MAPS_JS_API_KEY = '<?= $_ENV['GOOGLE_MAPS_JS_API_KEY'] ?>';
var Maps = {
innerDivs: null,
descriptionDivs: null,
addStaticMaps: function () {
var imgContainers = document.getElementById('mapContainer').getElementsByClassName('imgContainer');
@@ -81,29 +83,29 @@ $cssFiles = [
}
},
initializeInnerDivs: function () {
Maps.innerDivs = document.getElementById('mapContainer').getElementsByClassName('inner');
initializeDescriptionDivs: function () {
Maps.descriptionDivs = document.getElementById('mapContainer').getElementsByClassName('description');
for (var i = 0; i < Maps.innerDivs.length; i++) {
var inner = Maps.innerDivs[i];
var boundingClientRect = inner.getBoundingClientRect();
for (var i = 0; i < Maps.descriptionDivs.length; i++) {
var description = Maps.descriptionDivs[i];
var boundingClientRect = description.getBoundingClientRect();
inner.defaultHeight = boundingClientRect.height;
description.defaultHeight = boundingClientRect.height;
}
},
calculateInnerDivHeights: function () {
calculateDescriptionDivHeights: function () {
var currentY;
var rows = [];
for (var i = 0; i < Maps.innerDivs.length; i++) {
var inner = Maps.innerDivs[i];
var boundingClientRect = inner.getBoundingClientRect();
for (var i = 0; i < Maps.descriptionDivs.length; i++) {
var description = Maps.descriptionDivs[i];
var boundingClientRect = description.getBoundingClientRect();
if (currentY !== boundingClientRect.y) {
rows.push([]);
}
rows[rows.length - 1].push(inner);
rows[rows.length - 1].push(description);
currentY = boundingClientRect.y;
}
@@ -113,17 +115,17 @@ $cssFiles = [
var maxHeight = 0;
for (var j = 0; j < row.length; j++) {
var inner = row[j];
var description = row[j];
if (inner.defaultHeight > maxHeight) {
maxHeight = inner.defaultHeight;
if (description.defaultHeight > maxHeight) {
maxHeight = description.defaultHeight;
}
}
for (var j = 0; j < row.length; j++) {
var inner = row[j];
var description = row[j];
inner.style.height = maxHeight + 'px';
description.style.height = maxHeight + 'px';
}
}
}
@@ -131,11 +133,11 @@ $cssFiles = [
Maps.addStaticMaps();
Maps.initializeInnerDivs();
Maps.calculateInnerDivHeights();
Maps.initializeDescriptionDivs();
Maps.calculateDescriptionDivHeights();
window.onresize = function () {
Maps.calculateInnerDivHeights();
Maps.calculateDescriptionDivHeights();
};
})();
</script>
+28
View File
@@ -14,5 +14,33 @@
<script src="<?= $jsFile ?>"></script>
<?php endforeach; ?>
<?php endif; ?>
<?php if (!isset($_COOKIE['COOKIES_CONSENT'])): ?>
<script>
(function () {
MapGuesser = {
cookiesAgreed: false,
agreeCookies: function () {
if (MapGuesser.cookiesAgreed) {
return;
}
var expirationDate = new Date(new Date().getTime() + 20 * 365 * 24 * 60 * 60 * 1000).toUTCString();
document.cookie = 'COOKIES_CONSENT=1; expires=' + expirationDate + '; path=/';
MapGuesser.cookiesAgreed = true;
}
};
document.getElementById('agreeCookies').onclick = function () {
document.getElementById('cookiesNotice').style.display = 'none';
};
window.onclick = function () {
MapGuesser.agreeCookies();
};
})();
</script>
<?php endif; ?>
</body>
</html>
+8
View File
@@ -22,6 +22,14 @@
<link rel="icon" type="image/png" sizes="16x16" href="<?= $_ENV['STATIC_ROOT'] ?>/img/favicon/16x16.png?rev=<?= REVISION ?>">
</head>
<body>
<?php if (!isset($_COOKIE['COOKIES_CONSENT'])): ?>
<div id="cookiesNotice">
<p class="small">
<?= $_ENV['APP_NAME'] ?> uses cookies to improve user experience. By using the app or clicking 'Agree', you consent to our use of cookies.
</p>
<button id="agreeCookies" class="small marginTop">Agree</button>
</div>
<?php endif; ?>
<div id="loading">
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/loading.svg?rev=<?= REVISION ?>" width="64" height="64">
</div>
+12 -8
View File
@@ -49,15 +49,19 @@ Container::$routeCollection->group('admin', function (MapGuesser\Routing\RouteCo
$routeCollection->post('admin.deleteMap', 'deleteMap/{mapId}', [MapGuesser\Controller\MapAdminController::class, 'deleteMap']);
});
Container::$sessionHandler = new MapGuesser\Session\DatabaseSessionHandler();
if (isset($_COOKIE['COOKIES_CONSENT'])) {
Container::$sessionHandler = new MapGuesser\Session\DatabaseSessionHandler();
session_set_save_handler(Container::$sessionHandler, true);
session_start([
'gc_maxlifetime' => 604800,
'cookie_lifetime' => 604800,
'cookie_httponly' => true,
'cookie_samesite' => 'Lax'
]);
session_set_save_handler(Container::$sessionHandler, true);
session_start([
'gc_maxlifetime' => 604800,
'cookie_lifetime' => 604800,
'cookie_httponly' => true,
'cookie_samesite' => 'Lax'
]);
} else {
$_SESSION = [];
}
Container::$request = new MapGuesser\Request\Request($_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'], $_GET, $_POST, $_SESSION);