* fixed entry-adding
* temporarily removed adminHandler and merged it into tazBlog :: ServerPart Response
This commit is contained in:
parent
36c4d7e84e
commit
47e1be1f78
2 changed files with 20 additions and 14 deletions
|
|
@ -85,7 +85,7 @@ renderEntry (Entry{..}) = H.div ! A.class_ "innerBox" $ do
|
||||||
H.div ! A.class_ "innerBoxMiddle" $ do
|
H.div ! A.class_ "innerBoxMiddle" $ do
|
||||||
H.article $ H.ul $ H.li $ do
|
H.article $ H.ul $ H.li $ do
|
||||||
preEscapedText $ btext
|
preEscapedText $ btext
|
||||||
preEscapedText $ mtext
|
H.p $ preEscapedText $ mtext
|
||||||
H.div ! A.class_ "innerBoxComments" $ do
|
H.div ! A.class_ "innerBoxComments" $ do
|
||||||
H.div ! A.class_ "cHead" $ toHtml $ cHead lang -- ! A.style "font-size:large;font-weight:bold;"
|
H.div ! A.class_ "cHead" $ toHtml $ cHead lang -- ! A.style "font-size:large;font-weight:bold;"
|
||||||
H.ul $ renderComments comments lang
|
H.ul $ renderComments comments lang
|
||||||
|
|
|
||||||
32
src/Main.hs
32
src/Main.hs
|
|
@ -54,13 +54,29 @@ tazBlog acid =
|
||||||
, path $ \(year :: Int) -> path $ \(month :: Int) -> path $ \(id_ :: String) -> formatOldLink year month id_
|
, path $ \(year :: Int) -> path $ \(month :: Int) -> path $ \(id_ :: String) -> formatOldLink year month id_
|
||||||
, dir "res" $ serveDirectory DisableBrowsing [] "../res"
|
, dir "res" $ serveDirectory DisableBrowsing [] "../res"
|
||||||
, dir "notice" $ ok $ toResponse showSiteNotice
|
, dir "notice" $ ok $ toResponse showSiteNotice
|
||||||
, do dir "admin" $ guardSession acid
|
, do dirs "admin/postentry" $ nullDir
|
||||||
adminHandler acid
|
guardSession acid
|
||||||
|
postEntry acid
|
||||||
|
, do dir "admin" $ nullDir
|
||||||
|
guardSession acid
|
||||||
|
ok $ toResponse $ adminIndex ("tazjin" :: Text)
|
||||||
, dir "admin" $ ok $ toResponse $ adminLogin
|
, dir "admin" $ ok $ toResponse $ adminLogin
|
||||||
, dir "dologin" $ processLogin acid
|
, dir "dologin" $ processLogin acid
|
||||||
, serveDirectory DisableBrowsing [] "../res"
|
, serveDirectory DisableBrowsing [] "../res"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{-
|
||||||
|
adminHandler :: AcidState Blog -> ServerPart Response
|
||||||
|
adminHandler acid =
|
||||||
|
msum [ dir "postentry" $ postEntry acid
|
||||||
|
, dir "entrylist" $ dir (show DE) $ entryList DE
|
||||||
|
, dir "entrylist" $ dir (show EN) $ entryList EN
|
||||||
|
, dir "edit" $ path $ \(eId :: Integer) -> editEntry eId
|
||||||
|
, dir "doedit" $ updateEntry
|
||||||
|
, ok $ toResponse $ adminIndex ("tazjin" :: Text) --User NYI
|
||||||
|
]
|
||||||
|
-}
|
||||||
|
|
||||||
blogHandler :: AcidState Blog -> BlogLang -> ServerPart Response
|
blogHandler :: AcidState Blog -> BlogLang -> ServerPart Response
|
||||||
blogHandler acid lang =
|
blogHandler acid lang =
|
||||||
msum [ path $ \(eId :: Integer) -> showEntry acid lang $ EntryId eId
|
msum [ path $ \(eId :: Integer) -> showEntry acid lang $ EntryId eId
|
||||||
|
|
@ -110,23 +126,13 @@ addComment acid lang eId = do
|
||||||
|
|
||||||
{- ADMIN stuff -}
|
{- ADMIN stuff -}
|
||||||
|
|
||||||
adminHandler :: AcidState Blog -> ServerPart Response
|
|
||||||
adminHandler acid =
|
|
||||||
msum [ dir "postentry" $ postEntry acid
|
|
||||||
, dir "entrylist" $ dir (show DE) $ entryList DE
|
|
||||||
, dir "entrylist" $ dir (show EN) $ entryList EN
|
|
||||||
, dir "edit" $ path $ \(eId :: Integer) -> editEntry eId
|
|
||||||
, dir "doedit" $ updateEntry
|
|
||||||
, ok $ toResponse $ adminIndex ("tazjin" :: Text) --User NYI
|
|
||||||
]
|
|
||||||
|
|
||||||
updateEntry :: ServerPart Response
|
updateEntry :: ServerPart Response
|
||||||
updateEntry = undefined
|
updateEntry = undefined
|
||||||
|
|
||||||
postEntry :: AcidState Blog -> ServerPart Response
|
postEntry :: AcidState Blog -> ServerPart Response
|
||||||
postEntry acid = do
|
postEntry acid = do
|
||||||
liftIO $ putStrLn "postEntry called"
|
decodeBody tmpPolicy
|
||||||
--decodeBody tmpPolicy
|
|
||||||
now <- liftIO $ getCurrentTime
|
now <- liftIO $ getCurrentTime
|
||||||
let eId = timeToId now
|
let eId = timeToId now
|
||||||
lang <- lookText' "lang"
|
lang <- lookText' "lang"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue