hledger-web-1.28: Web-based user interface for the hledger accounting system
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hledger.Web.Foundation

Description

Define the web application's foundation, in the usual Yesod style. See a default Yesod app's comments for more details of each part.

Synopsis

Documentation

data App Source #

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

Instances

Instances details
YesodDispatch App Source # 
Instance details

Defined in Hledger.Web.Application

Yesod App Source # 
Instance details

Defined in Hledger.Web.Foundation

Methods

approot :: Approot App #

catchHandlerExceptions :: MonadUnliftIO m => App -> m a -> (SomeException -> m a) -> m a #

errorHandler :: ErrorResponse -> HandlerFor App TypedContent #

defaultLayout :: WidgetFor App () -> HandlerFor App Html #

urlParamRenderOverride :: App -> Route App -> [(Text, Text)] -> Maybe Builder #

isAuthorized :: Route App -> Bool -> HandlerFor App AuthResult #

isWriteRequest :: Route App -> HandlerFor App Bool #

authRoute :: App -> Maybe (Route App) #

cleanPath :: App -> [Text] -> Either [Text] [Text] #

joinPath :: App -> Text -> [Text] -> [(Text, Text)] -> Builder #

addStaticContent :: Text -> Text -> ByteString -> HandlerFor App (Maybe (Either Text (Route App, [(Text, Text)]))) #

maximumContentLength :: App -> Maybe (Route App) -> Maybe Word64 #

maximumContentLengthIO :: App -> Maybe (Route App) -> IO (Maybe Word64) #

makeLogger :: App -> IO Logger #

messageLoggerSource :: App -> Logger -> Loc -> LogSource -> LogLevel -> LogStr -> IO () #

jsLoader :: App -> ScriptLoadPosition App #

jsAttributes :: App -> [(Text, Text)] #

jsAttributesHandler :: HandlerFor App [(Text, Text)] #

makeSessionBackend :: App -> IO (Maybe SessionBackend) #

fileUpload :: App -> RequestBodyLength -> FileUpload #

shouldLogIO :: App -> LogSource -> LogLevel -> IO Bool #

yesodMiddleware :: ToTypedContent res => HandlerFor App res -> HandlerFor App res #

yesodWithInternalState :: App -> Maybe (Route App) -> (InternalState -> IO a) -> IO a #

defaultMessageWidget :: Html -> HtmlUrl (Route App) -> WidgetFor App () #

ParseRoute App Source # 
Instance details

Defined in Hledger.Web.Foundation

Methods

parseRoute :: ([Text], [(Text, Text)]) -> Maybe (Route App) #

RenderRoute App Source # 
Instance details

Defined in Hledger.Web.Foundation

Associated Types

data Route App #

Methods

renderRoute :: Route App -> ([Text], [(Text, Text)]) #

RouteAttrs App Source # 
Instance details

Defined in Hledger.Web.Foundation

Methods

routeAttrs :: Route App -> Set Text #

RenderMessage App FormMessage Source # 
Instance details

Defined in Hledger.Web.Foundation

Methods

renderMessage :: App -> [Lang] -> FormMessage -> Text #

Read (Route App) Source # 
Instance details

Defined in Hledger.Web.Foundation

Show (Route App) Source # 
Instance details

Defined in Hledger.Web.Foundation

Eq (Route App) Source # 
Instance details

Defined in Hledger.Web.Foundation

Methods

(==) :: Route App -> Route App -> Bool #

(/=) :: Route App -> Route App -> Bool #

data Route App Source # 
Instance details

Defined in Hledger.Web.Foundation

Creates the route datatype AppRoute. Every valid URL in your

Creates the associated type:

Creates the value resourcesApp which contains information on the

resourcesApp :: [ResourceTree String] Source #

defines things like: type Handler = HandlerFor App -- HandlerT App IO, https://www.yesodweb.com/book/routing-and-handlers#routing-and-handlers_handler_monad type Widget = WidgetFor App () -- WidgetT App IO (), https://www.yesodweb.com/book/widgets

data ViewData Source #

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

Constructors

VD 

Fields

  • opts :: WebOpts

    the command-line options at startup

  • today :: Day

    today's date (for queries containing relative dates)

  • j :: Journal

    the up-to-date parsed unfiltered journal

  • q :: Text

    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

  • caps :: [Capability]

    capabilities enabled for this request

Instances

Instances details
Show ViewData Source # 
Instance details

Defined in Hledger.Web.Foundation

getViewData :: Handler ViewData Source #

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

shouldShowSidebar :: Handler Bool Source #

Find out if the sidebar should be visible. Show it, unless there is a showsidebar cookie set to "0", or a ?sidebar=0 query parameter.

getCurrentJournal :: IORef Journal -> CliOpts -> Day -> Handler (Journal, Maybe String) Source #

Update our copy of the journal if the file changed. If there is an error while reloading, keep the old one and return the error, and set a ui message.

Orphan instances

Show Markup Source # 
Instance details