From 18b3fe0e5dbf50e2329e3f271fd503aaf26b5e0e Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sat, 13 Oct 2018 00:00:44 +0200 Subject: [PATCH 1/5] introduced icon for modals --- src/Handler/Course.hs | 4 ++-- src/Handler/Utils/Table/Cells.hs | 4 ++-- src/Handler/Utils/Templates.hs | 15 +++++++++++++-- templates/standalone/modal.julius | 1 - templates/standalone/modal.lucius | 13 +++++++++++++ 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index 044f9b391..300c6d3ff 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -78,8 +78,8 @@ colCShortDescr = sortable (Just "cshort") (i18nCell MsgCourseShort) (Just descr) -> cell [whamlet| $newline never - - ^{modal "Beschreibung" (Right $ toWidget descr)} +
+ ^{modal "Beschreibung anzeigen" (Right $ toWidget descr)} |] ) diff --git a/src/Handler/Utils/Table/Cells.hs b/src/Handler/Utils/Table/Cells.hs index 65bc11452..5c4dad4d7 100644 --- a/src/Handler/Utils/Table/Cells.hs +++ b/src/Handler/Utils/Table/Cells.hs @@ -78,8 +78,8 @@ courseCell (Course {..}) = anchorCell link name `mappend` desc Nothing -> mempty (Just descr) -> cell [whamlet| $newline never - - ^{modal "Beschreibung" (Right $ toWidget descr)} +
+ ^{modal "Beschreibung anzeigen" (Right $ toWidget descr)} |] sheetCell :: IsDBTable m a => CourseLink -> SheetName -> DBCell m a diff --git a/src/Handler/Utils/Templates.hs b/src/Handler/Utils/Templates.hs index 57ab0f1d6..bb89397b1 100644 --- a/src/Handler/Utils/Templates.hs +++ b/src/Handler/Utils/Templates.hs @@ -16,5 +16,16 @@ modal modalTrigger modalContent = do triggerId <- newIdent $(widgetFile "widgets/modal") case modalContent of - Left route -> [whamlet|^{modalTrigger}|] - Right content -> [whamlet|
^{modalTrigger}|] + -- TODO: refactor this. preferably put svg in separte file somewhere in static? + Left route -> [whamlet| +
+ + + ^{modalTrigger} + |] + Right content -> [whamlet| +
+
+ + ^{modalTrigger} + |] diff --git a/templates/standalone/modal.julius b/templates/standalone/modal.julius index 8bac72f12..fa32d2723 100644 --- a/templates/standalone/modal.julius +++ b/templates/standalone/modal.julius @@ -50,7 +50,6 @@ document.addEventListener('modal-open', openOnEvent, false); // if modal has trigger assigned to it open modal on click if (trigger) { - trigger.classList.add('modal__trigger'); trigger.addEventListener('click', open, false); } diff --git a/templates/standalone/modal.lucius b/templates/standalone/modal.lucius index 589083ece..2379714ee 100644 --- a/templates/standalone/modal.lucius +++ b/templates/standalone/modal.lucius @@ -60,6 +60,19 @@ .modal__trigger { cursor: pointer; + display: inline-flex; + flex-direction: row; + align-items: baseline; + margin-top: 5px; +} + +.modal__trigger-icon { + height: 20px; +} + +.modal__trigger-label { + font-size: 14px; + padding-left: 5px; } .modal__closer { From 5332e22c134ee8bcf71c320988cfb0aa8f4ea4b0 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 14 Oct 2018 17:24:19 +0200 Subject: [PATCH 2/5] img_modal_svg --- src/Foundation.hs | 1 - src/Handler/Utils/Templates.hs | 15 +++++++-------- static/img/modal.svg | 7 +++++++ 3 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 static/img/modal.svg diff --git a/src/Foundation.hs b/src/Foundation.hs index 105c859ab..558e13e8e 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -75,7 +75,6 @@ import qualified Control.Monad.Catch as C import System.FilePath -import Handler.Utils.Templates import Handler.Utils.StudyFeatures import Control.Lens import Utils diff --git a/src/Handler/Utils/Templates.hs b/src/Handler/Utils/Templates.hs index bb89397b1..d23e6b31e 100644 --- a/src/Handler/Utils/Templates.hs +++ b/src/Handler/Utils/Templates.hs @@ -4,12 +4,9 @@ module Handler.Utils.Templates where import Data.Either (isLeft) -import Import.NoFoundation +import Import -lipsum :: WidgetT site IO () -lipsum = $(widgetFile "widgets/lipsum") - -modal :: WidgetT site IO () -> Either (Route site) (WidgetT site IO ()) -> WidgetT site IO () +modal :: WidgetT UniWorX IO () -> Either (Route UniWorX) (WidgetT UniWorX IO ()) -> WidgetT UniWorX IO () modal modalTrigger modalContent = do let modalDynamic = isLeft modalContent modalId <- newIdent @@ -18,14 +15,16 @@ modal modalTrigger modalContent = do case modalContent of -- TODO: refactor this. preferably put svg in separte file somewhere in static? Left route -> [whamlet| + $newline never
- + ^{modalTrigger} |] - Right content -> [whamlet| + Right _ -> [whamlet| + $newline never
- + ^{modalTrigger} |] diff --git a/static/img/modal.svg b/static/img/modal.svg new file mode 100644 index 000000000..a4a08bb48 --- /dev/null +++ b/static/img/modal.svg @@ -0,0 +1,7 @@ + + + + + + + From 6af0ebe400756a5bb8acdf42c1743930e76bfe64 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sat, 9 Feb 2019 21:03:33 +0100 Subject: [PATCH 3/5] remove modal trigger icon --- src/Handler/Utils/Templates.hs | 14 +++++--------- static/img/modal.svg | 7 ------- templates/standalone/modal.lucius | 9 --------- 3 files changed, 5 insertions(+), 25 deletions(-) delete mode 100644 static/img/modal.svg diff --git a/src/Handler/Utils/Templates.hs b/src/Handler/Utils/Templates.hs index ef584c19b..221c72b76 100644 --- a/src/Handler/Utils/Templates.hs +++ b/src/Handler/Utils/Templates.hs @@ -2,7 +2,7 @@ module Handler.Utils.Templates where import Data.Either (isLeft) -import Import +import Import.NoFoundation modal :: WidgetT site IO () -> Either (SomeRoute site) (WidgetT site IO ()) -> WidgetT site IO () modal modalTrigger modalContent = do @@ -15,16 +15,12 @@ modal modalTrigger modalContent = do route' <- toTextUrl route [whamlet| $newline never -
- - - ^{modalTrigger} + + ^{modalTrigger} |] Right _ -> do [whamlet| $newline never -
-
- - ^{modalTrigger} +
+ ^{modalTrigger} |] diff --git a/static/img/modal.svg b/static/img/modal.svg deleted file mode 100644 index a4a08bb48..000000000 --- a/static/img/modal.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/templates/standalone/modal.lucius b/templates/standalone/modal.lucius index 390a60a1e..8811f3bae 100644 --- a/templates/standalone/modal.lucius +++ b/templates/standalone/modal.lucius @@ -66,19 +66,10 @@ .modal__trigger { cursor: pointer; - display: inline-flex; - flex-direction: row; - align-items: baseline; - margin-top: 5px; -} - -.modal__trigger-icon { - height: 20px; } .modal__trigger-label { font-size: 14px; - padding-left: 5px; } .modal__closer { From b98a751748ae939a8522fb77d2b40c9c61253d8c Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sat, 9 Feb 2019 21:07:43 +0100 Subject: [PATCH 4/5] revert change to course description modal wording --- src/Handler/Course.hs | 2 +- src/Handler/Utils/Table/Cells.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index 81f69adc1..9a55c4943 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -59,7 +59,7 @@ colCShortDescr = sortable (Just "cshort") (i18nCell MsgCourseShort) [whamlet| $newline never
- ^{modal "Beschreibung anzeigen" (Right $ toWidget descr)} + ^{modal "Beschreibung" (Right $ toWidget descr)} |] ) diff --git a/src/Handler/Utils/Table/Cells.hs b/src/Handler/Utils/Table/Cells.hs index dd95183de..a164e9f96 100644 --- a/src/Handler/Utils/Table/Cells.hs +++ b/src/Handler/Utils/Table/Cells.hs @@ -82,7 +82,7 @@ courseCell Course{..} = anchorCell link name `mappend` desc (Just descr) -> cell [whamlet| $newline never
- ^{modal "Beschreibung anzeigen" (Right $ toWidget descr)} + ^{modal "Beschreibung" (Right $ toWidget descr)} |] sheetCell :: IsDBTable m a => CourseLink -> SheetName -> DBCell m a From 0b0b1e95b04979c2b8861a23f926df3b6728db02 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sat, 9 Feb 2019 21:12:56 +0100 Subject: [PATCH 5/5] make modal triggers italic --- templates/standalone/modal.lucius | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/standalone/modal.lucius b/templates/standalone/modal.lucius index 8811f3bae..722f38a3a 100644 --- a/templates/standalone/modal.lucius +++ b/templates/standalone/modal.lucius @@ -69,7 +69,8 @@ } .modal__trigger-label { - font-size: 14px; + font-style: italic; + text-decoration: underline; } .modal__closer {