diff --git a/messages/uniworx/de.msg b/messages/uniworx/de.msg index 7fa4c8bce..4002461e1 100644 --- a/messages/uniworx/de.msg +++ b/messages/uniworx/de.msg @@ -344,6 +344,9 @@ TimeFormat: Uhrzeitformat DownloadFiles: Dateien automatisch herunterladen DownloadFilesTip: Wenn gesetzt werden Dateien von Abgaben und Übungsblättern automatisch als Download behandelt, ansonsten ist das Verhalten browserabhängig (es können z.B. PDFs im Browser geöffnet werden). NotificationSettings: Erwünschte Benachrichtigungen +FormNotifications: Benachrichtigungen +FormBehaviour: Verhalten +FormCosmetics: Oberfläche ActiveAuthTags: Aktivierte Authorisierungsprädikate diff --git a/src/Handler/Profile.hs b/src/Handler/Profile.hs index 6a1f6b2cf..4551f6657 100644 --- a/src/Handler/Profile.hs +++ b/src/Handler/Profile.hs @@ -29,7 +29,7 @@ data SettingsForm = SettingsForm makeSettingForm :: Maybe SettingsForm -> Form SettingsForm makeSettingForm template = identForm FIDsettings $ \html -> do (result, widget) <- flip (renderAForm FormStandard) html $ SettingsForm - <$ aformSection cosmeticsSection + <$ aformSection MsgFormCosmetics <*> areq (natFieldI $ MsgNatField "Favoriten") -- TODO: natFieldI not working here (fslpI MsgFavoriten "Anzahl Favoriten") (stgMaxFavourties <$> template) <*> areq (selectField . return $ mkOptionList themeList) @@ -37,23 +37,15 @@ makeSettingForm template = identForm FIDsettings $ \html -> do <*> areq (selectField $ dateTimeFormatOptions SelFormatDateTime) (fslI MsgDateTimeFormat) (stgDateTime <$> template) <*> areq (selectField $ dateTimeFormatOptions SelFormatDate) (fslI MsgDateFormat) (stgDate <$> template) <*> areq (selectField $ dateTimeFormatOptions SelFormatTime) (fslI MsgTimeFormat) (stgTime <$> template) - <* aformSection behaviorSection + <* aformSection MsgFormBehaviour <*> areq checkBoxField (fslI MsgDownloadFiles & setTooltip MsgDownloadFilesTip ) (stgDownloadFiles <$> template) - <* aformSection notificationSection + <* aformSection MsgFormNotifications <*> (NotificationSettings <$> funcForm nsForm (fslI MsgNotificationSettings) True) - -- <$> aFormGroup "Cosmetics" cosmeticsForm - -- <*> aFormGroup "Notifications" notificationsForm <* submitButton return (result, widget) -- no validation required here where - cosmeticsSection :: Text - cosmeticsSection = "Cosmetics" - behaviorSection :: Text - behaviorSection = "Behavior" - notificationSection :: Text - notificationSection = "Notifications" themeList = [Option (display t) t (toPathPiece t) | t <- universeF] nsForm nt = fromMaybe False <$> aopt checkBoxField (fslI nt) (Just $ flip notificationAllowed nt . stgNotificationSettings <$> template) -- diff --git a/src/Handler/Utils/Form.hs b/src/Handler/Utils/Form.hs index 4e0102360..742a21407 100644 --- a/src/Handler/Utils/Form.hs +++ b/src/Handler/Utils/Form.hs @@ -641,18 +641,30 @@ infoField txt = Field { fieldEnctype = UrlEncoded , fieldView = \_theId _name _attrs _val _isReq -> [whamlet|#{txt}|] } -aformSection :: (Monad m, ToMarkup t) => t -> AForm m () +aformSection :: (MonadHandler m, site ~ HandlerSite m, RenderMessage site msg) => msg -> AForm m () aformSection = formToAForm . fmap (second pure) . formSection -formSection :: (Monad m, ToMarkup t) => t -> MForm m (FormResult (), FieldView site) -- TODO: WIP, delete -formSection formSectionTitle = return (FormSuccess (), infoView) +formSection :: (MonadHandler m, site ~ HandlerSite m, RenderMessage site msg) => msg -> MForm m (FormResult (), FieldView site) -- TODO: WIP, delete +formSection formSectionTitle = do + mr <- getMessageRender + return (FormSuccess (), FieldView + { fvLabel = toHtml $ mr formSectionTitle + , fvTooltip = Nothing + , fvId = "form-section-noinput" + , fvErrors = Nothing + , fvRequired = False + , fvInput = mempty + }) + +formSection' :: (Monad m, ToMarkup t) => t -> MForm m (FormResult (), FieldView site) -- TODO: WIP, delete +formSection' formSectionTitle = return (FormSuccess (), infoView) where flabel :: Html flabel = $(shamletFile "./templates/widgets/form-section-title.shamlet") -- TODO: Why must this be fully qualified? infoView = FieldView { fvLabel = flabel , fvTooltip = Nothing - , fvId = "formSection" + , fvId = "form-section-noinput" , fvErrors = Nothing , fvRequired = False , fvInput = mempty diff --git a/templates/widgets/form.hamlet b/templates/widgets/form.hamlet index 08d37adfc..e961ff4ad 100644 --- a/templates/widgets/form.hamlet +++ b/templates/widgets/form.hamlet @@ -3,16 +3,31 @@ $newline never $case formLayout $of FormDBTablePagesize $forall view <- fieldViews -