From 615dc09ffc321ce04d3014b3a9f07e7f04b69c80 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 26 Jul 2012 22:54:31 -0400 Subject: [PATCH] use widgetFile --- Assistant/Threads/WebApp.hs | 5 ++--- Utility/Yesod.hs | 17 ++++++----------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Assistant/Threads/WebApp.hs b/Assistant/Threads/WebApp.hs index 593c43eae3..addb49f79d 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 a0dd3bdd2f..2d2c6c3436 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 - @@ -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