diff --git a/src/Foundation.hs b/src/Foundation.hs index 123ca4cff..62383403b 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -88,9 +88,9 @@ data MenuItem = MenuItem } data MenuTypes - = NavbarLeft { menuItem :: MenuItem } - | NavbarRight { menuItem :: MenuItem } - | NavbarExtra { menuItem :: MenuItem } + = NavbarAside { menuItem :: MenuItem } + | NavbarRight { menuItem :: MenuItem } + | NavbarExtra { menuItem :: MenuItem } | NavbarSecondary { menuItem :: MenuItem } -- | A convenient synonym for creating forms. @@ -285,21 +285,9 @@ defaultLinks = -- Define the menu items of the header. , menuItemRoute = HomeR , menuItemAccessCallback = return True } - , NavbarLeft $ MenuItem - { menuItemLabel = "Kurse" - , menuItemIcon = Just "book" - , menuItemRoute = CourseListR - , menuItemAccessCallback = return True - } - , NavbarLeft $ MenuItem - { menuItemLabel = "Users" - , menuItemIcon = Just "user" - , menuItemRoute = UsersR - , menuItemAccessCallback = return True -- Creates a LOOP: (Authorized ==) <$> isAuthorized UsersR False - } , NavbarRight $ MenuItem { menuItemLabel = "Profile" - , menuItemIcon = Just "user" + , menuItemIcon = Just "profile" , menuItemRoute = ProfileR , menuItemAccessCallback = isJust <$> maybeAuthPair } @@ -315,6 +303,30 @@ defaultLinks = -- Define the menu items of the header. , menuItemRoute = AuthR LogoutR , menuItemAccessCallback = isJust <$> maybeAuthPair } + , NavbarAside $ MenuItem + { menuItemLabel = "Aktuelle Veranstaltungen" + , menuItemIcon = Just "book" + , menuItemRoute = CourseListR -- should be CourseListActiveR or similar in the future + , menuItemAccessCallback = return True + } + , NavbarAside $ MenuItem + { menuItemLabel = "Alte Veranstaltungen" + , menuItemIcon = Just "book" + , menuItemRoute = CourseListR -- should be CourseListInactiveR or similar in the future + , menuItemAccessCallback = return True + } + , NavbarAside $ MenuItem + { menuItemLabel = "Veranstaltungen" + , menuItemIcon = Just "book" + , menuItemRoute = CourseListR + , menuItemAccessCallback = return True + } + , NavbarAside $ MenuItem + { menuItemLabel = "Benutzer" + , menuItemIcon = Just "user" + , menuItemRoute = UsersR + , menuItemAccessCallback = return True -- Creates a LOOP: (Authorized ==) <$> isAuthorized UsersR False + } ] defaultLinkLayout :: [MenuTypes] -> Widget -> Handler Html @@ -348,6 +360,7 @@ defaultMenuLayout menu widget = do pc <- widgetToPageContent $ do addStylesheetRemote "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,800,900" + addScript $ StaticR js_featureChecker_js addStylesheet $ StaticR css_fonts_css addStylesheet $ StaticR css_icons_css $(widgetFile "default-layout") diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index 75767a26a..fc5e9c204 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -64,7 +64,7 @@ getCourseListTermR tidini = do ) ] let pageLinks = - [ NavbarLeft $ MenuItem + [ NavbarAside $ MenuItem { menuItemLabel = "Neuer Kurs" , menuItemIcon = Just "book" , menuItemRoute = CourseEditR diff --git a/src/Handler/Term.hs b/src/Handler/Term.hs index 3eee14c4e..6fa1ae646 100644 --- a/src/Handler/Term.hs +++ b/src/Handler/Term.hs @@ -77,7 +77,7 @@ getTermShowR = do } defaultLayout $ do setTitle "Freigeschaltete Semester" - table + $(widgetFile "terms") getTermEditR :: Handler Html getTermEditR = do diff --git a/static/css/icons.css b/static/css/icons.css index 43753b4d0..b836de6e3 100644 --- a/static/css/icons.css +++ b/static/css/icons.css @@ -1,13 +1,14 @@ .glyphicon { + position: relative; display: inline-block; width: 40px; height: 40px; - line-height: 40px; } .glyphicon::before { position: absolute; - left: 4px; - margin: 0 13px; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); font-family: 'Glyphicons Halflings'; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -19,6 +20,9 @@ .glyphicon--book::before { content: '\e043'; } +.glyphicon--profile::before { + content: '\e019'; +} .glyphicon--user::before { content: '\e008'; } diff --git a/static/js/featureChecker.js b/static/js/featureChecker.js new file mode 100644 index 000000000..a3a21e663 --- /dev/null +++ b/static/js/featureChecker.js @@ -0,0 +1,7 @@ +window.addEventListener('touchstart', function onFirstTouch() { + // we could use a class + document.body.classList.add('touch-supported'); + + // we only need to know once that a human touched the screen, so we can stop listening now + window.removeEventListener('touchstart', onFirstTouch, false); +}, false); diff --git a/templates/courses.hamlet b/templates/courses.hamlet index 56a9134b6..e4f6fb292 100644 --- a/templates/courses.hamlet +++ b/templates/courses.hamlet @@ -1,6 +1,7 @@

Kursübersicht für Semester #{termToText $ unTermKey tidini} - ^{coursesTable} +
+ ^{coursesTable}
Neuen Kurs anlegen diff --git a/templates/default-layout.lucius b/templates/default-layout.lucius index cbbf4437b..c324b2efc 100644 --- a/templates/default-layout.lucius +++ b/templates/default-layout.lucius @@ -63,14 +63,10 @@ body { a, a:visited { - color: var(--darkbase); text-decoration: none; font-weight: 600; transition: color .2s ease, background-color .2s ease; } -a:hover { - color: var(--lightbase); -} ul { list-style-type: none; @@ -101,8 +97,13 @@ h4 { } table { margin: 21px 0; - /*width: 100%;*/ } + +.scrolltable { + width: 100%; + overflow: auto; +} + th, td { text-align: left; padding: 0 13px 0 7px; @@ -119,17 +120,17 @@ th { /* LAYOUT */ .main { display: flex; - padding-right: 5vw; min-height: calc(100vh - var(--header-height)); + overflow: hidden; } .main__content { position: relative; background-color: white; padding: 0 40px; - padding-right: 0; flex: 1; z-index: 0; + overflow: hidden; > .container { margin: 20px 0; @@ -138,6 +139,14 @@ th { p { margin: 10px 0; } + + a { + color: var(--darkbase); + } + + a:hover { + color: var(--lightbase); + } } .pseudo-focus { diff --git a/templates/standalone/showHide.lucius b/templates/standalone/showHide.lucius index 9c7df13d3..9a0a540cf 100644 --- a/templates/standalone/showHide.lucius +++ b/templates/standalone/showHide.lucius @@ -36,9 +36,14 @@ } .js-show-hide__target { - + transition: all .2s ease; + overflow: hidden; } .js-show-hide--collapsed > .js-show-hide__target { - display: none; + display: block; + height: 0; + margin: 0; + padding: 0; + max-height: 0; } diff --git a/templates/terms.hamlet b/templates/terms.hamlet new file mode 100644 index 000000000..d327861ab --- /dev/null +++ b/templates/terms.hamlet @@ -0,0 +1,5 @@ +
+

Semesterübersicht + +
+ ^{table} diff --git a/templates/widgets/asidenav.hamlet b/templates/widgets/asidenav.hamlet index 43c52c45b..1a507da3c 100644 --- a/templates/widgets/asidenav.hamlet +++ b/templates/widgets/asidenav.hamlet @@ -4,17 +4,29 @@