From 9183ff9aa425f684d389799325b752a89985de56 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 12 Oct 2018 20:06:22 +0200 Subject: [PATCH] cleanup --- messages/uniworx/de.msg | 9 +++++- src/Foundation.hs | 8 +++++ src/Handler/Sheet.hs | 6 ++-- templates/correction.hamlet | 17 +++++----- templates/default-layout.lucius | 22 +++++++++++++ templates/sheetShow.hamlet | 55 ++++++++++++++++----------------- 6 files changed, 76 insertions(+), 41 deletions(-) diff --git a/messages/uniworx/de.msg b/messages/uniworx/de.msg index b2527d71f..86bf5c732 100644 --- a/messages/uniworx/de.msg +++ b/messages/uniworx/de.msg @@ -327,10 +327,17 @@ SheetTypeNormal: Normal SheetTypePass: Bestehen SheetTypeNotGraded: Keine Wertung +SheetTypeBonus' maxPoints@Points: #{tshow maxPoints} Bonuspunkte +SheetTypeNormal' maxPoints@Points: #{tshow maxPoints} Punkte +SheetTypePass' maxPoints@Points passingPoints@Points: Bestanden ab #{tshow passingPoints} von #{tshow maxPoints} Punkten +SheetTypeNotGraded': Nicht gewertet + SheetTypeMaxPoints: Maximalpunktzahl SheetTypePassingPoints: Notwendig zum Bestehen SheetGroupArbitrary: Arbiträre Gruppen SheetGroupRegisteredGroups: Registrierte Gruppen SheetGroupNoGroups: Keine Gruppenabgabe -SheetGroupMaxGroupsize: Maximale Gruppengröße \ No newline at end of file +SheetGroupMaxGroupsize: Maximale Gruppengröße + +SheetFiles: Übungsblatt-Dateien \ No newline at end of file diff --git a/src/Foundation.hs b/src/Foundation.hs index e5bf9302b..9b31952a2 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -229,6 +229,14 @@ instance RenderMessage UniWorX Load where (Load {byTutorial=Just False, byProportion=p}) -> renderMessage' $ MsgCorByProportionExcludingTutorial p where renderMessage' = renderMessage foundation ls +instance RenderMessage UniWorX SheetType where + renderMessage foundation ls = \case + Bonus{..} -> renderMessage' $ MsgSheetTypeBonus' maxPoints + Normal{..} -> renderMessage' $ MsgSheetTypeNormal' maxPoints + Pass{..} -> renderMessage' $ MsgSheetTypePass' maxPoints passingPoints + NotGraded{} -> renderMessage' MsgSheetTypeNotGraded' + where renderMessage' = renderMessage foundation ls + newtype MsgLanguage = MsgLanguage Lang deriving (Eq, Ord, Show, Read) instance RenderMessage UniWorX MsgLanguage where diff --git a/src/Handler/Sheet.hs b/src/Handler/Sheet.hs index 510e92117..92aed1fab 100644 --- a/src/Handler/Sheet.hs +++ b/src/Handler/Sheet.hs @@ -57,7 +57,7 @@ import qualified Data.Map as Map import Data.Map (Map, (!), (!?)) import qualified Data.Map as Map -import Data.Monoid (Sum(..)) +import Data.Monoid (Sum(..), Any(..)) import Control.Lens -- import Utils.Lens @@ -273,14 +273,14 @@ getSShowR tid ssh csh shn = do -- return desired columns return $ (file E.^. FileTitle, file E.^. FileModified, sheetFile E.^. SheetFileType) let colonnadeFiles = widgetColonnade $ mconcat - [ sortable (Just "type") "Typ" $ \(_,_, E.Value ftype) -> i18nCell ftype + [ sortable (Just "type") "Typ" $ \(_,_, E.Value ftype) -> i18nCell ftype & cellContents %~ (\act -> act <* tell (Any True)) , sortable (Just "path") "Dateiname" $ anchorCell' (\(E.Value fName,_,E.Value fType) -> CSheetR tid ssh csh shn (SFileR fType fName)) (\(E.Value fName,_,_) -> str2widget fName) , sortable (Just "time") "Modifikation" $ \(_,E.Value modified,_) -> cell $ formatTime SelFormatDateTime (modified :: UTCTime) >>= toWidget ] let psValidator = def & defaultSorting [("type", SortAsc), ("path", SortAsc)] - ((), fileTable) <- dbTable psValidator $ DBTable + (Any hasFiles, fileTable) <- dbTable psValidator $ DBTable { dbtSQLQuery = fileData , dbtColonnade = colonnadeFiles , dbtProj = \DBRow{ dbrOutput = dbrOutput@(E.Value fName, _, E.Value fType) } diff --git a/templates/correction.hamlet b/templates/correction.hamlet index e26dbe7c4..9c5c0ed39 100644 --- a/templates/correction.hamlet +++ b/templates/correction.hamlet @@ -1,11 +1,10 @@ -^{userCorrection} +
+ ^{userCorrection} -
- -
- ^{corrForm} +
+ + ^{corrForm} -
- - - ^{uploadForm} +
+ + ^{uploadForm} diff --git a/templates/default-layout.lucius b/templates/default-layout.lucius index 97968130e..5e682fba2 100644 --- a/templates/default-layout.lucius +++ b/templates/default-layout.lucius @@ -185,6 +185,10 @@ h4 { p { margin: 10px 0; } + + p:last-child { + margin: 10px 0 0; + } } .logged-in { @@ -309,6 +313,10 @@ input[type="button"].btn-info:hover, width: 100%; } +.table:only-child { + margin: 0; +} + .table--striped { .table__row:not(.no-stripe):nth-child(even) { @@ -502,3 +510,17 @@ input[type="button"].btn-info:hover, padding-right: 15px; } } + +section { + padding: 0 0 12px; + margin: 0 0 12px; + border-bottom: 1px solid #d3d3d3; + +} + +section:last-of-type { + padding: 0; + margin: 0; + border-bottom: none; +} + diff --git a/templates/sheetShow.hamlet b/templates/sheetShow.hamlet index 012ada784..47e2014b9 100644 --- a/templates/sheetShow.hamlet +++ b/templates/sheetShow.hamlet @@ -1,33 +1,32 @@ -
- $maybe descr <- sheetDescription sheet -

Hinweise -

#{descr} +$newline never +$maybe descr <- sheetDescription sheet +

+

_{MsgSheetDescription} +

+ #{descr} -

Bewertung -

- #{display $ sheetType sheet} - - $maybe marking <- sheetMarkingText sheet +$maybe marking <- sheetMarkingText sheet +

+

_{MsgSheetMarking}

#{marking} -

- Download und Abgabe freigeschaltet ab - #{sheetFrom} +

+
+
_{MsgSheetActiveFrom} +
#{sheetFrom} +
_{MsgSheetActiveTo} +
#{sheetTo} + $maybe hints <- hintsFrom <* guard hasHints +
_{MsgSheetHintFrom} +
#{hints} + $maybe solution <- solutionFrom <* guard hasSolution +
_{MsgSheetSolutionFrom} +
#{solution} +
_{MsgSheetType} +
_{sheetType sheet} -

- Abgabe bis - #{sheetTo} - - $maybe hints <- hintsFrom <* guard hasHints -

- Hinweise ab - #{hints} - - $maybe solution <- solutionFrom <* guard hasSolution -

- Lösung ab - #{solution} - -

Dateien - ^{fileTable} +$if hasFiles +
+

_{MsgSheetFiles} + ^{fileTable}