diff --git a/models b/models index 90b554663..909a72610 100644 --- a/models +++ b/models @@ -12,6 +12,7 @@ User json UserAdmin user UserId school SchoolId + UniqueUserAdmin user school UserLecturer user UserId school SchoolId diff --git a/src/Foundation.hs b/src/Foundation.hs index 8f56b2117..8a307908b 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -459,7 +459,6 @@ instance Yesod UniWorX where defaultLayout widget = do master <- getYesod mmsgs <- getMessages - messageRender <- getMessageRender -- needed, since there is no i18n interpolation in Julius mcurrentRoute <- getCurrentRoute @@ -493,10 +492,10 @@ instance Yesod UniWorX where in (c, courseRoute, ) <$> filterM (menuItemAccessCallback . menuItem) (pageActions courseRoute) let highlight :: Route UniWorX -> Bool -- highlight last route in breadcrumbs, favorites taking priority - highlight = let crumbs = mcons mcurrentRoute $ fst <$> parents - actFav = List.intersect (snd3 <$> favourites) crumbs - highRs = if null actFav then crumbs else actFav - in \r -> r `elem` highRs + highlight = let crumbs = mcons mcurrentRoute $ fst <$> reverse parents + navItems = map snd3 favourites ++ map (menuItemRoute . menuItem) menuTypes + highR = find (`elem` navItems) . uncurry (++) $ partition (`elem` map snd3 favourites) crumbs + in \r -> Just r == highR favouriteTerms :: [TermIdentifier] favouriteTerms = Set.toDescList $ foldMap (\(Course{..}, _, _) -> Set.singleton $ unTermKey courseTerm) favourites favouriteTerm :: TermIdentifier -> [(Course, Route UniWorX, [MenuTypes])] @@ -655,7 +654,7 @@ submissionList tid csh shn uid = E.select . E.from $ \(course `E.InnerJoin` shee defaultLinks :: [MenuTypes] defaultLinks = -- Define the menu items of the header. - [ NavbarRight $ MenuItem + [ NavbarAside $ MenuItem { menuItemLabel = "Home" , menuItemIcon = Just "home" , menuItemRoute = HomeR diff --git a/src/Handler/Users.hs b/src/Handler/Users.hs index ba2ad0022..9d3965c57 100644 --- a/src/Handler/Users.hs +++ b/src/Handler/Users.hs @@ -13,6 +13,7 @@ import Import import Handler.Utils import qualified Data.Map as Map +import qualified Data.Set as Set import qualified Database.Esqueleto as E @@ -41,7 +42,7 @@ getUsersR = do E.orderBy [E.asc $ school E.^. SchoolShorthand] return $ school E.^. SchoolShorthand return [whamlet| -