web: cleanup
This commit is contained in:
parent
b5c39dfa8f
commit
f2ac47b567
@ -1,7 +1,7 @@
|
||||
^{accountsheading}
|
||||
<table.balancereport>
|
||||
$forall i <- items
|
||||
^{itemAsHtml' i}
|
||||
^{itemAsHtml vd i}
|
||||
<tr.totalrule>
|
||||
<td colspan=2>
|
||||
<tr>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<tr.item
|
||||
<td.account
|
||||
#{indent}
|
||||
<a href="@{here}?a=#{acctpat}#{pparam}">#{adisplay}
|
||||
<td.balance align=right>#{mixedAmountAsHtml abal}
|
||||
<tr.item
|
||||
<td.account
|
||||
#{indent}
|
||||
<a href="@{here}?a=#{acctpat}#{pparam}">#{adisplay}
|
||||
<td.balance align=right>#{mixedAmountAsHtml abal}
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
<form#editform method=POST style=display:none;
|
||||
<table.form#editform
|
||||
$if manyfiles
|
||||
<tr
|
||||
<td colspan=2
|
||||
Editing ^{journalselect $ files j}
|
||||
<form#editform method=POST style=display:none;
|
||||
<table.form#editform
|
||||
$if manyfiles
|
||||
<tr
|
||||
<td colspan=2
|
||||
<!-- XXX textarea ids are unquoted journal file paths here, not valid html -->
|
||||
$forall f <- files j
|
||||
<textarea id=#{fst f}_textarea name=text rows=25 cols=80 style=display:none; disabled=disabled
|
||||
#{snd f}
|
||||
<tr#addbuttonrow
|
||||
<td
|
||||
<span.help>^{formathelp}
|
||||
<td align=right
|
||||
<span.help Are you sure ? This will overwrite the journal. #
|
||||
<input type=hidden name=action value=edit
|
||||
<input type=submit name=submit value="save journal"
|
||||
\ or #
|
||||
<a href onclick="return editformToggle(event)">cancel
|
||||
Editing ^{journalselect $ files j}
|
||||
<tr
|
||||
<td colspan=2
|
||||
<!-- XXX textarea ids are unquoted journal file paths here, not valid html -->
|
||||
$forall f <- files j
|
||||
<textarea id=#{fst f}_textarea name=text rows=25 cols=80 style=display:none; disabled=disabled
|
||||
#{snd f}
|
||||
<tr#addbuttonrow
|
||||
<td
|
||||
<span.help>^{formathelp}
|
||||
<td align=right
|
||||
<span.help Are you sure ? This will overwrite the journal. #
|
||||
<input type=hidden name=action value=edit
|
||||
<input type=submit name=submit value="save journal"
|
||||
\ or #
|
||||
<a href onclick="return editformToggle(event)">cancel
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<a#addformlink href onclick="return addformToggle(event)">add transaction
|
||||
<a#importformlink href onclick="return importformToggle(event)" style="display:none;">import transactions
|
||||
\ | #
|
||||
<a#editformlink href onclick="return editformToggle(event)">edit journal
|
||||
<a#addformlink href onclick="return addformToggle(event)">add transaction
|
||||
<a#importformlink href onclick="return importformToggle(event)" style="display:none;">import transactions
|
||||
\ | #
|
||||
<a#editformlink href onclick="return editformToggle(event)">edit journal
|
||||
|
||||
@ -1,25 +1,25 @@
|
||||
<div#filterformdiv
|
||||
<form#filterform.form method=GET style=display:#{visible};
|
||||
<table.form
|
||||
<tr.#{filteringperiodclass}
|
||||
<td
|
||||
filter by period:
|
||||
\ #
|
||||
<td
|
||||
<input name=p size=60 value=#{p}
|
||||
^{phelp}
|
||||
\ #
|
||||
<td align=right
|
||||
^{stopfilteringperiod}
|
||||
<tr.#{filteringclass}
|
||||
<td
|
||||
filter by account/description:
|
||||
\ #
|
||||
<td
|
||||
<input name=a size=60 value=#{a}
|
||||
^{ahelp}
|
||||
\ #
|
||||
<input type=submit value=filter #
|
||||
\ #
|
||||
<td align=right
|
||||
^{stopfiltering}
|
||||
<div#filterformdiv
|
||||
<form#filterform.form method=GET style=display:#{visible};
|
||||
<table.form
|
||||
<tr.#{filteringperiodclass}
|
||||
<td
|
||||
filter by period:
|
||||
\ #
|
||||
<td
|
||||
<input name=p size=60 value=#{p}
|
||||
^{phelp}
|
||||
\ #
|
||||
<td align=right
|
||||
^{stopfilteringperiod}
|
||||
<tr.#{filteringclass}
|
||||
<td
|
||||
filter by account/description:
|
||||
\ #
|
||||
<td
|
||||
<input name=a size=60 value=#{a}
|
||||
^{ahelp}
|
||||
\ #
|
||||
<input type=submit value=filter #
|
||||
\ #
|
||||
<td align=right
|
||||
^{stopfiltering}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<form#importform method=POST style=display:none;
|
||||
<table.form
|
||||
<tr
|
||||
<td
|
||||
<input type=file name=file
|
||||
<input type=hidden name=action value=import
|
||||
<input type=submit name=submit value="import from file"
|
||||
\ or #
|
||||
<a href onclick="return importformToggle(event)" cancel
|
||||
<form#importform method=POST style=display:none;
|
||||
<table.form
|
||||
<tr
|
||||
<td
|
||||
<input type=file name=file
|
||||
<input type=hidden name=action value=import
|
||||
<input type=submit name=submit value="import from file"
|
||||
\ or #
|
||||
<a href onclick="return importformToggle(event)" cancel
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
<table.journalreport>
|
||||
$forall i <- number items
|
||||
^{itemAsHtml' i}
|
||||
$forall i <- numbered items
|
||||
^{itemAsHtml vd i}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
<tr.item.#{evenodd} >
|
||||
<td.transaction>
|
||||
<pre> #{txn}
|
||||
<tr.item.#{evenodd}>
|
||||
<td.transaction>
|
||||
<pre>#{txn}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
<select id=journalselect name=journal onchange="editformJournalSelect(event)"
|
||||
$forall f <- journalfiles
|
||||
<option value=#{fst f}>#{fst f}
|
||||
<select id=journalselect name=journal onchange="editformJournalSelect(event)"
|
||||
$forall f <- journalfiles
|
||||
<option value=#{fst f}>#{fst f}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<div#navlinks
|
||||
^{accountsjournallink}
|
||||
\ | #
|
||||
^{accountsregisterlink}
|
||||
\ | #
|
||||
^{editlinks}
|
||||
<div#navlinks
|
||||
^{accountsjournallink}
|
||||
\ | #
|
||||
^{accountsregisterlink}
|
||||
\ | #
|
||||
^{editlinks}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
<tr#postingrow
|
||||
<td align=right>#{acctlabel}:
|
||||
<td
|
||||
<select id=#{acctvar} name=#{acctvar}
|
||||
<option
|
||||
$forall a <- acctnames
|
||||
<option value=#{a}>#{a}
|
||||
^{amtfield}
|
||||
<tr.helprow
|
||||
<td
|
||||
<td
|
||||
<span.help>#{accthelp}
|
||||
<td
|
||||
<td
|
||||
<span.help>#{amthelp}
|
||||
<tr#postingrow
|
||||
<td align=right>#{acctlabel}:
|
||||
<td
|
||||
<select id=#{acctvar} name=#{acctvar}
|
||||
<option
|
||||
$forall a <- acctnames
|
||||
<option value=#{a}>#{a}
|
||||
^{amtfield}
|
||||
<tr.helprow
|
||||
<td
|
||||
<td
|
||||
<span.help>#{accthelp}
|
||||
<td
|
||||
<td
|
||||
<span.help>#{amthelp}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<td style=padding-left:1em;
|
||||
Amount:
|
||||
<td
|
||||
<input.textinput size=15 name=#{amtvar} value=""
|
||||
<td style=padding-left:1em;
|
||||
Amount:
|
||||
<td
|
||||
<input.textinput size=15 name=#{amtvar} value=""
|
||||
|
||||
@ -5,5 +5,5 @@
|
||||
<th.account align=left Account
|
||||
<th.amount align=right Amount
|
||||
<th.balance align=right Balance
|
||||
$forall i <- number items
|
||||
^{itemAsHtml' i}
|
||||
$forall i <- numbered items
|
||||
^{itemAsHtml vd i}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<tr.item.#{evenodd}.#{firstposting}
|
||||
<td.date>#{date}
|
||||
<td.description>#{desc}
|
||||
<td.account
|
||||
<a href="@{here}?a=#{acctpat}#{pparam}">#{acct}
|
||||
<td.amount align=right>#{mixedAmountAsHtml $ pamount posting}
|
||||
<td.balance align=right>#{mixedAmountAsHtml b}
|
||||
<tr.item.#{evenodd}.#{firstposting}
|
||||
<td.date>#{date}
|
||||
<td.description>#{desc}
|
||||
<td.account><a href="@{here}?a=#{acctpat}#{pparam}">#{acct}
|
||||
<td.amount align=right>#{mixedAmountAsHtml $ pamount posting}
|
||||
<td.balance align=right>#{mixedAmountAsHtml b}
|
||||
|
||||
@ -81,8 +81,8 @@ instance Yesod App where
|
||||
addCassius $(Settings.cassiusFile "default-layout")
|
||||
hamletToRepHtml $(Settings.hamletFile "default-layout")
|
||||
|
||||
-- This is done to provide an optimization for serving static files from
|
||||
-- a separate domain. Please see the staticroot setting in Settings.hs
|
||||
-- -- This is done to provide an optimization for serving static files from
|
||||
-- -- a separate domain. Please see the staticroot setting in Settings.hs
|
||||
-- urlRenderOverride a (StaticR s) =
|
||||
-- Just $ uncurry (joinPath a Settings.staticroot) $ renderRoute s
|
||||
-- urlRenderOverride _ _ = Nothing
|
||||
|
||||
@ -2,24 +2,22 @@
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
module AppRun
|
||||
( withApp
|
||||
, withDevelApp
|
||||
) where
|
||||
module AppRun (
|
||||
withApp
|
||||
,withDevelApp
|
||||
)
|
||||
where
|
||||
|
||||
import App
|
||||
import Settings
|
||||
import Yesod.Helpers.Static
|
||||
-- import Data.ByteString (ByteString)
|
||||
import Network.Wai (Application)
|
||||
import Data.Dynamic (Dynamic, toDyn)
|
||||
-- import System.FilePath ((</>))
|
||||
|
||||
-- Import all relevant handler modules here.
|
||||
import Handlers
|
||||
import Network.Wai (Application)
|
||||
import Yesod.Helpers.Static
|
||||
|
||||
import Hledger.Data (nulljournal)
|
||||
|
||||
import App
|
||||
import Handlers
|
||||
import Settings
|
||||
|
||||
-- This line actually creates our YesodSite instance. It is the second half
|
||||
-- of the call to mkYesodData which occurs in App.hs. Please see
|
||||
-- the comments there for more details.
|
||||
@ -30,13 +28,9 @@ mkYesodDispatch "App" resourcesApp
|
||||
-- place to put your migrate statements to have automatic database
|
||||
-- migrations handled by Yesod.
|
||||
withApp :: App -> (Application -> IO a) -> IO a
|
||||
withApp a f = do
|
||||
toWaiApp a >>= f
|
||||
-- where
|
||||
-- s = static Settings.staticdir
|
||||
withApp a f = toWaiApp a >>= f
|
||||
|
||||
withDevelApp :: Dynamic
|
||||
-- withDevelApp = undefined
|
||||
withDevelApp = toDyn (withApp a :: (Application -> IO ()) -> IO ())
|
||||
where a = App{
|
||||
getStatic=static Settings.staticdir
|
||||
@ -45,4 +39,3 @@ withDevelApp = toDyn (withApp a :: (Application -> IO ()) -> IO ())
|
||||
,appArgs=[]
|
||||
,appJournal=nulljournal
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +57,6 @@ getJournalR = do
|
||||
vd@VD{opts=opts,fspec=fspec,j=j} <- getViewData
|
||||
let sidecontent = balanceReportAsHtml opts vd $ balanceReport opts fspec j
|
||||
maincontent = journalReportAsHtml opts vd $ journalReport opts fspec j
|
||||
editform' = editform vd
|
||||
defaultLayout $ do
|
||||
setTitle "hledger-web journal"
|
||||
addHamlet $(Settings.hamletFile "journal")
|
||||
@ -115,7 +114,6 @@ getAccountsOnlyR = do
|
||||
balanceReportAsHtml :: [Opt] -> ViewData -> BalanceReport -> Hamlet AppRoute
|
||||
balanceReportAsHtml _ vd@VD{here=here,a=a,p=p} (items,total) = $(Settings.hamletFile "balancereport")
|
||||
where
|
||||
itemAsHtml' = itemAsHtml vd
|
||||
itemAsHtml :: ViewData -> BalanceReportItem -> Hamlet AppRoute
|
||||
itemAsHtml VD{p=p} (acct, adisplay, adepth, abal) = $(Settings.hamletFile "balancereportitem")
|
||||
where
|
||||
@ -143,8 +141,6 @@ balanceReportAsHtml _ vd@VD{here=here,a=a,p=p} (items,total) = $(Settings.hamlet
|
||||
journalReportAsHtml :: [Opt] -> ViewData -> JournalReport -> Hamlet AppRoute
|
||||
journalReportAsHtml _ vd items = $(Settings.hamletFile "journalreport")
|
||||
where
|
||||
number = zip [1..]
|
||||
itemAsHtml' = itemAsHtml vd
|
||||
itemAsHtml :: ViewData -> (Int, JournalReportItem) -> Hamlet AppRoute
|
||||
itemAsHtml _ (n, t) = $(Settings.hamletFile "journalreportitem")
|
||||
where
|
||||
@ -155,8 +151,6 @@ journalReportAsHtml _ vd items = $(Settings.hamletFile "journalreport")
|
||||
registerReportAsHtml :: [Opt] -> ViewData -> RegisterReport -> Hamlet AppRoute
|
||||
registerReportAsHtml _ vd items = $(Settings.hamletFile "registerreport")
|
||||
where
|
||||
number = zip [1..]
|
||||
itemAsHtml' = itemAsHtml vd
|
||||
itemAsHtml :: ViewData -> (Int, RegisterReportItem) -> Hamlet AppRoute
|
||||
itemAsHtml VD{here=here,p=p} (n, (ds, posting, b)) = $(Settings.hamletFile "registerreportitem")
|
||||
where
|
||||
@ -494,3 +488,4 @@ words' = fromparse . parsewith ((quotedPattern <|> pattern) `sepBy` many1 spacen
|
||||
pattern = many (noneOf " \n\r\"")
|
||||
quotedPattern = between (oneOf "'\"") (oneOf "'\"") $ many $ noneOf "'\""
|
||||
|
||||
numbered = zip [1..]
|
||||
|
||||
@ -16,10 +16,10 @@ module Settings
|
||||
, widgetFile
|
||||
, datadir
|
||||
, staticdir
|
||||
-- , staticroot
|
||||
, defhost
|
||||
, defport
|
||||
, defapproot
|
||||
-- , staticroot
|
||||
-- , browserstartdelay
|
||||
, hledgerorgurl
|
||||
, manualurl
|
||||
@ -65,27 +65,27 @@ defapproot = pack $ printf "http://%s:%d" defhost defport
|
||||
datadir :: FilePath
|
||||
datadir = "./.hledger/web/"
|
||||
|
||||
-- -- | The base URL for your static files. As you can see by the default
|
||||
-- -- value, this can simply be "static" appended to your application root.
|
||||
-- -- A powerful optimization can be serving static files from a separate
|
||||
-- -- domain name. This allows you to use a web server optimized for static
|
||||
-- -- files, more easily set expires and cache values, and avoid possibly
|
||||
-- -- costly transference of cookies on static files. For more information,
|
||||
-- -- please see:
|
||||
-- -- http://code.google.com/speed/page-speed/docs/request.html#ServeFromCookielessDomain
|
||||
-- --
|
||||
-- -- If you change the resource pattern for StaticR in hledger-web.hs, you will
|
||||
-- -- have to make a corresponding change here.
|
||||
-- --
|
||||
-- -- To see how this value is used, see urlRenderOverride in hledger-web.hs
|
||||
-- staticroot :: Text
|
||||
-- staticroot = defapproot `mappend` "/static"
|
||||
|
||||
-- | The location of static files on your system. This is a file system
|
||||
-- path. The default value works properly with your scaffolded site.
|
||||
staticdir :: FilePath
|
||||
staticdir = datadir++"static"
|
||||
|
||||
-- | The base URL for your static files. As you can see by the default
|
||||
-- value, this can simply be "static" appended to your application root.
|
||||
-- A powerful optimization can be serving static files from a separate
|
||||
-- domain name. This allows you to use a web server optimized for static
|
||||
-- files, more easily set expires and cache values, and avoid possibly
|
||||
-- costly transference of cookies on static files. For more information,
|
||||
-- please see:
|
||||
-- http://code.google.com/speed/page-speed/docs/request.html#ServeFromCookielessDomain
|
||||
--
|
||||
-- If you change the resource pattern for StaticR in hledger-web.hs, you will
|
||||
-- have to make a corresponding change here.
|
||||
--
|
||||
-- To see how this value is used, see urlRenderOverride in hledger-web.hs
|
||||
-- staticroot :: Text
|
||||
-- staticroot = defapproot `mappend` "/static"
|
||||
|
||||
|
||||
|
||||
-- The rest of this file contains settings which rarely need changing by a
|
||||
|
||||
@ -43,7 +43,6 @@ Flag devel
|
||||
|
||||
executable hledger-web
|
||||
main-is: hledger-web.hs
|
||||
-- hs-source-dirs: ., config
|
||||
if flag(devel)
|
||||
Buildable: False
|
||||
if flag(production)
|
||||
@ -109,33 +108,3 @@ library
|
||||
Settings
|
||||
StaticFiles
|
||||
Handlers
|
||||
|
||||
-- executable hledger-web
|
||||
-- if flag(devel)
|
||||
-- Buildable: False
|
||||
|
||||
-- if flag(production)
|
||||
-- cpp-options: -DPRODUCTION
|
||||
-- ghc-options: -Wall -threaded -O2
|
||||
-- else
|
||||
-- ghc-options: -Wall -threaded
|
||||
|
||||
-- main-is: config/hledger-web.hs
|
||||
-- hs-source-dirs: ., config
|
||||
|
||||
-- build-depends: base >= 4 && < 5
|
||||
-- , yesod-core >= 0.8 && < 0.9
|
||||
-- , yesod-static
|
||||
-- , wai-extra
|
||||
-- , directory
|
||||
-- , bytestring
|
||||
-- , text
|
||||
-- , template-haskell
|
||||
-- , hamlet
|
||||
-- , web-routes
|
||||
-- , transformers
|
||||
-- , wai
|
||||
-- , warp
|
||||
-- , blaze-builder
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/static StaticR Static getStatic
|
||||
/static StaticR Static getStatic
|
||||
/favicon.ico FaviconR GET
|
||||
/robots.txt RobotsR GET
|
||||
/ RootR GET
|
||||
|
||||
Loading…
Reference in New Issue
Block a user