-
Notifications
You must be signed in to change notification settings - Fork 12
/
nick.hs
71 lines (56 loc) · 1.43 KB
/
nick.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Main
where
import MFlow.Wai.Blaze.Html.All hiding(main)
import qualified MFlow.Forms as F
import Data.Typeable
import System.IO.Unsafe
import Control.Workflow
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Logger
import Control.Monad (liftM)
import Data.Monoid
--
queryBusinessClient :: FlowM Html IO ()
queryBusinessClient = do
-- HTML
lastName <- page
$ getString Nothing <! hint "Last Name"
<++ br
<** submitButton "Submit"
page $ wlink () << b "Here2"
page
$ b << ("hey oh"::String)
++> br
++> wlink () << b "click here"
where
hint x = [("placeholder", x)]
site :: FlowM Html IO ()
site = do
-- login
queryBusinessClient
-- logout
where
login = do
r <- page
$ h3 << ("Login"::String)
++> userWidget Nothing userLogin
return r
logout = do
page
$ wlink () << b "Logout"
F.logout
main :: IO ()
main = do
setAdminUser ("nickgeoca"::String) (""::String)
runNavigation "" . transientNav $ do -- TODO: Add TLS here with runSecureNavigation
site