feat(course material): merge-request suggestions
This commit is contained in:
parent
86234e9624
commit
dc5fc3f710
@ -31,4 +31,4 @@ MaterialFree: Kursmaterialien ohne Anmeldung zugänglich
|
||||
AccessibleSince: Verfügbar seit
|
||||
VisibleFrom: Veröffentlicht
|
||||
FilterMaterialNameSearch !ident-ok: Name
|
||||
FilterMaterialTypeAndDescriptionSearch: Art und Beschreibung
|
||||
FilterMaterialTypeAndDescriptionSearch: Art/Beschreibung
|
||||
@ -31,4 +31,4 @@ MaterialFree: Course material is publicly available.
|
||||
AccessibleSince: Accessible since
|
||||
VisibleFrom: Published
|
||||
FilterMaterialNameSearch !ident-ok: Name
|
||||
FilterMaterialTypeAndDescriptionSearch: Type and description
|
||||
FilterMaterialTypeAndDescriptionSearch: Type/description
|
||||
@ -106,7 +106,7 @@ getMaterialListR tid ssh csh = do
|
||||
E.where_ $ material E.^. MaterialCourse E.==. E.val cid
|
||||
E.&&. E.not_ (E.isNothing $ material E.^. MaterialType)
|
||||
return $ material E.^. MaterialType
|
||||
return . mkOptionList $ map (\t -> Option t t t) (map CI.original (Set.toAscList (Set.fromList (mapMaybe E.unValue previouslyUsed))))
|
||||
return . mkOptionList . map (\(CI.original -> t) -> Option t t t) . Set.toAscList . Set.fromList $ mapMaybe E.unValue previouslyUsed
|
||||
let row2material = view $ _dbrOutput . _1 . _entityVal
|
||||
psValidator = def & defaultSorting [SortDescBy "last-edit"]
|
||||
& forceFilter "may-access" (Any True)
|
||||
@ -148,15 +148,15 @@ getMaterialListR tid ssh csh = do
|
||||
, ( "last-edit" , SortColumn (E.^. MaterialLastEdit) )
|
||||
]
|
||||
, dbtFilter = mconcat
|
||||
[ (singletonMap "may-access" . mkFilterProjectedPost $ \(Any b) dbr
|
||||
-> (== b) <$> hasReadAccessTo (matLink . materialName $ row2material dbr) :: DB Bool)
|
||||
, (singletonMap "name". FilterColumn $ \material criterion -> case getLast (criterion :: Last Text) of
|
||||
[ singletonMap "may-access" . mkFilterProjectedPost $ \(Any b) dbr
|
||||
-> (== b) <$> hasReadAccessTo (matLink . materialName $ row2material dbr) :: DB Bool
|
||||
, singletonMap "name". FilterColumn $ \material criterion -> case getLast (criterion :: Last Text) of
|
||||
Nothing -> E.val True :: E.SqlExpr (E.Value Bool)
|
||||
Just needle -> (E.castString (material E.^. MaterialName) `E.ilike` (E.%) E.++. E.val needle E.++. (E.%)))
|
||||
, (singletonMap "type-and-description". FilterColumn $ \material criterion -> case getLast (criterion :: Last Text) of
|
||||
Just needle -> (E.castString (material E.^. MaterialName) `E.ilike` (E.%) E.++. E.val needle E.++. (E.%))
|
||||
, singletonMap "type-and-description". FilterColumn $ \material criterion -> case getLast (criterion :: Last Text) of
|
||||
Nothing -> E.val True :: E.SqlExpr (E.Value Bool)
|
||||
Just needle -> (E.maybe (E.val mempty) E.castString (material E.^. MaterialType) `E.ilike` (E.%) E.++. E.val needle E.++. (E.%))
|
||||
E.||. (E.maybe (E.val mempty) (E.castString.esqueletoMarkupOutput) (material E.^. MaterialDescription) `E.ilike` (E.%) E.++. E.val needle E.++. (E.%)))
|
||||
E.||. (E.maybe (E.val mempty) (E.castString.esqueletoMarkupOutput) (material E.^. MaterialDescription) `E.ilike` (E.%) E.++. E.val needle E.++. (E.%))
|
||||
]
|
||||
, dbtFilterUI = \mPrev -> mconcat $ catMaybes
|
||||
[ Just $ prismAForm (singletonFilter "name") mPrev $ aopt textField (fslI MsgFilterMaterialNameSearch)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user