;web: links from register to journal now contain journal filename
in order to distinguish transactions from multiple journal files (#1041)
This commit is contained in:
		
							parent
							
								
									61bec588d2
								
							
						
					
					
						commit
						e9792bfd42
					
				| @ -12,7 +12,8 @@ import Hledger.Cli.CliOptions | ||||
| import Hledger.Web.Import | ||||
| import Hledger.Web.WebOptions | ||||
| import Hledger.Web.Widget.AddForm (addModal) | ||||
| import Hledger.Web.Widget.Common (accountQuery, mixedAmountAsHtml) | ||||
| import Hledger.Web.Widget.Common | ||||
|             (accountQuery, mixedAmountAsHtml, transactionFrag) | ||||
| 
 | ||||
| -- | The formatted journal view, with sidebar. | ||||
| getJournalR :: Handler Html | ||||
|  | ||||
| @ -17,7 +17,8 @@ import Hledger.Cli.CliOptions | ||||
| import Hledger.Web.Import | ||||
| import Hledger.Web.WebOptions | ||||
| import Hledger.Web.Widget.AddForm (addModal) | ||||
| import Hledger.Web.Widget.Common (accountQuery, mixedAmountAsHtml) | ||||
| import Hledger.Web.Widget.Common | ||||
|              (accountQuery, mixedAmountAsHtml, transactionFrag) | ||||
| 
 | ||||
| -- | The main journal/account register view, with accounts sidebar. | ||||
| getRegisterR :: Handler Html | ||||
|  | ||||
| @ -14,6 +14,7 @@ module Hledger.Web.Widget.Common | ||||
|   , fromFormSuccess | ||||
|   , writeJournalTextIfValidAndChanged | ||||
|   , journalFile404 | ||||
|   , transactionFrag | ||||
|   ) where | ||||
| 
 | ||||
| import Data.Default (def) | ||||
| @ -29,6 +30,7 @@ import qualified Text.Blaze.Html5 as H | ||||
| import qualified Text.Blaze.Html5.Attributes as A | ||||
| import Text.Blaze.Internal (preEscapedString) | ||||
| import Text.Hamlet (hamletFile) | ||||
| import Text.Printf (printf) | ||||
| import Yesod | ||||
| 
 | ||||
| import Hledger | ||||
| @ -103,3 +105,7 @@ mixedAmountAsHtml b _ = | ||||
|     c = case isNegativeMixedAmount b of | ||||
|       Just True -> "negative amount" | ||||
|       _ -> "positive amount" | ||||
| 
 | ||||
| transactionFrag :: Transaction -> String | ||||
| transactionFrag t = | ||||
|     printf "transaction-%s-%d" (sourceFilePath $ tsourcepos t) (tindex t) | ||||
|  | ||||
| @ -15,7 +15,7 @@ $if elem CapAdd caps | ||||
|       <th .amount style="text-align:right;">Amount | ||||
| 
 | ||||
|     $forall (torig, _, split, _, amt, _) <- items | ||||
|       <tr .title #transaction-#{tindex torig} title="#{showTransaction torig}"> | ||||
|       <tr .title ##{transactionFrag torig} title="#{showTransaction torig}"> | ||||
|         <td .date nowrap> | ||||
|           #{show (tdate torig)} | ||||
|         <td colspan=2> | ||||
|  | ||||
| @ -21,7 +21,7 @@ | ||||
|       $forall (torig, tacct, split, _acct, amt, bal) <- items | ||||
|         <tr ##{tindex torig} title="#{showTransaction torig}" style="vertical-align:top;"> | ||||
|           <td .date> | ||||
|             <a href="@{JournalR}#transaction-#{tindex torig}"> | ||||
|             <a href="@{JournalR}##{transactionFrag torig}"> | ||||
|               #{show (tdate tacct)} | ||||
|           <td> | ||||
|             #{textElideRight 30 (tdescription tacct)} | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user