The add form has become a modal dialog, and been moved into the default template. This simplifies some things, for now. Eg it's easily accessible from any page.
23 lines
589 B
Haskell
23 lines
589 B
Haskell
-- | Web handler utilities. More of these are in Foundation.hs, where
|
|
-- they can be used in the default template.
|
|
|
|
module Handler.Utils where
|
|
|
|
import Prelude
|
|
import Data.Time.Calendar
|
|
import Data.Time.Clock
|
|
import Data.Time.Format
|
|
import System.Locale (defaultTimeLocale)
|
|
|
|
|
|
numbered :: [a] -> [(Int,a)]
|
|
numbered = zip [1..]
|
|
|
|
dayToJsTimestamp :: Day -> Integer
|
|
dayToJsTimestamp d = read (formatTime defaultTimeLocale "%s" t) * 1000 -- XXX read
|
|
where t = UTCTime d (secondsToDiffTime 0)
|
|
|
|
chomp :: String -> String
|
|
chomp = reverse . dropWhile (`elem` "\r\n") . reverse
|
|
|