Themes and Favorites work now, but need reload or page change.

This commit is contained in:
SJost 2018-06-26 14:00:41 +02:00
parent 097e0c45e7
commit 2525ad553f
2 changed files with 6 additions and 7 deletions

View File

@ -27,13 +27,13 @@ data SettingsForm = SettingsForm
makeSettingForm :: Maybe SettingsForm -> Form SettingsForm
makeSettingForm template = identForm FIDsettings $ \html -> do
let themeList = [(display t,t) | t <- allThemes]
flip (renderAForm FormStandard) html $ SettingsForm
(result, widget) <- flip (renderAForm FormStandard) html $ SettingsForm
<$> areq (natField "Favoriten") -- TODO: natFieldI not working here
(fslpI MsgFavoriten "12") (stgMaxFavourties <$> template)
(fslpI MsgFavoriten "Anzahl Favoriten") (stgMaxFavourties <$> template)
<*> areq (selectFieldList themeList)
(fslI MsgTheme ) (stgTheme <$> template)
<* submitButton
-- no validation required here
return (result, widget) -- no validation required here
@ -47,10 +47,9 @@ getProfileR = do
((res,formWidget), formEnctype) <- runFormPost $ makeSettingForm settingsTemplate
case res of
(FormSuccess SettingsForm{..}) -> do
runDB $ update uid [ UserMaxFavourites =. userMaxFavourites
, UserTheme =. userTheme
runDB $ update uid [ UserMaxFavourites =. stgMaxFavourties
, UserTheme =. stgTheme
]
addMessage "info" $ toHtml $ "LOG:" ++ display userMaxFavourites ++ display userTheme
addMessageI "info" $ MsgSettingsUpdate
(FormFailure msgs) -> forM_ msgs $ (addMessage "warning") . toHtml
_ -> return ()

View File

@ -209,7 +209,7 @@ derivePersistField "StudyFieldType"
data Theme --Simply add Themes to this type only. CamelCase will be converted to "-lower"
= Default
| NeutralBlue
| AberdeenRedso
| AberdeenReds
| MintGreen
| SkyLove
deriving (Eq,Ord,Bounded,Enum)