diff --git a/templates/home.hamlet b/templates/home.hamlet index 77d84ad80..7d6097da0 100644 --- a/templates/home.hamlet +++ b/templates/home.hamlet @@ -40,7 +40,7 @@ ^{modal ".toggler1" Nothing} Klick mich für Ajax-Test - ^{modal ".toggler2" (Just "Test wegen Modal")} + ^{modal ".toggler2" (Just "Test Inhalt für Modal")}
Klick mich für Content-Test diff --git a/templates/standalone/modal.julius b/templates/standalone/modal.julius index be6d1c038..01a564ca4 100644 --- a/templates/standalone/modal.julius +++ b/templates/standalone/modal.julius @@ -10,6 +10,8 @@ var origParent = modal.parentNode; function open(event) { + // disable modals for narrow screens + if (window.innerWidth < 768) return true; if (event) { event.preventDefault(); } @@ -64,7 +66,9 @@ replaceMe.classList.remove('replace-me'); replaceMe.innerText = '...loading'; if (replaceWith.length > 0) { - fetch(replaceWith).then(function(response) { + fetch(replaceWith, { + credentials: 'same-origin' + }).then(function(response) { return response.text(); }).then(function(body) { var modalContent = document.createElement('div'); diff --git a/templates/widgets/modal.hamlet b/templates/widgets/modal.hamlet index 6b3878f4d..9dc569101 100644 --- a/templates/widgets/modal.hamlet +++ b/templates/widgets/modal.hamlet @@ -1,18 +1,8 @@
+ $# primitive way of checking if this is supposed to be add a placeholder for async data. + $# modalContent is 'placeholder' if there should be a placeholder only. + $# 'placeholder' has length 11. $if 11 == length modalContent
$else -

Neue Veranstaltung #{modalContent} -
-
-