hledger-web-1.3: Web interface for the hledger accounting tool

Safe Haskell | None
Language | Haskell2010

Foundation

Contents

- Creates the route datatype AppRoute. Every valid URL in your
- Creates the associated type:
- Creates the value resourcesApp which contains information on the
- Orphan instances

Synopsis

- data App = App {
  - settings :: AppConfig DefaultEnv Extra
  - getStatic :: Static
  - httpManager :: Manager
  - appOpts :: WebOpts
  - appJournal :: IORef Journal
  }
- data AppMessage = MsgHello {
  }
- type Handler = HandlerT App IO
- type Widget = WidgetT App IO ()
- resourcesApp :: [ResourceTree String]
- type AppRoute = Route App
- type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget)
- getExtra :: Handler Extra
- data ViewData = VD {
  - opts :: WebOpts
  - here :: AppRoute
  - msg :: Maybe Html
  - today :: Day
  - j :: Journal
  - q :: String
  - m :: Query
  - qopts :: [QueryOpt]
  - am :: Query
  - aopts :: [QueryOpt]
  - showpostings :: Bool
  - showsidebar :: Bool
  }
- nullviewdata :: ViewData
- viewdataWithDateAndParams :: Day -> String -> String -> String -> ViewData
- getViewData :: Handler ViewData
- getLastMessage :: Handler (Maybe Html)
- addform :: Text -> ViewData -> HtmlUrl AppRoute
- journalselect :: [FilePath] -> HtmlUrl AppRoute
- journalradio :: [FilePath] -> HtmlUrl AppRoute

# Documentation

data App #

The site argument for your application. This can be a good place to keep settings and values requiring initialization before your application starts running, such as database connections. Every handler will have access to the data present here.

Constructors

App |
Fields settings :: AppConfig DefaultEnv Extra getStatic :: Static Settings for static file serving. httpManager :: Manager appOpts :: WebOpts appJournal :: IORef Journal

Instances

RouteAttrs App # |
Methods routeAttrs :: Route App -> Set Text #
ParseRoute App # |
Methods parseRoute :: ([Text], [(Text, Text)]) -> Maybe (Route App) #
RenderRoute App # |
Associated Types data Route App :: * # Methods renderRoute :: Route App -> ([Text], [(Text, Text)]) #
Yesod App # |
Methods approot :: Approot App # errorHandler :: ErrorResponse -> HandlerT App IO TypedContent # defaultLayout :: WidgetT App IO () -> HandlerT App IO Html # urlRenderOverride :: App -> Route App -> Maybe Builder # urlParamRenderOverride :: App -> Route App -> [(Text, Text)] -> Maybe Builder # isAuthorized :: Route App -> Bool -> HandlerT App IO AuthResult # isWriteRequest :: Route App -> HandlerT App IO Bool # authRoute :: App -> Maybe (Route App) # cleanPath :: App -> [Text] -> Either [Text] [Text] # joinPath :: App -> Text -> [Text] -> [(Text, Text)] -> Builder # addStaticContent :: Text -> Text -> ByteString -> HandlerT App IO (Maybe (Either Text (Route App, [(Text, Text)]))) # maximumContentLength :: App -> Maybe (Route App) -> Maybe Word64 # makeLogger :: App -> IO Logger # messageLoggerSource :: App -> Logger -> Loc -> LogSource -> LogLevel -> LogStr -> IO () # jsLoader :: App -> ScriptLoadPosition App # jsAttributes :: App -> [(Text, Text)] # makeSessionBackend :: App -> IO (Maybe SessionBackend) # fileUpload :: App -> RequestBodyLength -> FileUpload # shouldLog :: App -> LogSource -> LogLevel -> Bool # shouldLogIO :: App -> LogSource -> LogLevel -> IO Bool # yesodMiddleware :: ToTypedContent res => HandlerT App IO res -> HandlerT App IO res # yesodWithInternalState :: App -> Maybe (Route App) -> (InternalState -> IO a) -> IO a # defaultMessageWidget :: Html -> HtmlUrl (Route App) -> WidgetT App IO () #
RenderMessage App FormMessage # |
Methods renderMessage :: App -> [Lang] -> FormMessage -> Text #
RenderMessage App AppMessage # |
Methods renderMessage :: App -> [Lang] -> AppMessage -> Text #
Eq (Route App) # |
Methods (==) :: Route App -> Route App -> Bool # (/=) :: Route App -> Route App -> Bool #
Read (Route App) # |
Methods readsPrec :: Int -> ReadS (Route App) # readList :: ReadS [Route App] # readPrec :: ReadPrec (Route App) # readListPrec :: ReadPrec [Route App] #
Show (Route App) # |
Methods showsPrec :: Int -> Route App -> ShowS # show :: Route App -> String # showList :: [Route App] -> ShowS #
data Route App # |
data Route App = FaviconR | RobotsR | StaticR (Route Static) | RootR | JournalR | RegisterR | SidebarR

data AppMessage #

Constructors

MsgHello |

Instances

RenderMessage App AppMessage # |
Methods renderMessage :: App -> [Lang] -> AppMessage -> Text #

# Creates the route datatype AppRoute. Every valid URL in your

# Creates the associated type:

# Creates the value resourcesApp which contains information on the

type Handler = HandlerT App IO #

type Widget = WidgetT App IO () #

resourcesApp :: [ResourceTree String] #

type AppRoute = Route App #

A convenience alias.

type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget) #

getExtra :: Handler Extra #

Get the `Extra` value, used to hold data from the settings.yml file.

data ViewData #

A bundle of data useful for hledger-web request handlers and templates.

Constructors

VD |
Fields opts :: WebOpts the command-line options at startup here :: AppRoute the current route msg :: Maybe Html the current UI message if any, possibly from the current request today :: Day today's date (for queries containing relative dates) j :: Journal the up-to-date parsed unfiltered journal q :: String the current q parameter, the main query expression m :: Query a query parsed from the q parameter qopts :: [QueryOpt] query options parsed from the q parameter am :: Query a query parsed from the accounts sidebar query expr ("a" parameter) aopts :: [QueryOpt] query options parsed from the accounts sidebar query expr showpostings :: Bool current p parameter, 1 or 0 shows/hides all postings where applicable showsidebar :: Bool current showsidebar cookie value

Instances

Show ViewData # |
Methods showsPrec :: Int -> ViewData -> ShowS # show :: ViewData -> String # showList :: [ViewData] -> ShowS #

nullviewdata :: ViewData #

Make a default ViewData, using day 0 as today's date.

viewdataWithDateAndParams :: Day -> String -> String -> String -> ViewData #

Make a ViewData using the given date and request parameters, and defaults elsewhere.

getViewData :: Handler ViewData #

Gather data used by handlers and templates in the current request.

getLastMessage :: Handler (Maybe Html) #

Get the message that was set by the last request, in a referentially transparent manner (allowing multiple reads).

addform :: Text -> ViewData -> HtmlUrl AppRoute #

Add transaction form.

journalselect :: [FilePath] -> HtmlUrl AppRoute #

journalradio :: [FilePath] -> HtmlUrl AppRoute #

# Orphan instances

Show Markup # |
Methods showsPrec :: Int -> Markup -> ShowS # show :: Markup -> String # showList :: [Markup] -> ShowS #