diff --git a/routes b/routes index b8f1b3ccf..68b7879f1 100644 --- a/routes +++ b/routes @@ -70,8 +70,8 @@ /correctors SCorrR GET POST !/#SheetFileType/*FilePath SFileR GET !timeANDregistered !timeANDmaterials !corrector -/corrections CorrectionsR GET POST !free -/corrections/upload CorrectionsUploadR GET POST !free +/corrections CorrectionsR GET POST !corrector !lecturer +/corrections/upload CorrectionsUploadR GET POST !corrector !lecturer !/#UUID CryptoUUIDDispatchR GET !free -- just redirect diff --git a/src/Foundation.hs b/src/Foundation.hs index 6b513fb6b..ef5adb693 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -621,7 +621,73 @@ submissionList tid csh shn uid = E.select . E.from $ \(course `E.InnerJoin` shee return $ submission E.^. SubmissionId + + +defaultLinks :: [MenuTypes] +defaultLinks = -- Define the menu items of the header. + [ NavbarRight $ MenuItem + { menuItemLabel = "Home" + , menuItemIcon = Just "home" + , menuItemRoute = HomeR + , menuItemAccessCallback' = return True + } + , NavbarRight $ MenuItem + { menuItemLabel = "Profile" + , menuItemIcon = Just "cogs" + , menuItemRoute = ProfileR + , menuItemAccessCallback' = isJust <$> maybeAuthPair + } + , NavbarSecondary $ MenuItem + { menuItemLabel = "Login" + , menuItemIcon = Just "sign-in-alt" + , menuItemRoute = AuthR LoginR + , menuItemAccessCallback' = isNothing <$> maybeAuthPair + } + , NavbarSecondary $ MenuItem + { menuItemLabel = "Logout" + , menuItemIcon = Just "sign-out-alt" + , menuItemRoute = AuthR LogoutR + , menuItemAccessCallback' = isJust <$> maybeAuthPair + } + , NavbarAside $ MenuItem + { menuItemLabel = "Kurse" + , menuItemIcon = Just "calendar-alt" + , menuItemRoute = CourseListR -- should be CourseListActiveR or similar in the future + , menuItemAccessCallback' = return True + } + , NavbarAside $ MenuItem + { menuItemLabel = "Semester" + , menuItemIcon = Just "graduation-cap" + , menuItemRoute = TermShowR + , menuItemAccessCallback' = return True + } + , NavbarAside $ MenuItem + { menuItemLabel = "Korrekturen" + , menuItemIcon = Just "check" + , menuItemRoute = CorrectionsR + , menuItemAccessCallback' = return True + } + , NavbarAside $ MenuItem + { menuItemLabel = "Benutzer" + , menuItemIcon = Just "users" + , menuItemRoute = UsersR + , menuItemAccessCallback' = return True -- Creates a LOOP: (Authorized ==) <$> isAuthorized UsersR False + } + ] + pageActions :: Route UniWorX -> [MenuTypes] +{- + Icons: https://fontawesome.com/icons?d=gallery + Guideline: use icons without boxes/frames, only non-pro +-} +pageActions (CorrectionsR) = + [ PageActionPrime $ MenuItem + { menuItemLabel = "Korrekturen hochladen" + , menuItemIcon = Nothing + , menuItemRoute = CorrectionsUploadR + , menuItemAccessCallback' = return True + } + ] pageActions (CourseR tid csh CShowR) = [ PageActionPrime $ MenuItem { menuItemLabel = "Kurs Editieren" @@ -749,7 +815,7 @@ pageActions (HomeR) = -- , NavbarAside $ MenuItem { menuItemLabel = "AdminDemo" - , menuItemIcon = Just "book" + , menuItemIcon = Just "screwdriver" , menuItemRoute = AdminTestR , menuItemAccessCallback' = return True } @@ -830,63 +896,6 @@ pageHeading (CSubmissionR tid csh shn cid CorrectionR) pageHeading _ = Nothing -defaultLinks :: [MenuTypes] -defaultLinks = -- Define the menu items of the header. - [ NavbarRight $ MenuItem - { menuItemLabel = "Home" - , menuItemIcon = Just "home" - , menuItemRoute = HomeR - , menuItemAccessCallback' = return True - } - , NavbarRight $ MenuItem - { menuItemLabel = "Profile" - , menuItemIcon = Just "cogs" - , menuItemRoute = ProfileR - , menuItemAccessCallback' = isJust <$> maybeAuthPair - } - , NavbarSecondary $ MenuItem - { menuItemLabel = "Login" - , menuItemIcon = Just "sign-in-alt" - , menuItemRoute = AuthR LoginR - , menuItemAccessCallback' = isNothing <$> maybeAuthPair - } - , NavbarSecondary $ MenuItem - { menuItemLabel = "Logout" - , menuItemIcon = Just "sign-out-alt" - , menuItemRoute = AuthR LogoutR - , menuItemAccessCallback' = isJust <$> maybeAuthPair - } - , NavbarAside $ MenuItem - { menuItemLabel = "Kurse" - , menuItemIcon = Just "calendar-alt" - , menuItemRoute = CourseListR -- should be CourseListActiveR or similar in the future - , menuItemAccessCallback' = return True - } - , NavbarAside $ MenuItem - { menuItemLabel = "Semester" - , menuItemIcon = Just "graduation-cap" - , menuItemRoute = TermShowR - , menuItemAccessCallback' = return True - } - , NavbarAside $ MenuItem - { menuItemLabel = "Korrekturen" - , menuItemIcon = Nothing - , menuItemRoute = CorrectionsR - , menuItemAccessCallback' = return True - } - , NavbarAside $ MenuItem - { menuItemLabel = "Korrekturen hochladen" - , menuItemIcon = Nothing - , menuItemRoute = CorrectionsUploadR - , menuItemAccessCallback' = return True - } - , NavbarAside $ MenuItem - { menuItemLabel = "Benutzer" - , menuItemIcon = Just "users" - , menuItemRoute = UsersR - , menuItemAccessCallback' = return True -- Creates a LOOP: (Authorized ==) <$> isAuthorized UsersR False - } - ] -- How to run database actions. instance YesodPersist UniWorX where diff --git a/templates/home.hamlet b/templates/home.hamlet index 37dcaee0e..67529c3c7 100644 --- a/templates/home.hamlet +++ b/templates/home.hamlet @@ -1,6 +1,4 @@