got rid of dummy data in modal template

This commit is contained in:
Felix Hamann 2018-04-16 00:32:43 +02:00
parent c8fac05974
commit 35933ebc56
3 changed files with 9 additions and 15 deletions

View File

@ -40,7 +40,7 @@
^{modal ".toggler1" Nothing}
<a href="/" .btn.toggler1>Klick mich für Ajax-Test
<noscript>(Für Modals bitte JS aktivieren)</noscript>
^{modal ".toggler2" (Just "Test wegen Modal")}
^{modal ".toggler2" (Just "Test Inhalt für Modal")}
<div .btn.toggler2>Klick mich für Content-Test
<noscript>(Für Modals bitte JS aktivieren)</noscript>

View File

@ -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');

View File

@ -1,18 +1,8 @@
<div .modal.js-modal #modal-#{modalId} data-trigger=#{modalTrigger} data-closeable=true>
$# 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
<div .replace-me>
$else
<h2>Neue Veranstaltung
#{modalContent}
<form>
<div .form-group>
<label .reactive-label for="inp1">Name
<input type="text" id="inp1">
<div .form-group>
<label .reactive-label for="inp2">Kürzel
<input type="text" id="inp2">
<div .form-group>
<label .reactive-label for="inp3">Semester
<input type="text" id="inp3">
<div .form-group>
<input type="submit" value="Submit">