From 6a85cbdf383e2b19b459481755c6bb6b23a02bac Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Tue, 16 Apr 2019 17:56:31 +0200 Subject: [PATCH 01/30] Hinweise zum Korrektur-Upload --- messages/uniworx/de.msg | 2 +- src/Handler/Corrections.hs | 4 +++- src/Handler/Sheet.hs | 9 ++++---- .../corrections-upload-instructions/de.hamlet | 22 +++++++++++++++++++ templates/corrections-upload.hamlet | 5 ++++- 5 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 templates/corrections-upload-instructions/de.hamlet diff --git a/messages/uniworx/de.msg b/messages/uniworx/de.msg index 980015007..bd11b5726 100644 --- a/messages/uniworx/de.msg +++ b/messages/uniworx/de.msg @@ -255,7 +255,7 @@ CorByProportionIncludingTutorial proportion@Rational: #{display proportion} Ante CorByProportionExcludingTutorial proportion@Rational: #{display proportion} Anteile + Tutorium RowCount count@Int64: #{display count} #{pluralDE count "Eintrag" "Einträge"} nach Filter -DeleteRow: Zeile entfernen +DeleteRow: Entfernen ProportionNegative: Anteile dürfen nicht negativ sein CorrectorUpdated: Korrektor erfolgreich aktualisiert CorrectorsUpdated: Korrektoren erfolgreich aktualisiert diff --git a/src/Handler/Corrections.hs b/src/Handler/Corrections.hs index 42c21d62a..2a3a2b89a 100644 --- a/src/Handler/Corrections.hs +++ b/src/Handler/Corrections.hs @@ -724,7 +724,9 @@ postCorrectionsUploadR = do , formEncoding = uploadEncoding } - defaultLayout + + defaultLayout $ do + let uploadInstruction = $(i18nWidgetFile "corrections-upload-instructions") $(widgetFile "corrections-upload") getCorrectionsCreateR, postCorrectionsCreateR :: Handler Html diff --git a/src/Handler/Sheet.hs b/src/Handler/Sheet.hs index cc5bc7718..39b2effd9 100644 --- a/src/Handler/Sheet.hs +++ b/src/Handler/Sheet.hs @@ -738,11 +738,11 @@ correctorForm shid = do let corrColonnade = mconcat - [ headed (Yesod.textCell $ mr MsgCorrector) $ \CorrectorForm{..} -> Yesod.textCell cfUserName - , headed (Yesod.textCell $ mr MsgCorState) $ \CorrectorForm{..} -> Yesod.cell $ fvInput cfViewState - , headed (Yesod.textCell $ mr MsgCorByTut) $ \CorrectorForm{..} -> Yesod.cell $ fvInput cfViewByTut + [ headed (Yesod.textCell $ mr MsgCorrector) $ \CorrectorForm{..} -> Yesod.textCell cfUserName + , headed (Yesod.textCell $ mr MsgCorState) $ \CorrectorForm{..} -> Yesod.cell $ fvInput cfViewState + , headed (Yesod.textCell $ mr MsgCorByTut) $ \CorrectorForm{..} -> Yesod.cell $ fvInput cfViewByTut , headed (Yesod.textCell $ mr MsgCorProportion) $ \CorrectorForm{..} -> Yesod.cell $ fvInput cfViewProp - , headed (Yesod.textCell $ mr MsgDeleteRow) $ \CorrectorForm{..} -> Yesod.cell $ fvInput cfViewDel + , headed (Yesod.textCell $ mr MsgDeleteRow) $ \CorrectorForm{..} -> Yesod.cell $ fvInput cfViewDel ] corrResults | FormSuccess (Just es) <- addTutRes @@ -804,3 +804,4 @@ getSCorrR tid ssh csh shn = do { formAction = Just . SomeRoute $ CSheetR tid ssh csh shn SCorrR , formEncoding = formEnctype } + diff --git a/templates/corrections-upload-instructions/de.hamlet b/templates/corrections-upload-instructions/de.hamlet new file mode 100644 index 000000000..0a04c6c4f --- /dev/null +++ b/templates/corrections-upload-instructions/de.hamlet @@ -0,0 +1,22 @@ +
+

+ Das Hochladen einer Korrekturen markiert die entsprechende + Abgabe automatisch als "korrigiert", falls Ihnen die Abgabe zugeteilt gewesen war. +

+ Lädt jedoch ein Assistent Korrekturen hoch, welche anderen Korrektoren + oder noch nicht zugeteilt wurden, so werden diese Abgaben noch nicht als "korrigiert" markiert. +

+ Es ist geplant, dass die Bewertungsdatei in Zukunft ein eigenes Feld enthält, + in dem Korrektoren angeben können, ob die Korrektur abgeschlossen ist oder nicht. +

+ Im Gegensatz zu UniWorX enthalten die heruntergeladenen Abgaben immer den + aktuellen Stand der Bewertung. Dies betrifft ggf. auch geänderte Dateien! + +

+

+ Bei der Korrektur können Dateien verändert, hinzugefügt und gelöscht werden. + Die Abgebenden werden entsprechend informiert, sobald die Abgabe als "korrigiert" markiert wurde. +

+ Temporäre Dateien einer eventuellen Vorkorrektur müssen also durch das Hochladen der + Korrekturen des letzten Korrektors gelöscht werden, falls diese den Abgabenden + nicht zur Verfügung gestellt werden sollen. diff --git a/templates/corrections-upload.hamlet b/templates/corrections-upload.hamlet index 5a7ac5710..a479c6257 100644 --- a/templates/corrections-upload.hamlet +++ b/templates/corrections-upload.hamlet @@ -1 +1,4 @@ -^{uploadForm} +

+ ^{uploadInstruction} +
+ ^{uploadForm} From 48e42d41e1273c6c59afec7fbdf0dc9a5705c951 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Tue, 23 Apr 2019 22:20:13 +0200 Subject: [PATCH 02/30] add julius file for communication recipientLayout --- templates/widgets/communication/recipientLayout.julius | 1 + 1 file changed, 1 insertion(+) create mode 100644 templates/widgets/communication/recipientLayout.julius diff --git a/templates/widgets/communication/recipientLayout.julius b/templates/widgets/communication/recipientLayout.julius new file mode 100644 index 000000000..d38d48a6d --- /dev/null +++ b/templates/widgets/communication/recipientLayout.julius @@ -0,0 +1 @@ +// TODO: js utility to check all/none of the checkboxes in a recipient category at once From 8e5bebc96fb5639cda30b326be92cea6b3f52d70 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 24 Apr 2019 14:59:31 +0200 Subject: [PATCH 03/30] Workaround library bug disallowing 'none' as PathPiece Fixes #336 --- src/Model/Types.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Model/Types.hs b/src/Model/Types.hs index 527c748f1..c690483a2 100644 --- a/src/Model/Types.hs +++ b/src/Model/Types.hs @@ -342,7 +342,15 @@ data SubmissionModeDescr = SubmissionModeNone instance Universe SubmissionModeDescr instance Finite SubmissionModeDescr -nullaryPathPiece ''SubmissionModeDescr $ camelToPathPiece' 2 +instance PathPiece SubmissionModeDescr where + toPathPiece = (Map.fromList (zip universeF verbs) !) + where + verbs = [ "no-submissions" + , "correctors" + , "users" + , "correctors+users" + ] + fromPathPiece = finiteFromPathPiece classifySubmissionMode :: SubmissionMode -> SubmissionModeDescr classifySubmissionMode (SubmissionMode False Nothing ) = SubmissionModeNone From 816ce0595e2636d98f2c347828e05ad92e029841 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 24 Apr 2019 15:13:06 +0200 Subject: [PATCH 04/30] Cleanup --- src/Model/Types.hs | 38 ++++++++++++++++---------------------- src/Utils/PathPiece.hs | 14 +++++++++++++- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/Model/Types.hs b/src/Model/Types.hs index c690483a2..575d86403 100644 --- a/src/Model/Types.hs +++ b/src/Model/Types.hs @@ -320,19 +320,16 @@ deriveJSON defaultOptions } ''SubmissionMode derivePersistFieldJSON ''SubmissionMode -instance PathPiece SubmissionMode where - toPathPiece = (Map.fromList (zip universeF verbs) !) - where - verbs = [ "no-submissions" - , "no-upload" - , "no-unpack" - , "unpack" - , "correctors" - , "correctors+no-upload" - , "correctors+no-unpack" - , "correctors+unpack" - ] - fromPathPiece = finiteFromPathPiece +finitePathPiece ''SubmissionMode + [ "no-submissions" + , "no-upload" + , "no-unpack" + , "unpack" + , "correctors" + , "correctors+no-upload" + , "correctors+no-unpack" + , "correctors+unpack" + ] data SubmissionModeDescr = SubmissionModeNone | SubmissionModeCorrector @@ -342,15 +339,12 @@ data SubmissionModeDescr = SubmissionModeNone instance Universe SubmissionModeDescr instance Finite SubmissionModeDescr -instance PathPiece SubmissionModeDescr where - toPathPiece = (Map.fromList (zip universeF verbs) !) - where - verbs = [ "no-submissions" - , "correctors" - , "users" - , "correctors+users" - ] - fromPathPiece = finiteFromPathPiece +finitePathPiece ''SubmissionModeDescr + [ "no-submissions" + , "correctors" + , "users" + , "correctors+users" + ] classifySubmissionMode :: SubmissionMode -> SubmissionModeDescr classifySubmissionMode (SubmissionMode False Nothing ) = SubmissionModeNone diff --git a/src/Utils/PathPiece.hs b/src/Utils/PathPiece.hs index 7a391bc01..334133695 100644 --- a/src/Utils/PathPiece.hs +++ b/src/Utils/PathPiece.hs @@ -1,7 +1,7 @@ module Utils.PathPiece ( finiteFromPathPiece , nullaryToPathPiece - , nullaryPathPiece + , nullaryPathPiece, finitePathPiece , splitCamel , camelToPathPiece, camelToPathPiece' , tuplePathPiece @@ -16,6 +16,8 @@ import Data.Universe import qualified Data.Text as Text import qualified Data.Char as Char +import qualified Data.Map as Map + import Numeric.Natural import Data.List (foldl) @@ -44,6 +46,16 @@ nullaryPathPiece nullaryType mangle = , funD 'fromPathPiece [ clause [] (normalB [e|finiteFromPathPiece|]) [] ] ] + +finitePathPiece :: Name -> [Text] -> DecsQ +finitePathPiece finiteType verbs = + pure <$> instanceD (cxt []) [t|PathPiece $(conT finiteType)|] + [ funD 'toPathPiece + [ clause [] (normalB [|(Map.fromList (zip universeF verbs) !)|]) [] ] + , funD 'fromPathPiece + [ clause [] (normalB [e|(Map.fromList (zip verbs universeF) !?)|]) [] ] + ] + splitCamel :: Textual t => t -> [t] splitCamel = map fromList . reverse . helper (error "hasChange undefined at start of string") [] "" . otoList From dc4480431035340459a469de47110f38b2fab9c7 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 24 Apr 2019 16:49:52 +0200 Subject: [PATCH 05/30] Fix build --- src/Utils/PathPiece.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Utils/PathPiece.hs b/src/Utils/PathPiece.hs index 334133695..c7434b54f 100644 --- a/src/Utils/PathPiece.hs +++ b/src/Utils/PathPiece.hs @@ -16,6 +16,7 @@ import Data.Universe import qualified Data.Text as Text import qualified Data.Char as Char +import Data.Map ((!), (!?)) import qualified Data.Map as Map import Numeric.Natural From 5ec553edde99c2490aa97257f9bf9c8e324ad39e Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 24 Apr 2019 16:54:09 +0200 Subject: [PATCH 06/30] Fix build --- src/Model/Types.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Model/Types.hs b/src/Model/Types.hs index 575d86403..ab73b6ba7 100644 --- a/src/Model/Types.hs +++ b/src/Model/Types.hs @@ -16,7 +16,6 @@ import Utils import Control.Lens hiding (universe) import Utils.Lens.TH -import Data.Map ((!)) import Data.Set (Set) import qualified Data.Set as Set import qualified Data.Map as Map From 60c9de44c5c7210a5d9cff5b12c342741abb4c43 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Wed, 24 Apr 2019 19:16:58 +0200 Subject: [PATCH 07/30] special styling for checkboxes in table headers --- static/css/utils/checkbox.scss | 6 ++++++ static/js/utils/checkAll.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/static/css/utils/checkbox.scss b/static/css/utils/checkbox.scss index 9a73b01e7..6db7f97e3 100644 --- a/static/css/utils/checkbox.scss +++ b/static/css/utils/checkbox.scss @@ -74,3 +74,9 @@ filter: grayscale(1); } } + +/* special treatment for checkboxes in table headers */ +th .checkbox { + margin-right: 7px; + vertical-align: bottom; +} diff --git a/static/js/utils/checkAll.js b/static/js/utils/checkAll.js index 86749f2a9..5a15e0ac7 100644 --- a/static/js/utils/checkAll.js +++ b/static/js/utils/checkAll.js @@ -96,9 +96,9 @@ checkAllCheckbox.setAttribute('id', getCheckboxId()); th.insertBefore(checkAllCheckbox, th.firstChild); - // manually set up newly created checkbox + // manually set up new checkbox if (UtilRegistry) { - UtilRegistry.setup(UtilRegistry.find('checkbox')); + UtilRegistry.setup(UtilRegistry.find('checkbox'), th); } checkAllCheckbox.addEventListener('input', onCheckAllCheckboxInput); From 7e7ba291f20981af58c9c67aa339bcd20ae7f95f Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Tue, 23 Apr 2019 13:38:08 +0200 Subject: [PATCH 08/30] wrap recipient form categories in wrapper and only show when necessary --- .../communication/recipientLayout.hamlet | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/templates/widgets/communication/recipientLayout.hamlet b/templates/widgets/communication/recipientLayout.hamlet index c52ff534d..f3f759de1 100644 --- a/templates/widgets/communication/recipientLayout.hamlet +++ b/templates/widgets/communication/recipientLayout.hamlet @@ -1,14 +1,16 @@ $newline never -$forall category <- activeCategories -
- -