Merge branch 'master' into feat/exercises
This commit is contained in:
commit
bf18268e27
@ -309,11 +309,25 @@ knownTags = Map.fromList -- should not throw exceptions, i.e. no getBy404 or req
|
|||||||
Entity cid _ <- MaybeT . getBy $ CourseTermShort tid csh
|
Entity cid _ <- MaybeT . getBy $ CourseTermShort tid csh
|
||||||
Entity _sid Sheet{..} <- MaybeT . getBy $ CourseSheet cid shn
|
Entity _sid Sheet{..} <- MaybeT . getBy $ CourseSheet cid shn
|
||||||
cTime <- liftIO getCurrentTime
|
cTime <- liftIO getCurrentTime
|
||||||
|
let
|
||||||
|
visible = NTop sheetVisibleFrom <= NTop (Just cTime)
|
||||||
|
active = sheetActiveFrom <= cTime && cTime <= sheetActiveTo
|
||||||
|
|
||||||
|
guard visible
|
||||||
|
|
||||||
|
case subRoute of
|
||||||
|
SFileR SheetExercise _ -> guard $ sheetActiveFrom <= cTime
|
||||||
|
SFileR SheetHint _ -> guard $ maybe False (<= cTime) sheetHintFrom
|
||||||
|
SFileR SheetSolution _ -> guard $ maybe False (<= cTime) sheetSolutionFrom
|
||||||
|
SubmissionNewR -> guard active
|
||||||
|
SubmissionR _ _ -> guard active
|
||||||
|
_ -> return ()
|
||||||
|
|
||||||
|
return Authorized
|
||||||
|
|
||||||
let started = sheetActiveFrom <= cTime || NTop sheetVisibleFrom <= (NTop $ Just cTime)
|
let started = sheetActiveFrom <= cTime || NTop sheetVisibleFrom <= (NTop $ Just cTime)
|
||||||
case subRoute of
|
case subRoute of
|
||||||
SFileR SheetExercise _ -> guard started
|
SFileR SheetExercise _ -> guard started
|
||||||
SFileR SheetHint _ -> guard $ maybe False (<= cTime) sheetHintFrom
|
|
||||||
SFileR SheetSolution _ -> guard $ maybe False (<= cTime) sheetSolutionFrom
|
|
||||||
SFileR SheetMarking _ -> mzero -- only for correctors and lecturers
|
SFileR SheetMarking _ -> mzero -- only for correctors and lecturers
|
||||||
SubmissionNewR -> guard $ sheetActiveFrom <= cTime && cTime <= sheetActiveTo
|
SubmissionNewR -> guard $ sheetActiveFrom <= cTime && cTime <= sheetActiveTo
|
||||||
SubmissionR _ _ -> guard $ sheetActiveFrom <= cTime && cTime <= sheetActiveTo
|
SubmissionR _ _ -> guard $ sheetActiveFrom <= cTime && cTime <= sheetActiveTo
|
||||||
@ -720,12 +734,52 @@ pageActions :: Route UniWorX -> [MenuTypes]
|
|||||||
{-
|
{-
|
||||||
Icons: https://fontawesome.com/icons?d=gallery
|
Icons: https://fontawesome.com/icons?d=gallery
|
||||||
Guideline: use icons without boxes/frames, only non-pro
|
Guideline: use icons without boxes/frames, only non-pro
|
||||||
|
|
||||||
|
Please keep sorted according to routes
|
||||||
-}
|
-}
|
||||||
pageActions (CorrectionsR) =
|
pageActions (HomeR) =
|
||||||
|
[
|
||||||
|
-- NavbarAside $ MenuItem
|
||||||
|
-- { menuItemLabel = "Benutzer"
|
||||||
|
-- , menuItemIcon = Just "users"
|
||||||
|
-- , menuItemRoute = UsersR
|
||||||
|
-- , menuItemAccessCallback' = return True
|
||||||
|
-- }
|
||||||
|
-- ,
|
||||||
|
NavbarAside $ MenuItem
|
||||||
|
{ menuItemLabel = "AdminDemo"
|
||||||
|
, menuItemIcon = Just "screwdriver"
|
||||||
|
, menuItemRoute = AdminTestR
|
||||||
|
, menuItemAccessCallback' = return True
|
||||||
|
}
|
||||||
|
]
|
||||||
|
pageActions (ProfileR) =
|
||||||
[ PageActionPrime $ MenuItem
|
[ PageActionPrime $ MenuItem
|
||||||
{ menuItemLabel = "Korrekturen hochladen"
|
{ menuItemLabel = "Gespeicherte Daten anzeigen"
|
||||||
, menuItemIcon = Nothing
|
, menuItemIcon = Just "book"
|
||||||
, menuItemRoute = CorrectionsUploadR
|
, menuItemRoute = ProfileDataR
|
||||||
|
, menuItemAccessCallback' = return True
|
||||||
|
}
|
||||||
|
]
|
||||||
|
pageActions TermShowR =
|
||||||
|
[ PageActionPrime $ MenuItem
|
||||||
|
{ menuItemLabel = "Neues Semester anlegen"
|
||||||
|
, menuItemIcon = Nothing
|
||||||
|
, menuItemRoute = TermEditR
|
||||||
|
, menuItemAccessCallback' = return True
|
||||||
|
}
|
||||||
|
]
|
||||||
|
pageActions (TermCourseListR tid) =
|
||||||
|
[ PageActionPrime $ MenuItem
|
||||||
|
{ menuItemLabel = "Neuen Kurs anlegen"
|
||||||
|
, menuItemIcon = Just "book"
|
||||||
|
, menuItemRoute = CourseNewR
|
||||||
|
, menuItemAccessCallback' = return True
|
||||||
|
}
|
||||||
|
, PageActionPrime $ MenuItem
|
||||||
|
{ menuItemLabel = "Semster editieren"
|
||||||
|
, menuItemIcon = Nothing
|
||||||
|
, menuItemRoute = TermEditExistR tid
|
||||||
, menuItemAccessCallback' = return True
|
, menuItemAccessCallback' = return True
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -826,55 +880,25 @@ pageActions (CSubmissionR tid csh shn cid SubShowR) =
|
|||||||
_ -> return False
|
_ -> return False
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
pageActions TermShowR =
|
pageActions (CSheetR tid csh shn SCorrR) =
|
||||||
[ PageActionPrime $ MenuItem
|
[ PageActionPrime $ MenuItem
|
||||||
{ menuItemLabel = "Neues Semester anlegen"
|
{ menuItemLabel = "Abgaben"
|
||||||
, menuItemIcon = Nothing
|
, menuItemIcon = Nothing
|
||||||
, menuItemRoute = TermEditR
|
, menuItemRoute = CSheetR tid csh shn SSubsR
|
||||||
, menuItemAccessCallback' = return True
|
, menuItemAccessCallback' = return True
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
pageActions (TermCourseListR tid) =
|
pageActions (CorrectionsR) =
|
||||||
[ PageActionPrime $ MenuItem
|
[ PageActionPrime $ MenuItem
|
||||||
{ menuItemLabel = "Neuen Kurs anlegen"
|
{ menuItemLabel = "Korrekturen hochladen"
|
||||||
, menuItemIcon = Just "book"
|
, menuItemIcon = Nothing
|
||||||
, menuItemRoute = CourseNewR
|
, menuItemRoute = CorrectionsUploadR
|
||||||
, menuItemAccessCallback' = return True
|
|
||||||
}
|
|
||||||
, PageActionPrime $ MenuItem
|
|
||||||
{ menuItemLabel = "Semster editieren"
|
|
||||||
, menuItemIcon = Nothing
|
|
||||||
, menuItemRoute = TermEditExistR tid
|
|
||||||
, menuItemAccessCallback' = return True
|
, menuItemAccessCallback' = return True
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
pageActions (ProfileR) =
|
|
||||||
[ PageActionPrime $ MenuItem
|
|
||||||
{ menuItemLabel = "Gespeicherte Daten anzeigen"
|
|
||||||
, menuItemIcon = Just "book"
|
|
||||||
, menuItemRoute = ProfileDataR
|
|
||||||
, menuItemAccessCallback' = return True
|
|
||||||
}
|
|
||||||
]
|
|
||||||
pageActions (HomeR) =
|
|
||||||
[
|
|
||||||
-- NavbarAside $ MenuItem
|
|
||||||
-- { menuItemLabel = "Benutzer"
|
|
||||||
-- , menuItemIcon = Just "users"
|
|
||||||
-- , menuItemRoute = UsersR
|
|
||||||
-- , menuItemAccessCallback' = return True
|
|
||||||
-- }
|
|
||||||
-- ,
|
|
||||||
NavbarAside $ MenuItem
|
|
||||||
{ menuItemLabel = "AdminDemo"
|
|
||||||
, menuItemIcon = Just "screwdriver"
|
|
||||||
, menuItemRoute = AdminTestR
|
|
||||||
, menuItemAccessCallback' = return True
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
pageActions _ = []
|
pageActions _ = []
|
||||||
|
|
||||||
|
|
||||||
i18nHeading :: (MonadWidget m, RenderMessage site msg, HandlerSite m ~ site) => msg -> m ()
|
i18nHeading :: (MonadWidget m, RenderMessage site msg, HandlerSite m ~ site) => msg -> m ()
|
||||||
i18nHeading msg = liftWidgetT $ toWidget =<< getMessageRender <*> pure msg
|
i18nHeading msg = liftWidgetT $ toWidget =<< getMessageRender <*> pure msg
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user