From ea32fdfa914a929fd7fa6a8e45aeb6cb8d355199 Mon Sep 17 00:00:00 2001 From: Wolfgang Witt Date: Fri, 19 Mar 2021 16:48:42 +0100 Subject: [PATCH] chore: convert buttons to icons --- messages/uniworx/misc/de-de-formal.msg | 4 -- messages/uniworx/misc/en-eu.msg | 4 -- src/Handler/Exam/AutoOccurrence.hs | 8 +++- src/Utils/Icon.hs | 8 ++++ .../widgets/exam-occurrence-mapping.hamlet | 44 ++++++++++++++----- 5 files changed, 49 insertions(+), 19 deletions(-) diff --git a/messages/uniworx/misc/de-de-formal.msg b/messages/uniworx/misc/de-de-formal.msg index 8d74b8cf6..c641af15b 100644 --- a/messages/uniworx/misc/de-de-formal.msg +++ b/messages/uniworx/misc/de-de-formal.msg @@ -2822,10 +2822,6 @@ ExamAutoOccurrenceParticipantsAssigned num@Int64: Verteilungstabelle erfolgreich TitleExamAutoOccurrence tid@TermId ssh@SchoolId csh@CourseShorthand examn@ExamName: #{tid} - #{ssh} - #{csh} #{examn}: Automatische Raum-/Terminverteilung BtnExamAutoOccurrenceCalculate: Verteilungstabelle berechnen BtnExamAutoOccurrenceAccept: Verteilung akzeptieren -BtnExamAutoOccurrenceNudgeUp: + -BtnExamAutoOccurrenceNudgeDown: - -BtnExamAutoOccurrenceIgnore: Ignorieren -BtnExamAutoOccurrenceReconsider: Berücksichtigen ExamRoomMappingSurname: Nachnamen beginnend mit ExamRoomMappingMatriculation: Matrikelnummern endend in ExamRoomMappingRandom: Verteilung diff --git a/messages/uniworx/misc/en-eu.msg b/messages/uniworx/misc/en-eu.msg index 07665597a..f8e1ddff3 100644 --- a/messages/uniworx/misc/en-eu.msg +++ b/messages/uniworx/misc/en-eu.msg @@ -2822,10 +2822,6 @@ ExamAutoOccurrenceParticipantsAssigned num: Occurrence/room assignment rule save TitleExamAutoOccurrence tid ssh csh examn: #{tid} - #{ssh} - #{csh} #{examn}: Automatic occurrence/room distribution BtnExamAutoOccurrenceCalculate: Calculate assignment rules BtnExamAutoOccurrenceAccept: Accept assignments -BtnExamAutoOccurrenceNudgeUp: + -BtnExamAutoOccurrenceNudgeDown: - -BtnExamAutoOccurrenceIgnore: Ignore -BtnExamAutoOccurrenceReconsider: Reconsider ExamRoomMappingSurname: Surnames starting with ExamRoomMappingMatriculation: Matriculation numbers ending in ExamRoomMappingRandom: Distribution diff --git a/src/Handler/Exam/AutoOccurrence.hs b/src/Handler/Exam/AutoOccurrence.hs index 3f03de4aa..c8fc15398 100644 --- a/src/Handler/Exam/AutoOccurrence.hs +++ b/src/Handler/Exam/AutoOccurrence.hs @@ -43,8 +43,14 @@ instance Finite ExamAutoOccurrenceButton nullaryPathPiece ''ExamAutoOccurrenceButton $ camelToPathPiece' 4 -embedRenderMessage ''UniWorX ''ExamAutoOccurrenceButton id instance Button UniWorX ExamAutoOccurrenceButton where + btnLabel BtnExamAutoOccurrenceCalculate = i18n MsgBtnExamAutoOccurrenceCalculate + btnLabel BtnExamAutoOccurrenceAccept = i18n MsgBtnExamAutoOccurrenceAccept + btnLabel BtnExamAutoOccurrenceNudgeUp = toWidget iconExamAutoOccurrenceNudgeUp + btnLabel BtnExamAutoOccurrenceNudgeDown = toWidget iconExamAutoOccurrenceNudgeDown + btnLabel BtnExamAutoOccurrenceIgnore = toWidget iconExamAutoOccurrenceIgnore + btnLabel BtnExamAutoOccurrenceReconsider = toWidget iconExamAutoOccurrenceReconsider + btnClasses BtnExamAutoOccurrenceNudgeUp = [BCIsButton] btnClasses BtnExamAutoOccurrenceNudgeDown = [BCIsButton] btnClasses BtnExamAutoOccurrenceIgnore = [BCIsButton] diff --git a/src/Utils/Icon.hs b/src/Utils/Icon.hs index dc1c46e8b..11759a60f 100644 --- a/src/Utils/Icon.hs +++ b/src/Utils/Icon.hs @@ -44,6 +44,10 @@ data Icon | IconExam | IconExamRegisterTrue | IconExamRegisterFalse + | IconExamAutoOccurrenceNudgeUp + | IconExamAutoOccurrenceNudgeDown + | IconExamAutoOccurrenceIgnore + | IconExamAutoOccurrenceReconsider | IconCommentTrue | IconCommentFalse | IconLink @@ -112,6 +116,10 @@ iconText = \case IconExam -> "poll-h" IconExamRegisterTrue -> "calendar-check" IconExamRegisterFalse -> "calendar-times" + IconExamAutoOccurrenceNudgeUp -> "user-plus" + IconExamAutoOccurrenceNudgeDown -> "user-minus" + IconExamAutoOccurrenceIgnore -> "users-slash" + IconExamAutoOccurrenceReconsider -> "users" IconCommentTrue -> "comment-alt" IconCommentFalse -> "comment-alt-slash" IconLink -> "link" diff --git a/templates/widgets/exam-occurrence-mapping.hamlet b/templates/widgets/exam-occurrence-mapping.hamlet index 975d170ff..f99698873 100644 --- a/templates/widgets/exam-occurrence-mapping.hamlet +++ b/templates/widgets/exam-occurrence-mapping.hamlet @@ -29,27 +29,51 @@ $newline never $if isIgnored occId - + _{examOccurrenceName} $else _{examOccurrenceName} - _{loadProp (occLoad occId) examOccurrenceCapacity} + $if isIgnored occId + + _{loadProp (occLoad occId) examOccurrenceCapacity} + $else + _{loadProp (occLoad occId) examOccurrenceCapacity} $maybe nudgeWgt' <- Map.lookup occId nudgeWgt ^{nudgeWgt'} $maybe ignoreRoomWgt' <- Map.lookup occId ignoreRoomWgt ^{ignoreRoomWgt'} - $maybe mappingWgt <- occMapping occId - ^{mappingWgt} + $if isIgnored occId + + $maybe mappingWgt <- occMapping occId + ^{mappingWgt} + $else + $maybe mappingWgt <- occMapping occId + ^{mappingWgt} - $maybe room <- examOccurrenceRoom - ^{roomReferenceWidget room} - $nothing - _{MsgExamOccurrenceRoomIsUnset} + $if isIgnored occId + + $maybe room <- examOccurrenceRoom + ^{roomReferenceWidget room} + $nothing + _{MsgExamOccurrenceRoomIsUnset} + $else + $maybe room <- examOccurrenceRoom + ^{roomReferenceWidget room} + $nothing + _{MsgExamOccurrenceRoomIsUnset} - ^{formatTimeRangeW SelFormatDateTime examOccurrenceStart examOccurrenceEnd} + $if isIgnored occId + + ^{formatTimeRangeW SelFormatDateTime examOccurrenceStart examOccurrenceEnd} + $else + ^{formatTimeRangeW SelFormatDateTime examOccurrenceStart examOccurrenceEnd} $maybe desc <- examOccurrenceDescription - #{desc} + $if isIgnored occId + + #{desc} + $else + #{desc}