summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-26 22:54:31 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-26 22:54:31 -0400
commit615dc09ffc321ce04d3014b3a9f07e7f04b69c80 (patch)
treeec04421e462af79b7ad5e27fc71ecf6a9d3f2695
parente40f94cbcdcacebb8215ee16b5c575ca865ad810 (diff)
use widgetFile
-rw-r--r--Assistant/Threads/WebApp.hs5
-rw-r--r--Utility/Yesod.hs17
2 files changed, 8 insertions, 14 deletions
diff --git a/Assistant/Threads/WebApp.hs b/Assistant/Threads/WebApp.hs
index 593c43eae..addb49f79 100644
--- a/Assistant/Threads/WebApp.hs
+++ b/Assistant/Threads/WebApp.hs
@@ -21,7 +21,6 @@ import Git
import Yesod
import Yesod.Static
import Text.Hamlet
-import Text.Julius
import Network.Socket (PortNumber)
import Text.Blaze.Renderer.String
import Data.Text
@@ -90,7 +89,7 @@ autoUpdate poll gethtml home ms_delay ms_startdelay = do
let delay = show ms_delay
let startdelay = show ms_startdelay
addScriptRemote "http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"
- toWidgetHead $(juliusFile $ juliusTemplate "longpolling")
+ $(widgetFile "longpolling")
where
ms_to_seconds :: Int -> Int
ms_to_seconds ms = ceiling ((fromIntegral ms :: Double) / 1000)
@@ -102,7 +101,7 @@ statusDisplay = do
time <- show <$> liftIO getCurrentTime
poll <- lift newIdent
- $(whamletFile $ hamletTemplate "status")
+ $(widgetFile "status")
autoUpdate poll StatusR HomeR (3000 :: Int) (40 :: Int)
diff --git a/Utility/Yesod.hs b/Utility/Yesod.hs
index a0dd3bdd2..2d2c6c343 100644
--- a/Utility/Yesod.hs
+++ b/Utility/Yesod.hs
@@ -1,4 +1,4 @@
-{- Yesod stuff
+{- Yesod stuff, that's typically found in the scaffolded site.
-
- Copyright 2012 Joey Hess <joey@kitenet.net>
-
@@ -7,16 +7,11 @@
module Utility.Yesod where
-import System.FilePath
+import Yesod.Default.Util
+import Language.Haskell.TH.Syntax
-{- Filename of a template, in the templates/ directory. -}
-template :: FilePath -> FilePath
-template f = "templates" </> f
+widgetFile :: String -> Q Exp
+widgetFile = widgetFileNoReload
-{- A hamlet template file. -}
hamletTemplate :: FilePath -> FilePath
-hamletTemplate f = template f ++ ".hamlet"
-
-{- A julius template file. -}
-juliusTemplate :: FilePath -> FilePath
-juliusTemplate f = template f ++ ".julius"
+hamletTemplate f = globFile "hamlet" f