web: use normalise, bootstrap, and widgets
This commit is contained in:
parent
a44d30e6f1
commit
3da5f3c0c6
@ -17,13 +17,13 @@ import Network.HTTP.Conduit (Manager)
|
|||||||
-- import qualified Settings
|
-- import qualified Settings
|
||||||
import Settings.Development (development)
|
import Settings.Development (development)
|
||||||
import Settings.StaticFiles
|
import Settings.StaticFiles
|
||||||
import Settings ({-widgetFile,-} Extra (..))
|
import Settings (widgetFile, Extra (..))
|
||||||
#ifndef DEVELOPMENT
|
#ifndef DEVELOPMENT
|
||||||
import Settings (staticDir)
|
import Settings (staticDir)
|
||||||
import Text.Jasmine (minifym)
|
import Text.Jasmine (minifym)
|
||||||
#endif
|
#endif
|
||||||
import Web.ClientSession (getKey)
|
import Web.ClientSession (getKey)
|
||||||
-- import Text.Hamlet (hamletFile)
|
import Text.Hamlet (hamletFile)
|
||||||
|
|
||||||
import Hledger.Web.Options
|
import Hledger.Web.Options
|
||||||
-- import Hledger.Web.Settings
|
-- import Hledger.Web.Settings
|
||||||
@ -82,15 +82,15 @@ instance Yesod App where
|
|||||||
key <- getKey ".hledger-web_client_session_key.aes"
|
key <- getKey ".hledger-web_client_session_key.aes"
|
||||||
return . Just $ clientSessionBackend key 120
|
return . Just $ clientSessionBackend key 120
|
||||||
|
|
||||||
-- defaultLayout widget = do
|
defaultLayout widget = do
|
||||||
-- master <- getYesod
|
master <- getYesod
|
||||||
-- mmsg <- getMessage
|
mmsg <- getMessage
|
||||||
|
|
||||||
-- -- We break up the default layout into two components:
|
-- We break up the default layout into two components:
|
||||||
-- -- default-layout is the contents of the body tag, and
|
-- default-layout is the contents of the body tag, and
|
||||||
-- -- default-layout-wrapper is the entire page. Since the final
|
-- default-layout-wrapper is the entire page. Since the final
|
||||||
-- -- value passed to hamletToRepHtml cannot be a widget, this allows
|
-- value passed to hamletToRepHtml cannot be a widget, this allows
|
||||||
-- -- you to use normal widget features in default-layout.
|
-- you to use normal widget features in default-layout.
|
||||||
|
|
||||||
-- pc <- widgetToPageContent $ do
|
-- pc <- widgetToPageContent $ do
|
||||||
-- $(widgetFile "normalize")
|
-- $(widgetFile "normalize")
|
||||||
@ -98,27 +98,21 @@ instance Yesod App where
|
|||||||
-- $(widgetFile "default-layout")
|
-- $(widgetFile "default-layout")
|
||||||
-- hamletToRepHtml $(hamletFile "templates/default-layout-wrapper.hamlet")
|
-- hamletToRepHtml $(hamletFile "templates/default-layout-wrapper.hamlet")
|
||||||
|
|
||||||
defaultLayout widget = do
|
|
||||||
pc <- widgetToPageContent $ do
|
pc <- widgetToPageContent $ do
|
||||||
widget
|
$(widgetFile "normalize")
|
||||||
hamletToRepHtml [hamlet|
|
addStylesheet $ StaticR css_bootstrap_css
|
||||||
$doctype 5
|
-- load jquery early:
|
||||||
<html>
|
toWidgetHead [hamlet| <script type="text/javascript" src="/static/jquery.js"></script> |]
|
||||||
<head>
|
addScript $ StaticR jquery_url_js
|
||||||
<title>#{pageTitle pc}
|
addScript $ StaticR jquery_flot_js
|
||||||
^{pageHead pc}
|
toWidget [hamlet| \<!--[if lte IE 8]> <script type="text/javascript" src="excanvas.min.js"></script> <![endif]--> |]
|
||||||
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
|
addScript $ StaticR dhtmlxcommon_js
|
||||||
<script type=text/javascript src=@{StaticR jquery_js}>
|
addScript $ StaticR dhtmlxcombo_js
|
||||||
<script type=text/javascript src=@{StaticR jquery_url_js}>
|
addStylesheet $ StaticR style_css
|
||||||
<script type=text/javascript src=@{StaticR jquery_flot_js}>
|
addScript $ StaticR hledger_js
|
||||||
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="excanvas.min.js"></script><![endif]-->
|
$(widgetFile "default-layout")
|
||||||
<script type=text/javascript src=@{StaticR dhtmlxcommon_js}>
|
|
||||||
<script type=text/javascript src=@{StaticR dhtmlxcombo_js}>
|
hamletToRepHtml $(hamletFile "templates/default-layout-wrapper.hamlet")
|
||||||
<script type=text/javascript src=@{StaticR hledger_js}>
|
|
||||||
<link rel=stylesheet type=text/css media=all href=@{StaticR style_css}>
|
|
||||||
<body>
|
|
||||||
^{pageBody pc}
|
|
||||||
|]
|
|
||||||
|
|
||||||
-- -- This is done to provide an optimization for serving static files from
|
-- -- This is done to provide an optimization for serving static files from
|
||||||
-- -- a separate domain. Please see the staticRoot setting in Settings.hs
|
-- -- a separate domain. Please see the staticRoot setting in Settings.hs
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user