From bf060c4654572dc290959495cccd47b62e842b64 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 1 Oct 2018 13:34:03 +0200 Subject: [PATCH 01/17] minor cleanup --- src/Import/NoFoundation.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Import/NoFoundation.hs b/src/Import/NoFoundation.hs index 19d0bb34d..8db4ec779 100644 --- a/src/Import/NoFoundation.hs +++ b/src/Import/NoFoundation.hs @@ -1,7 +1,6 @@ {-# LANGUAGE CPP #-} module Import.NoFoundation ( module Import - , addMessage, addMessageI ) where import ClassyPrelude.Yesod as Import hiding (formatTime, derivePersistFieldJSON, addMessage, addMessageI) From ead35c4518b4d899caf51cc535b101d3154d2c22 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 2 Oct 2018 19:37:16 +0200 Subject: [PATCH 02/17] Fix splitCamel --- src/Utils/PathPiece.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Utils/PathPiece.hs b/src/Utils/PathPiece.hs index cff91d976..0aa1a364c 100644 --- a/src/Utils/PathPiece.hs +++ b/src/Utils/PathPiece.hs @@ -44,6 +44,8 @@ splitCamel = map fromList . reverse . helper (error "hasChange undefined at star | sameCategory w c , null ws' = helper (Char.isLower w) items (c:ws) cs | sameCategory w c = helper hadChange items (c:ws) cs + | Char.isLower w + , Char.isUpper c = helper True (reverse ws :items) [c] cs | null ws' = helper True items (c:ws) cs | not hadChange = helper True (reverse ws':items) [c,w] cs | otherwise = helper True (reverse ws :items) [c] cs From 4579fe56beb69adf9e4f5264cf7424665f794d8d Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sun, 30 Sep 2018 20:24:45 +0200 Subject: [PATCH 03/17] modal adjustments --- src/Handler/Profile.hs | 7 ++--- src/Handler/Utils/Templates.hs | 29 ++++++--------------- templates/standalone/modal.julius | 39 ++-------------------------- templates/standalone/modal.lucius | 7 ++--- templates/widgets/modal.hamlet | 10 ++----- templates/widgets/modalStatic.hamlet | 2 +- templates/widgets/modalWidget.hamlet | 2 +- 7 files changed, 20 insertions(+), 76 deletions(-) diff --git a/src/Handler/Profile.hs b/src/Handler/Profile.hs index 29918fe82..ddd2cbe9c 100644 --- a/src/Handler/Profile.hs +++ b/src/Handler/Profile.hs @@ -176,14 +176,15 @@ getProfileDataR = do -- TODO: move this into a Message and/or Widget-File let delWdgt = [whamlet|
-
Sind Sie sich absolut sicher, alle gespeicherten Daten zu löschen? +

Sind Sie sich absolut sicher, alle gespeicherten Daten zu löschen? +
Abgegebene Hausaufgaben werden dadurch rückwirkend gelöscht, wodurch eventuell ein Klausurbonus nicht mehr anerkannt wird. -
+
Gilt nicht in der Testphase von Uni2work: Klausurnoten können Sie hiermit nicht löschen. Da diese 5 Jahre bis nach Ihrer Exmatrikulation aufbewahrt werden müssen. -
^{btnWdgt} +
^{btnWdgt} |] defaultLayout $ do $(widgetFile "profileData") diff --git a/src/Handler/Utils/Templates.hs b/src/Handler/Utils/Templates.hs index 810ea8472..2204c27f1 100644 --- a/src/Handler/Utils/Templates.hs +++ b/src/Handler/Utils/Templates.hs @@ -9,32 +9,19 @@ lipsum = $(widgetFile "widgets/lipsum") modalStatic :: Html -> WidgetT site IO () modalStatic modalContent = do - uniqueId <- newIdent - let modalTrigger = cons '#' uniqueId -- SJ: I am confused why this is needed here? - modalId :: Int32 - modalId = 13 + modalId <- newIdent + triggerId <- newIdent $(widgetFile "widgets/modalStatic") - [whamlet|
?|] -- SJ: confused why ## is needed here either? + [whamlet|
MODALTRIGGER|] -- TODO: Content of Modal Trigger modalWidget :: Html -> WidgetT site IO () -> WidgetT site IO () modalWidget modalTrigger modalContent = do - uniqueId <- newIdent - let modalTriggerId = cons '#' uniqueId -- SJ: I am confused why this is needed here? - modalId :: Int32 - modalId = 13 + modalId <- newIdent + triggerId <- newIdent $(widgetFile "widgets/modalWidget") - [whamlet|
#{modalTrigger}|] -- SJ: confused why ## is needed here either? + [whamlet|
#{modalTrigger}|] modal :: Text -> Maybe [Char] -> WidgetT site IO () -modal modalTrigger (Just modalContent) = do -- WARNING: ModalContent should not have length 11. SJ: This is possibly bad. See Template! - let - modalId :: Int32 - modalId = 13 - $(widgetFile "widgets/modal") -modal modalTrigger Nothing = do - let - modalId :: Int32 - modalId = 13 - modalContent :: [Char] - modalContent = "placeholder" +modal triggerId (Just modalContent) = do + modalId <- newIdent $(widgetFile "widgets/modal") diff --git a/templates/standalone/modal.julius b/templates/standalone/modal.julius index 01a564ca4..0de0ceb59 100644 --- a/templates/standalone/modal.julius +++ b/templates/standalone/modal.julius @@ -6,12 +6,11 @@ window.utils.modal = function(modal) { var overlay = document.createElement('div'); var closer = document.createElement('div'); - var trigger = document.querySelector(modal.dataset.trigger); + var trigger = document.querySelector('#' + modal.dataset.trigger); var origParent = modal.parentNode; function open(event) { // disable modals for narrow screens - if (window.innerWidth < 768) return true; if (event) { event.preventDefault(); } @@ -20,7 +19,6 @@ document.body.insertBefore(modal, null); document.body.insertBefore(overlay, modal); overlay.classList.add('modal__overlay--open'); - toggleScroll(false); if (modal.dataset.closeable === 'true') { closer.classList.add('modal__closer'); @@ -31,7 +29,7 @@ } // open this modal with an event: - // document.dispatchEvent(new CustomEvent('modal-open', { dateils: {for: 'modal-13'}})) + // document.dispatchEvent(new CustomEvent('modal-open', { details: { for: 'modal-13' }})) function openOnEvent(event) { if (event.detail.for === modal.getAttribute('id')) { open(); @@ -43,7 +41,6 @@ overlay.remove(); origParent.insertBefore(modal, null); modal.classList.remove('modal--open'); - toggleScroll(true); closer.removeEventListener('click', close, false); } }; @@ -56,43 +53,11 @@ trigger.classList.add('modal__trigger'); trigger.addEventListener('click', open, false); } - // if there is no content specified for the modal we assume that - // the content is supposed to be the page the trigger links to. - // so we check if the trigger has a href-attribute, fetch that page - // and replace the modal content with the response - var replaceMe = modal.querySelector('.replace-me'); - var replaceWith = trigger ? trigger.getAttribute('href') : ''; - if (replaceMe) { - replaceMe.classList.remove('replace-me'); - replaceMe.innerText = '...loading'; - if (replaceWith.length > 0) { - fetch(replaceWith, { - credentials: 'same-origin' - }).then(function(response) { - return response.text(); - }).then(function(body) { - var modalContent = document.createElement('div'); - modalContent.innerHTML = body; - var main = modalContent.querySelector('.main__content'); - if (main) { - replaceMe.innerText = ''; - replaceMe.insertBefore(main, null); - } else { - replaceMe.innerHTML = body; - } - }); - } - } // tell further modals, that this one already got initialized modal.classList.add('js-modal-initialized'); } setup(); }; - - // make sure document doesn't scroll when modal is active - function toggleScroll(scrollable) { - document.body.classList.toggle('no-scroll', !scrollable); - } })(); document.addEventListener('DOMContentLoaded', function() { diff --git a/templates/standalone/modal.lucius b/templates/standalone/modal.lucius index 2ccec226b..404c355ce 100644 --- a/templates/standalone/modal.lucius +++ b/templates/standalone/modal.lucius @@ -8,10 +8,11 @@ min-width: 60vw; min-height: 100px; max-height: calc(100vh - 30px); - border-radius: 7px; + border-radius: 2px; z-index: -1; color: var(--color-font); padding: 20px; + padding-right: 65px; overflow: auto; opacity: 0; transition: all .15s ease; @@ -81,7 +82,3 @@ color: white; } } - -.no-scroll { - overflow: hidden; -} diff --git a/templates/widgets/modal.hamlet b/templates/widgets/modal.hamlet index 9dc569101..6fc5eb9ca 100644 --- a/templates/widgets/modal.hamlet +++ b/templates/widgets/modal.hamlet @@ -1,8 +1,2 @@ -
- $# 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 - #{modalContent} +
+ #{modalContent} diff --git a/templates/widgets/modalStatic.hamlet b/templates/widgets/modalStatic.hamlet index a9b8e3587..c6a78a6d3 100644 --- a/templates/widgets/modalStatic.hamlet +++ b/templates/widgets/modalStatic.hamlet @@ -1,2 +1,2 @@ -
+
#{modalContent} diff --git a/templates/widgets/modalWidget.hamlet b/templates/widgets/modalWidget.hamlet index e80516d1f..286502e2b 100644 --- a/templates/widgets/modalWidget.hamlet +++ b/templates/widgets/modalWidget.hamlet @@ -1,2 +1,2 @@ -
+
^{modalContent} From f05c6c66b2f2bce733a3f01e3b064e19159ba456 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sun, 30 Sep 2018 21:55:09 +0200 Subject: [PATCH 04/17] tooltip and navbar cleanup closes #86 --- templates/multiFileField.hamlet | 2 +- templates/standalone/tooltip.lucius | 17 +++++++++++++++++ templates/widgets/form.hamlet | 2 +- templates/widgets/navbar.lucius | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/templates/multiFileField.hamlet b/templates/multiFileField.hamlet index 62123a11e..649a9b47e 100644 --- a/templates/multiFileField.hamlet +++ b/templates/multiFileField.hamlet @@ -16,5 +16,5 @@ $# new files