From d83b1f696f0ebdc631bd460e87c762d16fbc3ade Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Thu, 4 Jul 2019 14:31:01 +0200 Subject: [PATCH] fix(correction): comment column made wide in online correction form column width enlarged for online correction and attempt at issue #373 --- src/Handler/Corrections.hs | 2 +- src/Handler/Utils/Table/Cells.hs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Handler/Corrections.hs b/src/Handler/Corrections.hs index 8e192e150..fcdcb32e4 100644 --- a/src/Handler/Corrections.hs +++ b/src/Handler/Corrections.hs @@ -219,7 +219,7 @@ colPointsField = sortable (Just "rating") (i18nCell MsgColumnRatingPoints) $ for ) colCommentField :: Colonnade Sortable CorrectionTableData (DBCell _ (FormResult (DBFormResult SubmissionId (a, b, Maybe Text) CorrectionTableData))) -colCommentField = sortable (Just "comment") (i18nCell MsgRatingComment) $ formCell id +colCommentField = sortable (Just "comment") (i18nCell MsgRatingComment) $ fmap (addCellAttrs [("style","width:60%")]) $ formCell id (\DBRow{ dbrOutput=(Entity subId _, _, _, _, _, _) } -> return subId) (\DBRow{ dbrOutput=(Entity _ Submission{..}, _, _, _, _, _) } mkUnique -> over (_1.mapped) ((_3 .~) . assertM (not . null) . fmap (Text.strip . unTextarea)) . over _2 fvInput <$> mopt textareaField (fsUniq mkUnique "comment") (Just $ Textarea <$> submissionRatingComment)) diff --git a/src/Handler/Utils/Table/Cells.hs b/src/Handler/Utils/Table/Cells.hs index 3bae746a8..a4a9a2fb2 100644 --- a/src/Handler/Utils/Table/Cells.hs +++ b/src/Handler/Utils/Table/Cells.hs @@ -2,6 +2,8 @@ module Handler.Utils.Table.Cells where import Import +import qualified Control.Monad.Trans.RWS.Lazy + import Data.CaseInsensitive (CI) -- import qualified Data.CaseInsensitive as CI @@ -25,6 +27,26 @@ type CourseLink = (TermId, SchoolId, CourseShorthand) -- TODO: Refactor with Wit -- Some basic cells are defined in Handler.Utils.Table.Pagination -- such as: i18nCell, cellTooltip, anchorCell for links, etc. +---------------- +-- Cell transformation + +-- | Add cell attributes +addCellAttrs :: [(Text, Text)] + -> DBCell (Control.Monad.Trans.RWS.Lazy.RWST + (Maybe (Env, FileEnv), UniWorX, [Lang]) + Enctype + Ints + (HandlerT UniWorX IO)) + x + -> DBCell (Control.Monad.Trans.RWS.Lazy.RWST + (Maybe (Env, FileEnv), UniWorX, [Lang]) + Enctype + Ints + (HandlerT UniWorX IO)) + x +addCellAttrs newAttrs fcell = fcell { formCellAttrs = newAttrs <> formCellAttrs fcell } -- Isn't there already a lens for that? + + ---------------- -- Special cells