From bf1c7373ff5bad245c59e6c42aea3f10c8fecda4 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Fri, 30 Mar 2018 23:08:27 +0200 Subject: [PATCH 1/5] fix for z-index of modals --- templates/widgets/modal.julius | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/widgets/modal.julius b/templates/widgets/modal.julius index 5033f05b2..06160bcbd 100644 --- a/templates/widgets/modal.julius +++ b/templates/widgets/modal.julius @@ -10,10 +10,14 @@ document.addEventListener('DOMContentLoaded', function() { var trigger = document.querySelector(modal.dataset.trigger); var closeBound; - this.open = function openFn() { + this.open = function openFn(event) { + if (event) { + event.preventDefault(); + } modal.classList.add('modal--open'); overlay.classList.add('modal__overlay'); - modal.parentNode.insertBefore(overlay, modal); + document.body.insertBefore(modal, null); + document.body.insertBefore(overlay, modal); overlay.classList.add('modal__overlay--open'); toggleScroll(false); From 8bb71a5c3e38c099418f453889ef49d3b58588c7 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sat, 31 Mar 2018 00:22:04 +0200 Subject: [PATCH 2/5] Moved modals to standalones --- src/Foundation.hs | 7 +- src/Handler/Utils/Templates.hs | 14 ++++ templates/default-layout.hamlet | 2 - templates/home.hamlet | 13 ++-- templates/standalone/modal.hamlet | 1 + templates/standalone/modal.julius | 111 ++++++++++++++++++++++++++++++ templates/widgets/modal.hamlet | 33 ++++----- templates/widgets/modal.julius | 61 ---------------- 8 files changed, 152 insertions(+), 90 deletions(-) create mode 100644 templates/standalone/modal.hamlet create mode 100644 templates/standalone/modal.julius delete mode 100644 templates/widgets/modal.julius diff --git a/src/Foundation.hs b/src/Foundation.hs index ba6cc663e..e10d1c515 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -399,12 +399,6 @@ defaultMenuLayout menu widget = do asidenav = $(widgetFile "widgets/asidenav") breadcrumbs :: Widget breadcrumbs = $(widgetFile "widgets/breadcrumbs") - modal :: [Char] -> [Char] -> Widget - modal modalTrigger modalContent = do - let - modalId :: Int32 - modalId = 13 - $(widgetFile "widgets/modal") pageactionprime :: Widget pageactionprime = $(widgetFile "widgets/pageactionprime") -- functions to determine if there are page-actions @@ -420,6 +414,7 @@ defaultMenuLayout menu widget = do addStylesheet $ StaticR css_fonts_css addStylesheet $ StaticR css_icons_css $(widgetFile "default-layout") + $(widgetFile "standalone/modal") $(widgetFile "standalone/showHide") $(widgetFile "standalone/sortable") $(widgetFile "standalone/inputs") diff --git a/src/Handler/Utils/Templates.hs b/src/Handler/Utils/Templates.hs index 245159eeb..8bae783b0 100644 --- a/src/Handler/Utils/Templates.hs +++ b/src/Handler/Utils/Templates.hs @@ -6,3 +6,17 @@ import Import.NoFoundation lipsum :: WidgetT site IO () lipsum = $(widgetFile "widgets/lipsum") + +modal :: [Char] -> Maybe [Char] -> WidgetT site IO () +modal modalTrigger (Just modalContent) = do + let + modalId :: Int32 + modalId = 13 + $(widgetFile "widgets/modal") +modal modalTrigger Nothing = do + let + modalId :: Int32 + modalId = 13 + modalContent :: [Char] + modalContent = "placeholder" + $(widgetFile "widgets/modal") diff --git a/templates/default-layout.hamlet b/templates/default-layout.hamlet index d606ccf37..b628912f0 100644 --- a/templates/default-layout.hamlet +++ b/templates/default-layout.hamlet @@ -6,8 +6,6 @@ ^{asidenav} - ^{modal ".toggler" "

Neue Veranstaltung


Erstelle eine neue Veranstaltung! Jetzt und hier. Kostenlos."} -
diff --git a/templates/home.hamlet b/templates/home.hamlet index 36ea5a429..48134ec0d 100644 --- a/templates/home.hamlet +++ b/templates/home.hamlet @@ -72,11 +72,14 @@ Knopf-Test:
^{btnWdgt} - $if True - $# meant to be 'if js-supported' -

  • - Modals: -