PageActions added
This commit is contained in:
parent
5f6640148c
commit
9f96e6dd35
@ -18,11 +18,10 @@
|
|||||||
- i18n der
|
- i18n der
|
||||||
Links -> MenuItems verwenden wie bisher
|
Links -> MenuItems verwenden wie bisher
|
||||||
Page Titles -> setTitleI
|
Page Titles -> setTitleI
|
||||||
Buttons?
|
Buttons? -> Kann leicht geändert werden!
|
||||||
Was ist mit einfachen Text Feldern, z.B. die Beschriftung von Knöpfen wie in Handler.Course.getCourseListTermR, Zeile 66 "pageActions" für menuItemLabel?
|
Was ist mit einfachen Text Feldern, z.B. die Beschriftung von Knöpfen wie in Handler.Course.getCourseListTermR, Zeile 66 "pageActions" für menuItemLabel?
|
||||||
|
|
||||||
** Page pageActions
|
** Page pageActions - Berechtigungen prüfen?
|
||||||
- Berechtigungen prüfen?
|
|
||||||
=> Eigener Constructor statt NavbarLeft/Right?!
|
=> Eigener Constructor statt NavbarLeft/Right?!
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
28
routes
28
routes
@ -6,27 +6,29 @@
|
|||||||
|
|
||||||
/ HomeR GET POST
|
/ HomeR GET POST
|
||||||
/profile ProfileR GET
|
/profile ProfileR GET
|
||||||
/users UsersR GET
|
/users UsersR GET !adminAny
|
||||||
|
|
||||||
/term TermShowR GET
|
/term TermShowR GET
|
||||||
/term/edit TermEditR GET POST
|
/term/edit TermEditR GET POST !adminAny
|
||||||
/term/#TermId/edit TermEditExistR GET
|
/term/#TermId/edit TermEditExistR GET !adminAny
|
||||||
|
|
||||||
/course/ CourseListR GET
|
/course/ CourseListR GET
|
||||||
!/course/new CourseNewR GET POST
|
!/course/new CourseNewR GET POST !lecturerAny
|
||||||
!/course/#TermId CourseListTermR GET
|
!/course/#TermId CourseListTermR GET
|
||||||
/course/#TermId/#Text CourseR:
|
/course/#TermId/#Text CourseR:
|
||||||
/show CourseShowR GET POST
|
/show CourseShowR GET POST
|
||||||
/edit CourseEditR GET POST
|
/edit CourseEditR GET POST !lecturer
|
||||||
|
|
||||||
/ex SheetR !registered:
|
/ex SheetR !registered:
|
||||||
/ SheetListR GET
|
/ SheetListR GET
|
||||||
/new SheetNewR GET POST !lecturer
|
/#Text/show SheetShowR GET !time
|
||||||
/#Text/show SheetShowR GET
|
/#Text/#SheetFileType/#FilePath SheetFileR GET !time
|
||||||
/#Text/#SheetFileType/#FilePath SheetFileR GET
|
/new SheetNewR GET POST !lecturer
|
||||||
/#Text/edit SheetEditR GET POST !lecturer
|
/#Text/edit SheetEditR GET POST !lecturer
|
||||||
/#Text/delete SheetDelR GET POST !lecturer
|
/#Text/delete SheetDelR GET POST !lecturer
|
||||||
|
|
||||||
|
|
||||||
|
-- TODO below
|
||||||
/submission SubmissionListR GET POST
|
/submission SubmissionListR GET POST
|
||||||
/submission/#CryptoUUIDSubmission SubmissionR GET POST
|
/submission/#CryptoUUIDSubmission SubmissionR GET POST
|
||||||
/submissions.zip SubmissionDownloadMultiArchiveR POST
|
/submissions.zip SubmissionDownloadMultiArchiveR POST
|
||||||
|
|||||||
@ -95,11 +95,13 @@ data MenuItem = MenuItem
|
|||||||
, menuItemAccessCallback :: Handler Bool
|
, menuItemAccessCallback :: Handler Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
data MenuTypes
|
data MenuTypes -- Semantische Rolle:
|
||||||
= NavbarAside { menuItem :: MenuItem }
|
= NavbarAside { menuItem :: MenuItem } -- TODO
|
||||||
| NavbarRight { menuItem :: MenuItem }
|
| NavbarExtra { menuItem :: MenuItem } -- TODO
|
||||||
| NavbarExtra { menuItem :: MenuItem }
|
| NavbarRight { menuItem :: MenuItem } -- Generell, nahezu immer sichtbar
|
||||||
| NavbarSecondary { menuItem :: MenuItem }
|
| NavbarSecondary { menuItem :: MenuItem } -- Generell, nahezu immer sichtbar
|
||||||
|
| PageActionPrime { menuItem :: MenuItem } -- Seitenspezifische Aktion, häufig
|
||||||
|
| PageActionSecondary { menuItem :: MenuItem } -- Seitenspezifische Aktion, selten
|
||||||
|
|
||||||
-- | Convenient Type Synonyms:
|
-- | Convenient Type Synonyms:
|
||||||
type DB a = YesodDB UniWorX a
|
type DB a = YesodDB UniWorX a
|
||||||
@ -205,6 +207,12 @@ instance Yesod UniWorX where
|
|||||||
makeLogger = return . appLogger
|
makeLogger = return . appLogger
|
||||||
|
|
||||||
isAuthorizedDB :: Route UniWorX -> Bool -> YesodDB UniWorX AuthResult
|
isAuthorizedDB :: Route UniWorX -> Bool -> YesodDB UniWorX AuthResult
|
||||||
|
isAuthorizedDB route@(routeAttrs -> attrs) writeable
|
||||||
|
| "adminAny" `member` attrs = adminAccess Nothing
|
||||||
|
| "lecturerAny" `member` attrs = lecturerAccess Nothing
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
isAuthorizedDB UsersR _ = adminAccess Nothing
|
isAuthorizedDB UsersR _ = adminAccess Nothing
|
||||||
isAuthorizedDB (SubmissionR cID) _ = submissionAccess $ Right cID
|
isAuthorizedDB (SubmissionR cID) _ = submissionAccess $ Right cID
|
||||||
isAuthorizedDB (SubmissionDownloadSingleR cID _) _ = submissionAccess $ Right cID
|
isAuthorizedDB (SubmissionDownloadSingleR cID _) _ = submissionAccess $ Right cID
|
||||||
|
|||||||
@ -166,11 +166,11 @@ getSheetList courseEnt = do
|
|||||||
, headed "Abgabe ab" $ toWgt . formatTimeGerWD . sheetActiveFrom . snd3
|
, headed "Abgabe ab" $ toWgt . formatTimeGerWD . sheetActiveFrom . snd3
|
||||||
, headed "Abgabe bis" $ toWgt . formatTimeGerWD . sheetActiveTo . snd3
|
, headed "Abgabe bis" $ toWgt . formatTimeGerWD . sheetActiveTo . snd3
|
||||||
, headed "Bewertung" $ toWgt . show . sheetType . snd3
|
, headed "Bewertung" $ toWgt . show . sheetType . snd3
|
||||||
, headed "Korrigiert" $ toWgt . snd . trd3
|
|
||||||
, headed "Eingereicht" $ toWgt . fst . trd3
|
|
||||||
]
|
]
|
||||||
let colAdmin = mconcat -- only show edit button for allowed course assistants
|
let colAdmin = mconcat -- only show edit button for allowed course assistants
|
||||||
[ headed "" $ \s -> linkButton "Edit" BCLink $ CourseR tid csh $ SheetR $ SheetEditR $ sheetName $ snd3 s
|
[ headed "Korrigiert" $ toWgt . snd . trd3
|
||||||
|
, headed "Eingereicht" $ toWgt . fst . trd3
|
||||||
|
, headed "" $ \s -> linkButton "Edit" BCLink $ CourseR tid csh $ SheetR $ SheetEditR $ sheetName $ snd3 s
|
||||||
, headed "" $ \s -> linkButton "Delete" BCLink $ CourseR tid csh $ SheetR $ SheetDelR $ sheetName $ snd3 s
|
, headed "" $ \s -> linkButton "Delete" BCLink $ CourseR tid csh $ SheetR $ SheetDelR $ sheetName $ snd3 s
|
||||||
]
|
]
|
||||||
showAdmin <- case sheets of
|
showAdmin <- case sheets of
|
||||||
@ -182,7 +182,7 @@ getSheetList courseEnt = do
|
|||||||
then colBase `mappend` colAdmin
|
then colBase `mappend` colAdmin
|
||||||
else colBase
|
else colBase
|
||||||
let pageActions =
|
let pageActions =
|
||||||
[ NavbarAside $ MenuItem
|
[ PageActionPrime $ MenuItem
|
||||||
{ menuItemLabel = "Neues Übungsblatt"
|
{ menuItemLabel = "Neues Übungsblatt"
|
||||||
, menuItemIcon = Nothing
|
, menuItemIcon = Nothing
|
||||||
, menuItemRoute = CSheetR tid csh SheetNewR
|
, menuItemRoute = CSheetR tid csh SheetNewR
|
||||||
|
|||||||
@ -10,6 +10,12 @@
|
|||||||
$if isJust mIcon
|
$if isJust mIcon
|
||||||
<div .glyphicon.glyphicon--#{fromMaybe "" mIcon}>
|
<div .glyphicon.glyphicon--#{fromMaybe "" mIcon}>
|
||||||
<div .asidenav__link-label>#{label}
|
<div .asidenav__link-label>#{label}
|
||||||
|
$of PageActionPrime (MenuItem label mIcon route _)
|
||||||
|
<li .asidenav__list-item :Just route == mcurrentRoute:.asidenav__list-item--active>
|
||||||
|
<a .asidenav__link-wrapper href=@{route}>
|
||||||
|
$if isJust mIcon
|
||||||
|
<div .glyphicon.glyphicon--#{fromMaybe "" mIcon}>
|
||||||
|
<div .asidenav__link-label>#{label}
|
||||||
$of _
|
$of _
|
||||||
|
|
||||||
<div .asidenav__box--dont-hide>
|
<div .asidenav__box--dont-hide>
|
||||||
|
|||||||
Reference in New Issue
Block a user