diff --git a/messages/uniworx/de.msg b/messages/uniworx/de.msg index be30c01cf..f620cecf7 100644 --- a/messages/uniworx/de.msg +++ b/messages/uniworx/de.msg @@ -208,6 +208,7 @@ CorByProportionOnly proportion@Rational: #{display proportion} Anteile CorByProportionIncludingTutorial proportion@Rational: #{display proportion} Anteile - Tutorium CorByProportionExcludingTutorial proportion@Rational: #{display proportion} Anteile + Tutorium +RowCount count@Int64: #{display count} #{pluralDE count "Eintrag" "Einträge"} insgesamt DeleteRow: Zeile entfernen ProportionNegative: Anteile dürfen nicht negativ sein CorrectorUpdated: Korrektor erfolgreich aktualisiert @@ -241,7 +242,7 @@ MultiFileUploadInfo: (Mehrere Dateien mit Shift oder Strg auswählen) NrColumn: Nr SelectColumn: Auswahl -DBTablePagesize: Einträge +DBTablePagesize: Einträge pro Seite DBTablePagesizeAll: Alle CorrDownload: Herunterladen @@ -610,4 +611,4 @@ DeleteCopyStringIfSure n@Int: Wenn Sie sich sicher sind, dass Sie #{pluralDE n " DeleteConfirmation: Bestätigung DeleteConfirmationWrong: Bestätigung muss genau dem angezeigten Text entsprechen. -DBTIRowsMissing n@Int: #{pluralDE n "Eine Zeile ist" "Einige Zeile sind"} aus der Datenbank verschwunden, seit das Formular für Sie generiert wurde \ No newline at end of file +DBTIRowsMissing n@Int: #{pluralDE n "Eine Zeile ist" "Einige Zeile sind"} aus der Datenbank verschwunden, seit das Formular für Sie generiert wurde diff --git a/src/Handler/Utils/Table/Pagination.hs b/src/Handler/Utils/Table/Pagination.hs index 9b205b1a9..368758bea 100644 --- a/src/Handler/Utils/Table/Pagination.hs +++ b/src/Handler/Utils/Table/Pagination.hs @@ -602,11 +602,11 @@ dbTable PSValidator{..} dbtable@DBTable{ dbtIdent = dbtIdent'@(toPathPiece -> db | otherwise = def + referencePagesize = psLimit . snd . runPSValidator dbtable $ Just prevPi + (((filterRes, filterWdgt), filterEnc), ((pagesizeRes, pagesizeWdgt), pagesizeEnc)) <- mdo (filterRes'@((filterRes, _), _)) <- runFormGet . identForm FIDDBTableFilter . addPIHiddenField dbtable (prevPi & _piFilter .~ Nothing & _piPage .~ Nothing & _piLimit .~ (formResult' pagesizeRes <|> piLimit prevPi)) . renderAForm FormDBTableFilter $ dbtFilterUI (piFilter prevPi) - let referencePagesize = psLimit . snd . runPSValidator dbtable $ Just prevPi - (pagesizeRes'@((pagesizeRes, _), _)) <- lift . runFormGet . identForm FIDDBTablePagesize . addPIHiddenField dbtable (prevPi & _piPage .~ Nothing & _piLimit .~ Nothing & _piFilter .~ (formResult' filterRes <|> piFilter prevPi)) . renderAForm FormDBTablePagesize $ areq (pagesizeField referencePagesize) (fslI MsgDBTablePagesize & addAutosubmit & addName (wIdent "pagesize") & addClass "select--pagesize") (Just referencePagesize) <* autosubmitButton @@ -760,6 +760,15 @@ dbColonnade :: (Headedness h, Monoid x) -> Colonnade h r (DBCell (ReaderT SqlBackend (HandlerT UniWorX IO)) x) dbColonnade = id +pagesizeOptions :: PagesizeLimit -- ^ Current/previous value + -> NonNull [PagesizeLimit] +pagesizeOptions psLim = impureNonNull . Set.toAscList . Set.fromList $ psLim : PagesizeAll : map PagesizeLimit opts + where + opts :: [Int64] + opts = filter (> 0) $ opts' <> map (`div` 2) opts' + + opts' = [ 10^n | n <- [1..3]] + pagesizeField :: PagesizeLimit -> Field Handler PagesizeLimit pagesizeField psLim = selectField $ do MsgRenderer mr <- getMsgRenderer @@ -767,16 +776,9 @@ pagesizeField psLim = selectField $ do optText (PagesizeLimit l) = tshow l optText PagesizeAll = mr MsgDBTablePagesizeAll - toOptionList = flip OptionList fromPathPiece . map (\o -> Option (optText o) o $ toPathPiece o) . Set.toAscList . Set.fromList - return $ toOptionList limOpts - where - limOpts :: [PagesizeLimit] - limOpts = psLim : PagesizeAll : map PagesizeLimit opts + toOptionList = flip OptionList fromPathPiece . map (\o -> Option (optText o) o $ toPathPiece o) + return . toOptionList . toNullable $ pagesizeOptions psLim - opts :: [Int64] - opts = filter (> 0) $ opts' <> map (`div` 2) opts' - - opts' = [ 10^n | n <- [1..3]] --- DBCell utility functions diff --git a/templates/courses.hamlet b/templates/courses.hamlet index cc9106b21..6cc6a0c13 100644 --- a/templates/courses.hamlet +++ b/templates/courses.hamlet @@ -1,3 +1,2 @@