diff --git a/src/Foundation.hs b/src/Foundation.hs index b6741cf0d..037d2607f 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -82,6 +82,7 @@ mkYesodData "UniWorX" $(parseRoutesFile "routes") data MenuItem = MenuItem { menuItemLabel :: Text + , menuItemIcon :: Maybe Text , menuItemRoute :: Route UniWorX , menuItemAccessCallback :: Handler Bool } @@ -280,31 +281,37 @@ defaultLinks :: [MenuTypes] defaultLinks = -- Define the menu items of the header. [ NavbarRight $ MenuItem { menuItemLabel = "Home" + , menuItemIcon = Just "home" , 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" , menuItemRoute = ProfileR , menuItemAccessCallback = isJust <$> maybeAuthPair } , NavbarSecondary $ MenuItem { menuItemLabel = "Login" + , menuItemIcon = Just "login" , menuItemRoute = AuthR LoginR , menuItemAccessCallback = isNothing <$> maybeAuthPair } , NavbarSecondary $ MenuItem { menuItemLabel = "Logout" + , menuItemIcon = Just "logout" , menuItemRoute = AuthR LogoutR , menuItemAccessCallback = isJust <$> maybeAuthPair } @@ -341,11 +348,19 @@ defaultMenuLayout menu widget = do pc <- widgetToPageContent $ do addStylesheetRemote "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,800,900" + addStylesheet $ StaticR css_fonts_css + addStylesheet $ StaticR css_icons_css $(widgetFile "default-layout") $(widgetFile "standalone/showHide") $(widgetFile "standalone/sortable") $(widgetFile "standalone/inputs") withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet") + where + iconToText :: Maybe Text -> Text + iconToText mText = + "" ++ case mText of + Nothing -> "" + Just text -> text -- How to run database actions. instance YesodPersist UniWorX where diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index 9514b1fa0..75767a26a 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -66,6 +66,7 @@ getCourseListTermR tidini = do let pageLinks = [ NavbarLeft $ MenuItem { menuItemLabel = "Neuer Kurs" + , menuItemIcon = Just "book" , menuItemRoute = CourseEditR , menuItemAccessCallback = (== Authorized) <$> isAuthorized CourseEditR False } diff --git a/static/css/fonts.css b/static/css/fonts.css new file mode 100644 index 000000000..a9eab1ffb --- /dev/null +++ b/static/css/fonts.css @@ -0,0 +1,9 @@ +@font-face { + font-family: 'Glyphicons Halflings'; + src: url('../fonts/glyphicons-halflings-regular.eot'); + src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), + url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), + url('../fonts/glyphicons-halflings-regular.woff') format('woff'), + url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), + url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); +} diff --git a/static/css/icons.css b/static/css/icons.css new file mode 100644 index 000000000..1d710600a --- /dev/null +++ b/static/css/icons.css @@ -0,0 +1,24 @@ +.glyphicon::before { + position: absolute; + left: 4px; + margin: 0 13px; + font-family: 'Glyphicons Halflings'; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.glyphicon--home::before { + content: '\e021'; +} +.glyphicon--book::before { + content: '\e043'; +} +.glyphicon--user::before { + content: '\e008'; +} +.glyphicon--login::before { + content: '\e161'; +} +.glyphicon--logout::before { + content: '\e163'; +} diff --git a/templates/widgets/asidenav.hamlet b/templates/widgets/asidenav.hamlet index ee6fee3de..cb37d9e23 100644 --- a/templates/widgets/asidenav.hamlet +++ b/templates/widgets/asidenav.hamlet @@ -6,13 +6,13 @@ $case menuType $of NavbarLeft (MenuItem label icon route _)
  • - #{label} + #{label} $of _

    WiSe 17/18 -