Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved reloadTemplates into Network.Gitit; use in gitit.hs.

  • Loading branch information...
commit ee857a1d1955e3104927e1a43132a470d0780a16 1 parent 70113a5
@jgm authored
Showing with 10 additions and 13 deletions.
  1. +6 −1 Network/Gitit.hs
  2. +0 −11 Network/Gitit/Handlers.hs
  3. +4 −1 gitit.hs
View
7 Network/Gitit.hs
@@ -90,6 +90,7 @@ module Network.Gitit ( initializeGititState
, createRepoIfMissing
, createTemplateIfMissing
, createStaticIfMissing
+ , reloadTemplates
, GititServerPart
)
where
@@ -136,7 +137,6 @@ wikiHandlers =
, dir "_upload" $ methodOnly POST >> ifLoggedIn uploadFile loginUserForm
, dir "_random" $ methodOnly GET >> randomPage
, dir "_index" indexPage
- , dir "_reloadTemplates" reloadTemplates
, dir "_category" $ path $ categoryPage . decodeString
, dir "_categories" categoryListPage
, guardCommand "showraw" >> msum
@@ -168,6 +168,11 @@ wikiHandlers =
, createPage
]
+reloadTemplates :: ServerPart Response
+reloadTemplates = do
+ liftIO $ recompilePageTemplate
+ ok $ toResponse "Page templates have been recompiled."
+
unpackReaderT:: (Monad m)
=> c
-> (ReaderT c m) (Maybe ((Either Response a), FilterFun Response))
View
11 Network/Gitit/Handlers.hs
@@ -56,7 +56,6 @@ module Network.Gitit.Handlers (
, resetPasswordRequest
, resetPassword
, doResetPassword
- , reloadTemplates
, authHandler
)
where
@@ -66,7 +65,6 @@ import Network.Gitit.Framework
import Network.Gitit.Layout
import Network.Gitit.State
import Network.Gitit.Types
-import Network.Gitit.Initialize (recompilePageTemplate)
import Network.Gitit.Util (orIfNull)
import Network.Gitit.Authentication
import Network.Gitit.ContentTransformer (showRawPage, showFileAsText, showPage,
@@ -720,15 +718,6 @@ categoryListPage = do
pgScripts = ["search.js"],
pgTitle = "Categories" } htmlMatches
-reloadTemplates :: Handler
-reloadTemplates = do
- liftIO $ recompilePageTemplate
- formattedPage defaultPageLayout{
- pgShowPageTools = False,
- pgTabs = [],
- pgTitle = "Tada!" } $
- p << "Page templates have been recompiled."
-
authHandler :: Handler
authHandler = msum $
[ dir "_register" $ methodSP GET $ withData registerUserForm
View
5 gitit.hs
@@ -73,4 +73,7 @@ main = do
let serverConf = Conf { validator = Nothing, port = portNumber conf' }
-- start the server
- simpleHTTP serverConf $ wikiHandler conf'
+ simpleHTTP serverConf $ msum [
+ wikiHandler conf'
+ , dir "_reloadTemplates" reloadTemplates
+ ]
Please sign in to comment.
Something went wrong with that request. Please try again.