make code reusable

This commit is contained in:
nek0 2019-10-14 20:11:45 +02:00
parent 787b02e8b5
commit fe06fc8880

View file

@ -77,27 +77,29 @@ userOverviewPage l10n locale method ud pos = scaffold l10n locale (initPage $
$ H.toHtml $ translate "Logout"
case method of
MT.PrimaryPass ->
userSettingsPointer
userSettingsPointer l10n locale
MT.SecondaryPass ->
productList
productList pos
MT.ChallengeResponse -> do
userSettingsPointer
productList
userSettingsPointer l10n locale
productList pos
where
translate = localize l10n locale . gettext
productBgStyle aid = HA.style $ mconcat
[ "background-image: url(#" <> aid <> ");" -- FILLME
, "backgronud-color: blue;"
, "text-shadow:"
, " -1px 0 1px black,"
, " 0 1px 1px black,"
, " 1px 0 1px black,"
, " 0 -1px 1px black;"
]
userSettingsPointer =
userSettingsPointer
:: L10n
-> Locale
-> H.Html
userSettingsPointer l10n locale =
H.a H.! HA.href ("/" <> (fromString $ show $ linkURI $ userManageLink)) $
H.toHtml $ translate "Manage user settings"
productList =
where
translate = localize l10n locale . gettext
productList
:: [MT.ProductShortOverview]
-> H.Html
productList pos =
H.p $
H.ul H.! HA.class_ "product_list" $
mapM_
@ -110,6 +112,16 @@ userOverviewPage l10n locale method ud pos = scaffold l10n locale (initPage $
H.toHtml ident
)
pos
where
productBgStyle aid = HA.style $ mconcat
[ "background-image: url(#" <> aid <> ");" -- FILLME
, "backgronud-color: blue;"
, "text-shadow:"
, " -1px 0 1px black,"
, " 0 1px 1px black,"
, " 1px 0 1px black,"
, " 0 -1px 1px black;"
]
userNewPage
:: L10n