diff --git a/hledger-web/src/Foundation.hs b/hledger-web/src/Foundation.hs index 554042067..7bf5427b5 100644 --- a/hledger-web/src/Foundation.hs +++ b/hledger-web/src/Foundation.hs @@ -9,8 +9,10 @@ import Data.IORef (IORef, readIORef, writeIORef) import Data.List (isPrefixOf) import Data.Maybe (fromMaybe) import Data.Text (Text) +import qualified Data.Text as T import Data.Time.Calendar (Day) import Network.HTTP.Conduit (Manager) +import System.FilePath (takeFileName) import Text.Blaze (Markup) import Text.Blaze.Html.Renderer.String (renderHtml) import Text.Hamlet (hamletFile) @@ -19,6 +21,7 @@ import Yesod.Static import Yesod.Default.Config import Handler.AddForm +import Handler.Common (balanceReportAsHtml) import Settings.StaticFiles import Settings (widgetFile, Extra (..)) #ifndef DEVELOPMENT @@ -28,7 +31,7 @@ import Yesod.Default.Util (addStaticContentExternal) #endif import Hledger -import Hledger.Cli +import Hledger.Cli (CliOpts(..), journalReloadIfChanged) import Hledger.Web.WebOptions -- | The site argument for your application. This can be a good place to @@ -78,50 +81,63 @@ type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget) -- Please see the documentation for the Yesod typeclass. There are a number -- of settings which can be configured by overriding methods here. instance Yesod App where - approot = ApprootMaster $ appRoot . settings + approot = ApprootMaster $ appRoot . settings - -- don't use session data - makeSessionBackend _ = return Nothing + -- don't use session data + makeSessionBackend _ = return Nothing - defaultLayout widget = do - master <- getYesod - lastmsg <- getMessage - VD{j, opts} <- getViewData + defaultLayout widget = do + master <- getYesod + lastmsg <- getMessage + VD{am, here, j, opts, q, qopts, showsidebar} <- getViewData - -- We break up the default layout into two components: - -- default-layout is the contents of the body tag, and - -- default-layout-wrapper is the entire page. Since the final - -- value passed to hamletToRepHtml cannot be a widget, this allows - -- you to use normal widget features in default-layout. - pc <- widgetToPageContent $ do - addStylesheet $ StaticR css_bootstrap_min_css - addStylesheet $ StaticR css_bootstrap_datepicker_standalone_min_css - -- load these things early, in HEAD: - toWidgetHead [hamlet| -