use widgetFile
This commit is contained in:
parent
e40f94cbcd
commit
615dc09ffc
2 changed files with 8 additions and 14 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue