I did way too much here. Polishing, fixing redirection etc.
This commit is contained in:
parent
f2f9f46c4e
commit
74a666f092
18 changed files with 180 additions and 81 deletions
|
@ -46,6 +46,7 @@ executable matebeamter
|
||||||
, View.Buy
|
, View.Buy
|
||||||
, View.Journal
|
, View.Journal
|
||||||
, View.Product
|
, View.Product
|
||||||
|
, Paths_matebeamter
|
||||||
-- other-extensions:
|
-- other-extensions:
|
||||||
build-depends: base ^>=4.12.0.0
|
build-depends: base ^>=4.12.0.0
|
||||||
, mateamt
|
, mateamt
|
||||||
|
|
|
@ -27,7 +27,8 @@ import qualified "mateamt" Types as MT
|
||||||
import Types
|
import Types
|
||||||
|
|
||||||
type UserAPI =
|
type UserAPI =
|
||||||
Header "Cookie" T.Text :> (Get '[HTML] UserSelectPage
|
Header "Cookie" T.Text :> (
|
||||||
|
QueryParam "refine" MT.UserRefine :> Get '[HTML] UserSelectPage
|
||||||
:<|> "user" :> Capture "id" Int :> QueryParam "refine" MT.ProductRefine
|
:<|> "user" :> Capture "id" Int :> QueryParam "refine" MT.ProductRefine
|
||||||
:> Get '[HTML] UserOverviewPage
|
:> Get '[HTML] UserOverviewPage
|
||||||
:<|> "user" :> Capture "id" Int :> "buy"
|
:<|> "user" :> Capture "id" Int :> "buy"
|
||||||
|
|
|
@ -117,9 +117,10 @@ authPostControl
|
||||||
-> Maybe T.Text
|
-> Maybe T.Text
|
||||||
-> AuthReturn
|
-> AuthReturn
|
||||||
-> UserHandler UserSelectPage
|
-> UserHandler UserSelectPage
|
||||||
authPostControl (Just cookies) mDestination (AuthReturn pass method) = do
|
authPostControl mcookies@(Just cookies) mDestination (AuthReturn pass method) = do
|
||||||
let mticket = lookup ("x-ticket-" <> fromString (show method)) $
|
let mticket = lookup ("x-ticket-" <> fromString (show method)) $
|
||||||
parseCookieText cookies
|
parseCookieText cookies
|
||||||
|
(_, _, loc, l10n, _, _, _) <- controlInit mcookies
|
||||||
case mticket of
|
case mticket of
|
||||||
Just ticket -> do
|
Just ticket -> do
|
||||||
(ReadState _ backend _ _ _) <- ask
|
(ReadState _ backend _ _ _) <- ask
|
||||||
|
@ -145,7 +146,7 @@ authPostControl (Just cookies) mDestination (AuthReturn pass method) = do
|
||||||
(read $ T.unpack user)
|
(read $ T.unpack user)
|
||||||
Nothing
|
Nothing
|
||||||
)
|
)
|
||||||
_ -> errHeaders $ redirect303 userSelectLink
|
_ -> errHeaders $ redirect303 (userSelectLink Nothing)
|
||||||
throwError $ err303
|
throwError $ err303
|
||||||
{ errHeaders = headers ++
|
{ errHeaders = headers ++
|
||||||
[ ( "Set-Cookie"
|
[ ( "Set-Cookie"
|
||||||
|
@ -158,15 +159,18 @@ authPostControl (Just cookies) mDestination (AuthReturn pass method) = do
|
||||||
, "x-method=" <> fromString (show $ fromEnum method) <>";Path=/")
|
, "x-method=" <> fromString (show $ fromEnum method) <>";Path=/")
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Right MT.Denied -> throwError $ err401
|
Right MT.Denied -> throwError (
|
||||||
{ errBody = "Authentication failed!"
|
addMessage (translate l10n loc "Authentication failed!") $
|
||||||
}
|
redirect303 (userSelectLink Nothing)
|
||||||
|
)
|
||||||
Left err -> throwError $ err500
|
Left err -> throwError $ err500
|
||||||
{ errBody = fromString $ show err
|
{ errBody = fromString $ show err
|
||||||
}
|
}
|
||||||
Nothing -> throwError $ err400
|
Nothing -> throwError $ err400
|
||||||
{ errBody = "No ticket cookie present."
|
{ errBody = "No ticket cookie present."
|
||||||
}
|
}
|
||||||
|
where
|
||||||
|
translate l10n locale = localize l10n locale . gettext
|
||||||
authPostControl Nothing _ _ = throwError $ err400
|
authPostControl Nothing _ _ = throwError $ err400
|
||||||
{ errBody = "No ticket cookie present."
|
{ errBody = "No ticket cookie present."
|
||||||
}
|
}
|
||||||
|
@ -184,7 +188,7 @@ authLogoutControl mcookie = do
|
||||||
backend
|
backend
|
||||||
case eReturn of
|
case eReturn of
|
||||||
Right _ -> do
|
Right _ -> do
|
||||||
let redirectHeaders = errHeaders (redirect303 userSelectLink)
|
let redirectHeaders = errHeaders (redirect303 $ userSelectLink Nothing)
|
||||||
unsetCookiesHeaders = map
|
unsetCookiesHeaders = map
|
||||||
(\c ->
|
(\c ->
|
||||||
( "Set-Cookie"
|
( "Set-Cookie"
|
||||||
|
|
|
@ -42,14 +42,14 @@ buyControl
|
||||||
-> [MT.PurchaseDetail]
|
-> [MT.PurchaseDetail]
|
||||||
-> Bool
|
-> Bool
|
||||||
-> UserHandler BuyConfirmPage
|
-> UserHandler BuyConfirmPage
|
||||||
buyControl mcookie uid pds forceBuy =
|
buyControl mcookie uid pds forceBuy = do
|
||||||
if not (null pds)
|
|
||||||
then do
|
|
||||||
(ReadState l10n backend _ symbol version) <- ask
|
(ReadState l10n backend _ symbol version) <- ask
|
||||||
let (token, _) = parseTokenAndUser mcookie
|
let (token, _) = parseTokenAndUser mcookie
|
||||||
loc = Locale
|
loc = Locale
|
||||||
(fromMaybe "en" $ lookup "locale" =<< fmap parseCookieText mcookie)
|
(fromMaybe "en" $ lookup "locale" =<< fmap parseCookieText mcookie)
|
||||||
pids = map MT.purchaseDetailProduct pds
|
if not (null pds)
|
||||||
|
then do
|
||||||
|
let pids = map MT.purchaseDetailProduct pds
|
||||||
epsovs <- liftIO $ runClientM
|
epsovs <- liftIO $ runClientM
|
||||||
(productShortList (Just MT.AllProducts))
|
(productShortList (Just MT.AllProducts))
|
||||||
backend
|
backend
|
||||||
|
@ -85,9 +85,14 @@ buyControl mcookie uid pds forceBuy =
|
||||||
Left err ->
|
Left err ->
|
||||||
throwError $
|
throwError $
|
||||||
addMessage (fromString $ show err) $
|
addMessage (fromString $ show err) $
|
||||||
redirect303 userSelectLink
|
redirect303 (userSelectLink Nothing)
|
||||||
else
|
else
|
||||||
throwError (redirect303 $ userOverviewLink uid Nothing)
|
throwError (
|
||||||
|
addMessage (translate l10n loc "Please select items for purchase") $
|
||||||
|
redirect303 (userOverviewLink uid Nothing)
|
||||||
|
)
|
||||||
|
where
|
||||||
|
translate l10n locale = localize l10n locale . gettext
|
||||||
|
|
||||||
purchaseControl
|
purchaseControl
|
||||||
:: Maybe T.Text
|
:: Maybe T.Text
|
||||||
|
@ -179,7 +184,7 @@ purchaseControl mcookie uid pds forceBuy = do
|
||||||
backend
|
backend
|
||||||
throwError
|
throwError
|
||||||
$ addMessage message
|
$ addMessage message
|
||||||
$ redirect303 userSelectLink
|
$ redirect303 (userSelectLink Nothing)
|
||||||
translate l10n locale = localize l10n locale . gettext
|
translate l10n locale = localize l10n locale . gettext
|
||||||
|
|
||||||
cashBuyOverviewControl
|
cashBuyOverviewControl
|
||||||
|
@ -240,7 +245,7 @@ cashBuyPurchaseControl mcookie {-forceBuy-} pds = do
|
||||||
addMessage
|
addMessage
|
||||||
(translate l10n loc "Please Pay" <>
|
(translate l10n loc "Please Pay" <>
|
||||||
": " <> formatMoney price <> symbol) $
|
": " <> formatMoney price <> symbol) $
|
||||||
redirect303 userSelectLink
|
redirect303 (userSelectLink Nothing)
|
||||||
(MT.PurchaseResult (MT.PayAmount price) miss) -> do
|
(MT.PurchaseResult (MT.PayAmount price) miss) -> do
|
||||||
eproducts <- liftIO $ runClientM
|
eproducts <- liftIO $ runClientM
|
||||||
(productShortList
|
(productShortList
|
||||||
|
@ -268,13 +273,13 @@ cashBuyPurchaseControl mcookie {-forceBuy-} pds = do
|
||||||
[]
|
[]
|
||||||
prods
|
prods
|
||||||
))
|
))
|
||||||
$ redirect303 userSelectLink
|
$ redirect303 (userSelectLink Nothing)
|
||||||
Left err ->
|
Left err ->
|
||||||
throwError $ err500
|
throwError $ err500
|
||||||
{ errBody = fromString (show err)
|
{ errBody = fromString (show err)
|
||||||
}
|
}
|
||||||
Left err ->
|
Left err ->
|
||||||
handleClientErr err Nothing (Just userSelectLink)
|
handleClientErr err Nothing (Just (userSelectLink Nothing))
|
||||||
else
|
else
|
||||||
throwError
|
throwError
|
||||||
$ addMessage (translate l10n loc "Please choose your product(s)")
|
$ addMessage (translate l10n loc "Please choose your product(s)")
|
||||||
|
|
|
@ -59,11 +59,11 @@ journalControl mcookie mpage = do
|
||||||
else
|
else
|
||||||
throwError $
|
throwError $
|
||||||
addMessage (fromString $ show err) $
|
addMessage (fromString $ show err) $
|
||||||
redirect303 userSelectLink
|
redirect303 (userSelectLink Nothing)
|
||||||
othererr ->
|
othererr ->
|
||||||
throwError $
|
throwError $
|
||||||
addMessage (fromString $ show othererr) $
|
addMessage (fromString $ show othererr) $
|
||||||
redirect303 userSelectLink
|
redirect303 (userSelectLink Nothing)
|
||||||
Nothing ->
|
Nothing ->
|
||||||
redirectOverAuth Nothing (Just $ journalLink mpage) Nothing
|
redirectOverAuth Nothing (Just $ journalLink mpage) Nothing
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ productGetPriceList mcookie mrefine = do
|
||||||
Left err ->
|
Left err ->
|
||||||
throwError $
|
throwError $
|
||||||
addMessage (fromString $ show err) $
|
addMessage (fromString $ show err) $
|
||||||
redirect303 userSelectLink
|
redirect303 (userSelectLink Nothing)
|
||||||
|
|
||||||
productGetRefill
|
productGetRefill
|
||||||
:: Maybe T.Text
|
:: Maybe T.Text
|
||||||
|
@ -63,7 +63,7 @@ productGetRefill mcookie = do
|
||||||
Left err ->
|
Left err ->
|
||||||
throwError $
|
throwError $
|
||||||
addMessage (fromString $ show err) $
|
addMessage (fromString $ show err) $
|
||||||
redirect303 userSelectLink
|
redirect303 (userSelectLink Nothing)
|
||||||
Nothing ->
|
Nothing ->
|
||||||
redirectOverAuth Nothing (Just productGetRefillLink) Nothing
|
redirectOverAuth Nothing (Just productGetRefillLink) Nothing
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,16 @@ import Hash
|
||||||
import API
|
import API
|
||||||
import Util
|
import Util
|
||||||
|
|
||||||
userSelectControl :: Maybe T.Text -> UserHandler UserSelectPage
|
userSelectControl
|
||||||
userSelectControl mcookie = do
|
:: Maybe T.Text
|
||||||
|
-> Maybe MT.UserRefine
|
||||||
|
-> UserHandler UserSelectPage
|
||||||
|
userSelectControl mcookie mrefine = do
|
||||||
(ReadState l10n backend _ symbol version) <- ask
|
(ReadState l10n backend _ symbol version) <- ask
|
||||||
let loc = Locale
|
let loc = Locale
|
||||||
(fromMaybe "en" $ lookup "locale" =<< fmap parseCookieText mcookie)
|
(fromMaybe "en" $ lookup "locale" =<< fmap parseCookieText mcookie)
|
||||||
euser <- liftIO $ runClientM
|
euser <- liftIO $ runClientM
|
||||||
(userList Nothing)
|
(userList mrefine)
|
||||||
backend
|
backend
|
||||||
case euser of
|
case euser of
|
||||||
Right uss ->
|
Right uss ->
|
||||||
|
@ -69,7 +72,7 @@ userNewPostControl _ us@(MT.UserSubmit _ _ pass) = do
|
||||||
{ MT.userSubmitPassHash = hashedPass
|
{ MT.userSubmitPassHash = hashedPass
|
||||||
})
|
})
|
||||||
backend
|
backend
|
||||||
throwError $ redirect303 userSelectLink
|
throwError $ redirect303 (userSelectLink Nothing)
|
||||||
|
|
||||||
userOverviewControl
|
userOverviewControl
|
||||||
:: Maybe T.Text
|
:: Maybe T.Text
|
||||||
|
@ -266,4 +269,5 @@ userManageAuthDeleteControl mcookie uid (AuthDetailId adid) = do
|
||||||
throwError (redirect303 $ userManageLink uid)
|
throwError (redirect303 $ userManageLink uid)
|
||||||
else
|
else
|
||||||
handleErrors (fmap read mAuthUser) Nothing [Just err]
|
handleErrors (fmap read mAuthUser) Nothing [Just err]
|
||||||
_ -> handleErrors (fmap read mAuthUser) (Just userSelectLink) [Just err]
|
_ -> handleErrors (fmap read mAuthUser) (Just $ userSelectLink Nothing)
|
||||||
|
[Just err]
|
||||||
|
|
|
@ -37,6 +37,11 @@ initPage title = Page
|
||||||
mempty
|
mempty
|
||||||
mempty
|
mempty
|
||||||
(H.link
|
(H.link
|
||||||
|
H.! HA.rel "stylesheet"
|
||||||
|
H.! HA.type_ "text/css"
|
||||||
|
H.! HA.href "/static/css/bootstrap.min.css"
|
||||||
|
<>
|
||||||
|
H.link
|
||||||
H.! HA.rel "stylesheet"
|
H.! HA.rel "stylesheet"
|
||||||
H.! HA.type_ "text/css"
|
H.! HA.type_ "text/css"
|
||||||
H.! HA.href "/static/css/style.css"
|
H.! HA.href "/static/css/style.css"
|
||||||
|
|
|
@ -152,7 +152,7 @@ redirectOverAuth muid mLink mRefine = do
|
||||||
fromString (show $ linkURI (case (mLink, muid) of
|
fromString (show $ linkURI (case (mLink, muid) of
|
||||||
(Just link, _) -> link
|
(Just link, _) -> link
|
||||||
(Nothing, Just uid) -> userOverviewLink uid mRefine
|
(Nothing, Just uid) -> userOverviewLink uid mRefine
|
||||||
_ -> userSelectLink
|
_ -> userSelectLink Nothing
|
||||||
))))
|
))))
|
||||||
throwError
|
throwError
|
||||||
(err303
|
(err303
|
||||||
|
@ -205,8 +205,8 @@ handleClientErr err muid authTargetLink =
|
||||||
else
|
else
|
||||||
throwError $
|
throwError $
|
||||||
addMessage (fromString $ show err) $
|
addMessage (fromString $ show err) $
|
||||||
redirect303 userSelectLink
|
redirect303 (userSelectLink Nothing)
|
||||||
othererr ->
|
othererr ->
|
||||||
throwError $
|
throwError $
|
||||||
addMessage (fromString $ show othererr) $
|
addMessage (fromString $ show othererr) $
|
||||||
redirect303 userSelectLink
|
redirect303 (userSelectLink Nothing)
|
||||||
|
|
|
@ -72,7 +72,7 @@ authPage l10n locale mDestination version mcookie = scaffold
|
||||||
H.! HA.value ""
|
H.! HA.value ""
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ translate "Submit"
|
$ H.toHtml $ translate "Submit"
|
||||||
where
|
where
|
||||||
|
|
|
@ -116,13 +116,14 @@ buyConfirmPage l10n locale uid ziptups total forceBuy version mcookie symbol =
|
||||||
H.toHtml symbol
|
H.toHtml symbol
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ if forceBuy
|
$ H.toHtml $ if forceBuy
|
||||||
then translate "Buy anyway"
|
then translate "Buy anyway"
|
||||||
else translate "Buy"
|
else translate "Buy"
|
||||||
when forceBuy $
|
when forceBuy $
|
||||||
H.button
|
H.button
|
||||||
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.formnovalidate "formnovalidate"
|
H.! HA.formnovalidate "formnovalidate"
|
||||||
H.! HA.formmethod "get"
|
H.! HA.formmethod "get"
|
||||||
H.! HA.formaction
|
H.! HA.formaction
|
||||||
|
@ -143,9 +144,6 @@ buyProductsForm l10n locale prods = do
|
||||||
mapM_ (\(MT.ProductShortOverview pid ident price amount ml maid) ->
|
mapM_ (\(MT.ProductShortOverview pid ident price amount ml maid) ->
|
||||||
H.div
|
H.div
|
||||||
H.! HA.class_ "tile"
|
H.! HA.class_ "tile"
|
||||||
$ do
|
|
||||||
H.div
|
|
||||||
H.! HA.class_ "tile-content form-group optional"
|
|
||||||
H.!?
|
H.!?
|
||||||
( isJust maid
|
( isJust maid
|
||||||
, productBgStyle (fromString $ show $ fromJust maid)
|
, productBgStyle (fromString $ show $ fromJust maid)
|
||||||
|
@ -154,14 +152,15 @@ buyProductsForm l10n locale prods = do
|
||||||
H.label
|
H.label
|
||||||
H.! HA.for ("product-select-" <> fromString (show pid)) $
|
H.! HA.for ("product-select-" <> fromString (show pid)) $
|
||||||
H.toHtml ident
|
H.toHtml ident
|
||||||
|
H.! HA.class_ "tile-content form-group optional"
|
||||||
H.input
|
H.input
|
||||||
H.! HA.id ("product-select-" <> fromString (show pid))
|
H.! HA.id ("product-select-" <> fromString (show pid))
|
||||||
H.! HA.class_ "form-control product-select"
|
H.! HA.class_ "form-control product-select"
|
||||||
|
H.! HA.class_ "tile-content form-group optional"
|
||||||
H.! HA.name ("productSelect-" <> fromString (show pid))
|
H.! HA.name ("productSelect-" <> fromString (show pid))
|
||||||
H.! HA.type_ "checkbox"
|
H.! HA.type_ "checkbox"
|
||||||
H.! HA.value "true"
|
-- H.! HA.value "true"
|
||||||
H.div
|
H.div
|
||||||
H.! HA.class_ "tile-content form-group optional"
|
|
||||||
$ do
|
$ do
|
||||||
H.label
|
H.label
|
||||||
H.! HA.for ("product-amount-" <> fromString (show pid)) $
|
H.! HA.for ("product-amount-" <> fromString (show pid)) $
|
||||||
|
@ -178,7 +177,7 @@ buyProductsForm l10n locale prods = do
|
||||||
prods
|
prods
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ translate "Proceed"
|
$ H.toHtml $ translate "Proceed"
|
||||||
where
|
where
|
||||||
|
|
|
@ -80,6 +80,7 @@ journalPage l10n loc version mcookie mpage entries =
|
||||||
$ H.toHtml $ translate "Next Page"
|
$ H.toHtml $ translate "Next Page"
|
||||||
H.form $
|
H.form $
|
||||||
H.button
|
H.button
|
||||||
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
H.! HA.formmethod "get"
|
H.! HA.formmethod "get"
|
||||||
H.! HA.formaction
|
H.! HA.formaction
|
||||||
|
@ -124,7 +125,7 @@ journalCheckPage l10n loc version mcookie =
|
||||||
H.! HA.value "0"
|
H.! HA.value "0"
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ translate "Submit"
|
$ H.toHtml $ translate "Submit"
|
||||||
where
|
where
|
||||||
|
|
|
@ -154,7 +154,7 @@ productRefillPage l10n loc version mcookie prodList =
|
||||||
prodList
|
prodList
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ translate "Submit"
|
$ H.toHtml $ translate "Submit"
|
||||||
where
|
where
|
||||||
|
@ -288,7 +288,7 @@ productNewPage l10n loc version mcookie symbol =
|
||||||
-}
|
-}
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ translate "Submit"
|
$ H.toHtml $ translate "Submit"
|
||||||
where
|
where
|
||||||
|
|
|
@ -14,8 +14,12 @@ import Data.Text.I18n
|
||||||
|
|
||||||
import Data.Maybe (fromJust, isJust)
|
import Data.Maybe (fromJust, isJust)
|
||||||
|
|
||||||
|
import Data.Version (showVersion)
|
||||||
|
|
||||||
import Control.Monad (when)
|
import Control.Monad (when)
|
||||||
|
|
||||||
|
import qualified Paths_matebeamter as MyPath (version)
|
||||||
|
|
||||||
-- internal imports
|
-- internal imports
|
||||||
|
|
||||||
import Types.Page
|
import Types.Page
|
||||||
|
@ -32,7 +36,7 @@ scaffold
|
||||||
-> H.Html
|
-> H.Html
|
||||||
scaffold l10n locale version mcookie page content = template page $ do
|
scaffold l10n locale version mcookie page content = template page $ do
|
||||||
H.header $ H.nav $ H.ul $ do
|
H.header $ H.nav $ H.ul $ do
|
||||||
H.li $ H.a H.! HA.href ("/" <> fromString (show $ linkURI userSelectLink)) $
|
H.li $ H.a H.! HA.href ("/" <> fromString (show $ linkURI (userSelectLink Nothing))) $
|
||||||
H.toHtml $ translate "Home"
|
H.toHtml $ translate "Home"
|
||||||
maybe
|
maybe
|
||||||
(return ())
|
(return ())
|
||||||
|
@ -52,6 +56,7 @@ scaffold l10n locale version mcookie page content = template page $ do
|
||||||
H.hr
|
H.hr
|
||||||
H.footer $ H.form $ do
|
H.footer $ H.form $ do
|
||||||
H.button
|
H.button
|
||||||
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.formmethod "get"
|
H.! HA.formmethod "get"
|
||||||
H.! HA.formaction ("/" <>
|
H.! HA.formaction ("/" <>
|
||||||
(fromString $ show $ linkURI $ productGetPriceListLink Nothing))
|
(fromString $ show $ linkURI $ productGetPriceListLink Nothing))
|
||||||
|
@ -60,6 +65,7 @@ scaffold l10n locale version mcookie page content = template page $ do
|
||||||
(return ())
|
(return ())
|
||||||
(\_ ->
|
(\_ ->
|
||||||
H.button
|
H.button
|
||||||
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.formmethod "get"
|
H.! HA.formmethod "get"
|
||||||
H.! HA.formaction ("/" <>
|
H.! HA.formaction ("/" <>
|
||||||
(fromString $ show $ linkURI $ productGetRefillLink))
|
(fromString $ show $ linkURI $ productGetRefillLink))
|
||||||
|
@ -68,7 +74,11 @@ scaffold l10n locale version mcookie page content = template page $ do
|
||||||
(getLogin mcookie)
|
(getLogin mcookie)
|
||||||
H.div
|
H.div
|
||||||
H.! HA.class_ "backend-version"
|
H.! HA.class_ "backend-version"
|
||||||
$ H.toHtml $ (translate "Powered by mateamt version") <> " " <> version
|
$ H.toHtml $
|
||||||
|
(translate "Powered by ") <> "matebeamter " <>
|
||||||
|
(fromString $ showVersion MyPath.version) <> " " <>
|
||||||
|
(translate "connected to ") <> "mateamt " <>
|
||||||
|
version
|
||||||
where
|
where
|
||||||
message = lookup "message" =<< fmap parseCookieText mcookie
|
message = lookup "message" =<< fmap parseCookieText mcookie
|
||||||
translate = localize l10n locale . gettext
|
translate = localize l10n locale . gettext
|
||||||
|
|
|
@ -42,8 +42,8 @@ userSelectPage l10n locale uss version mcookie =
|
||||||
) $ H.ul
|
) $ H.ul
|
||||||
H.! HA.class_ "tile-list"
|
H.! HA.class_ "tile-list"
|
||||||
$ do
|
$ do
|
||||||
H.li H.! HA.class_ "tile" $ H.a
|
H.li H.! HA.class_ "tile function" $ H.a
|
||||||
H.! HA.class_ "tile-content function"
|
H.! HA.class_ "tile-content"
|
||||||
H.! HA.href ("/" <> fromString
|
H.! HA.href ("/" <> fromString
|
||||||
(show $ linkURI $ cashBuyLink Nothing)
|
(show $ linkURI $ cashBuyLink Nothing)
|
||||||
) $
|
) $
|
||||||
|
@ -55,8 +55,13 @@ userSelectPage l10n locale uss version mcookie =
|
||||||
userOverviewLink uid Nothing)) $
|
userOverviewLink uid Nothing)) $
|
||||||
H.toHtml ident
|
H.toHtml ident
|
||||||
) uss
|
) uss
|
||||||
H.li H.! HA.class_ "tile" $ H.a
|
H.li H.! HA.class_ "tile function" $ H.a
|
||||||
H.! HA.class_ "tile-content function"
|
H.! HA.class_ "tile-content"
|
||||||
|
H.! HA.href ("/" <> fromString
|
||||||
|
(show $ linkURI $ userSelectLink (Just MT.OldUsers))) $
|
||||||
|
H.toHtml $ translate "Show inactive users"
|
||||||
|
H.li H.! HA.class_ "tile function" $ H.a
|
||||||
|
H.! HA.class_ "tile-content"
|
||||||
H.! HA.href ("/" <> fromString (show $ linkURI userNewLink)) $
|
H.! HA.href ("/" <> fromString (show $ linkURI userNewLink)) $
|
||||||
H.toHtml $ translate "New user"
|
H.toHtml $ translate "New user"
|
||||||
where
|
where
|
||||||
|
@ -91,7 +96,7 @@ userOverviewPage l10n locale method ud pos version mcookie symbol =
|
||||||
H.! HA.enctype "application/x-www-form-urlencoded" $
|
H.! HA.enctype "application/x-www-form-urlencoded" $
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ translate "Logout"
|
$ H.toHtml $ translate "Logout"
|
||||||
case method of
|
case method of
|
||||||
|
@ -107,6 +112,7 @@ userOverviewPage l10n locale method ud pos version mcookie symbol =
|
||||||
buyForm = do
|
buyForm = do
|
||||||
H.div $ H.form $
|
H.div $ H.form $
|
||||||
H.button
|
H.button
|
||||||
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
H.! HA.formmethod "get"
|
H.! HA.formmethod "get"
|
||||||
H.! HA.formaction ("/" <>
|
H.! HA.formaction ("/" <>
|
||||||
|
@ -129,18 +135,21 @@ userSettingsPointer
|
||||||
userSettingsPointer l10n locale uid =
|
userSettingsPointer l10n locale uid =
|
||||||
H.form $ do
|
H.form $ do
|
||||||
H.button
|
H.button
|
||||||
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
H.! HA.formmethod "get"
|
H.! HA.formmethod "get"
|
||||||
H.! HA.formaction
|
H.! HA.formaction
|
||||||
("/" <> fromString (show $ linkURI $ userManageLink uid))
|
("/" <> fromString (show $ linkURI $ userManageLink uid))
|
||||||
$ H.toHtml $ translate "Manage user settings"
|
$ H.toHtml $ translate "Manage user settings"
|
||||||
H.button
|
H.button
|
||||||
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
H.! HA.formmethod "get"
|
H.! HA.formmethod "get"
|
||||||
H.! HA.formaction
|
H.! HA.formaction
|
||||||
("/" <> fromString (show $ linkURI $ journalLink Nothing))
|
("/" <> fromString (show $ linkURI $ journalLink Nothing))
|
||||||
$ H.toHtml $ translate "View Journal"
|
$ H.toHtml $ translate "View Journal"
|
||||||
H.button
|
H.button
|
||||||
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
H.! HA.formmethod "get"
|
H.! HA.formmethod "get"
|
||||||
H.! HA.formaction
|
H.! HA.formaction
|
||||||
|
@ -214,7 +223,7 @@ userNewPage l10n locale version mcookie =
|
||||||
H.! HA.value ""
|
H.! HA.value ""
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ translate "Submit"
|
$ H.toHtml $ translate "Submit"
|
||||||
where
|
where
|
||||||
|
@ -251,7 +260,7 @@ userRechargePage l10n locale version mcookie uid symbol =
|
||||||
H.toHtml symbol
|
H.toHtml symbol
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ translate "Recharge"
|
$ H.toHtml $ translate "Recharge"
|
||||||
where
|
where
|
||||||
|
@ -301,7 +310,7 @@ userManagePage l10n locale userDetails authOverviews version mcookie =
|
||||||
(MT.userDetailsEmail userDetails))
|
(MT.userDetailsEmail userDetails))
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ translate "Submit"
|
$ H.toHtml $ translate "Submit"
|
||||||
H.p $ do
|
H.p $ do
|
||||||
|
@ -330,7 +339,7 @@ userManagePage l10n locale userDetails authOverviews version mcookie =
|
||||||
H.! HA.value (fromString $ show aoid)
|
H.! HA.value (fromString $ show aoid)
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ translate "Delete"
|
$ H.toHtml $ translate "Delete"
|
||||||
)
|
)
|
||||||
|
@ -379,7 +388,7 @@ userManagePage l10n locale userDetails authOverviews version mcookie =
|
||||||
H.toHtml $ translate "Primary password"
|
H.toHtml $ translate "Primary password"
|
||||||
H.div H.! HA.class_ "form-group optional" $
|
H.div H.! HA.class_ "form-group optional" $
|
||||||
H.button
|
H.button
|
||||||
H.! HA.class_ "btn btn-default"
|
H.! HA.class_ "btn btn-primary"
|
||||||
H.! HA.type_ "submit"
|
H.! HA.type_ "submit"
|
||||||
$ H.toHtml $ translate "Submit"
|
$ H.toHtml $ translate "Submit"
|
||||||
where
|
where
|
||||||
|
|
7
static/css/bootstrap.min.css
vendored
Normal file
7
static/css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
static/css/bootstrap.min.css.map
Normal file
1
static/css/bootstrap.min.css.map
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,16 +1,26 @@
|
||||||
.tile-content {
|
:root {
|
||||||
flex: 1 1 auto;
|
--tile-color: #36c30023;
|
||||||
background-color: #36c30023;
|
--function-tile-color: #c300d223;
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tile-content * {
|
body {
|
||||||
|
margin: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tile-content label, .tile-content div {
|
form button, nav ul > li {
|
||||||
width: 100%;
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tile-list, nav ul {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav ul > li {
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 6px;
|
||||||
|
background-color: var(--function-tile-color);
|
||||||
|
padding : 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tile {
|
.tile {
|
||||||
|
@ -18,21 +28,63 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-content: stretch;
|
align-content: stretch;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
justify-content: stretch;
|
justify-content: center;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
|
background-color: var(--tile-color);
|
||||||
box-shadow: 0 0 3px #c3c3c3;
|
box-shadow: 0 0 3px #c3c3c3;
|
||||||
margin: 30px 15px 0;
|
margin: 30px 30px 0 5px;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.function {
|
.tile > label, .tile > * {
|
||||||
background-color: #c300d223
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tile-list {
|
.tile-content {
|
||||||
list-style: none;
|
flex: 1 1 auto;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
align-content: stretch;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tile-content * {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
align-content: stretch;
|
||||||
|
align-items: stretch;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tile input[type="checkbox"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tile input[type="checkbox"] + * {
|
||||||
|
display: none;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tile input[type="checkbox"]:checked + * {
|
||||||
|
display: inline-block;
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 0.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.function {
|
||||||
|
background-color: var(--function-tile-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tile-list + * {
|
||||||
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr {
|
hr {
|
||||||
|
|
Loading…
Reference in a new issue