webyesod: rename "transactions" page to "journal"
This commit is contained in:
		
							parent
							
								
									2e9efc678a
								
							
						
					
					
						commit
						b462eea9de
					
				| @ -78,13 +78,13 @@ instance Yesod HledgerWebApp where approot = appRoot | |||||||
| mkYesod "HledgerWebApp" [$parseRoutes| | mkYesod "HledgerWebApp" [$parseRoutes| | ||||||
| /             IndexPage        GET | /             IndexPage        GET | ||||||
| /style.css    StyleCss         GET | /style.css    StyleCss         GET | ||||||
| /transactions TransactionsPage GET POST | /journal      JournalPage      GET POST | ||||||
| /register     RegisterPage     GET | /register     RegisterPage     GET | ||||||
| /balance      BalancePage      GET | /balance      BalancePage      GET | ||||||
| |] | |] | ||||||
| 
 | 
 | ||||||
| getIndexPage :: Handler HledgerWebApp () | getIndexPage :: Handler HledgerWebApp () | ||||||
| getIndexPage = redirect RedirectTemporary TransactionsPage | getIndexPage = redirect RedirectTemporary JournalPage | ||||||
| 
 | 
 | ||||||
| getStyleCss :: Handler HledgerWebApp () | getStyleCss :: Handler HledgerWebApp () | ||||||
| getStyleCss = do | getStyleCss = do | ||||||
| @ -94,8 +94,8 @@ getStyleCss = do | |||||||
|     header "Content-Type" "text/css" |     header "Content-Type" "text/css" | ||||||
|     return $ RepPlain $ toContent s |     return $ RepPlain $ toContent s | ||||||
| 
 | 
 | ||||||
| getTransactionsPage :: Handler HledgerWebApp RepHtml | getJournalPage :: Handler HledgerWebApp RepHtml | ||||||
| getTransactionsPage = withLatestJournalRender (const showTransactions) | getJournalPage = withLatestJournalRender (const showTransactions) | ||||||
| 
 | 
 | ||||||
| getRegisterPage :: Handler HledgerWebApp RepHtml | getRegisterPage :: Handler HledgerWebApp RepHtml | ||||||
| getRegisterPage = withLatestJournalRender showRegisterReport | getRegisterPage = withLatestJournalRender showRegisterReport | ||||||
| @ -143,7 +143,7 @@ template here msg a p title content = [$hamlet| | |||||||
| |] | |] | ||||||
|  where m = fromMaybe (string "") msg |  where m = fromMaybe (string "") msg | ||||||
|        navbar' = navbar here a p |        navbar' = navbar here a p | ||||||
|        addform' | here == TransactionsPage = addform |        addform' | here == JournalPage = addform | ||||||
|                 | otherwise = nulltemplate |                 | otherwise = nulltemplate | ||||||
|        stylesheet = StyleCss |        stylesheet = StyleCss | ||||||
|        metacontent = "text/html; charset=utf-8" |        metacontent = "text/html; charset=utf-8" | ||||||
| @ -164,12 +164,12 @@ navbar here a p = [$hamlet| | |||||||
| navlinks :: HledgerWebAppRoutes -> String -> String -> Hamlet HledgerWebAppRoutes | navlinks :: HledgerWebAppRoutes -> String -> String -> Hamlet HledgerWebAppRoutes | ||||||
| navlinks here a p = [$hamlet| | navlinks here a p = [$hamlet| | ||||||
|  #navlinks |  #navlinks | ||||||
|   ^transactionslink^ | $ |   ^journallink^ | $ | ||||||
|   ^registerlink^ | $ |   ^registerlink^ | $ | ||||||
|   ^balancelink^ |   ^balancelink^ | ||||||
| |] | |] | ||||||
|  where |  where | ||||||
|   transactionslink = navlink here "transactions" TransactionsPage |   journallink = navlink here "journal" JournalPage | ||||||
|   registerlink = navlink here "register" RegisterPage |   registerlink = navlink here "register" RegisterPage | ||||||
|   balancelink = navlink here "balance" BalancePage |   balancelink = navlink here "balance" BalancePage | ||||||
|   navlink here s dest = [$hamlet|%a.$style$!href=@?u@ $string.s$|] |   navlink here s dest = [$hamlet|%a.$style$!href=@?u@ $string.s$|] | ||||||
| @ -280,8 +280,8 @@ transactionfields n = [$hamlet| | |||||||
|   acctvar = numbered "accountname" |   acctvar = numbered "accountname" | ||||||
|   amtvar = numbered "amount" |   amtvar = numbered "amount" | ||||||
| 
 | 
 | ||||||
| postTransactionsPage :: Handler HledgerWebApp RepPlain | postJournalPage :: Handler HledgerWebApp RepPlain | ||||||
| postTransactionsPage = do | postJournalPage = do | ||||||
|   today <- liftIO getCurrentDay |   today <- liftIO getCurrentDay | ||||||
|   -- get form input values, or basic validation errors. E means an Either value. |   -- get form input values, or basic validation errors. E means an Either value. | ||||||
|   dateE  <- runFormPost $ catchFormError $ notEmpty $ required $ input "date" |   dateE  <- runFormPost $ catchFormError $ notEmpty $ required $ input "date" | ||||||
| @ -321,7 +321,7 @@ postTransactionsPage = do | |||||||
|    Left errs -> do |    Left errs -> do | ||||||
|     -- save current form values in session |     -- save current form values in session | ||||||
|     setMessage $ string $ intercalate "; " $ map (intercalate ", " . map (\(a,b) -> a++": "++b)) errs |     setMessage $ string $ intercalate "; " $ map (intercalate ", " . map (\(a,b) -> a++": "++b)) errs | ||||||
|     redirect RedirectTemporary TransactionsPage |     redirect RedirectTemporary JournalPage | ||||||
| 
 | 
 | ||||||
|    Right t -> do |    Right t -> do | ||||||
|     let t' = txnTieKnot t -- XXX move into balanceTransaction |     let t' = txnTieKnot t -- XXX move into balanceTransaction | ||||||
| @ -330,5 +330,5 @@ postTransactionsPage = do | |||||||
|     -- liftIO $ putValue "hledger" "journal" j' |     -- liftIO $ putValue "hledger" "journal" j' | ||||||
|     liftIO $ journalAddTransaction j t' |     liftIO $ journalAddTransaction j t' | ||||||
|     setMessage $ string $ printf "Added transaction:\n%s" (show t') |     setMessage $ string $ printf "Added transaction:\n%s" (show t') | ||||||
|     redirect RedirectTemporary TransactionsPage |     redirect RedirectTemporary JournalPage | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user