;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.Import
 | 
				
			||||||
import Hledger.Web.WebOptions
 | 
					import Hledger.Web.WebOptions
 | 
				
			||||||
import Hledger.Web.Widget.AddForm (addModal)
 | 
					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.
 | 
					-- | The formatted journal view, with sidebar.
 | 
				
			||||||
getJournalR :: Handler Html
 | 
					getJournalR :: Handler Html
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,8 @@ import Hledger.Cli.CliOptions
 | 
				
			|||||||
import Hledger.Web.Import
 | 
					import Hledger.Web.Import
 | 
				
			||||||
import Hledger.Web.WebOptions
 | 
					import Hledger.Web.WebOptions
 | 
				
			||||||
import Hledger.Web.Widget.AddForm (addModal)
 | 
					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.
 | 
					-- | The main journal/account register view, with accounts sidebar.
 | 
				
			||||||
getRegisterR :: Handler Html
 | 
					getRegisterR :: Handler Html
 | 
				
			||||||
 | 
				
			|||||||
@ -14,6 +14,7 @@ module Hledger.Web.Widget.Common
 | 
				
			|||||||
  , fromFormSuccess
 | 
					  , fromFormSuccess
 | 
				
			||||||
  , writeJournalTextIfValidAndChanged
 | 
					  , writeJournalTextIfValidAndChanged
 | 
				
			||||||
  , journalFile404
 | 
					  , journalFile404
 | 
				
			||||||
 | 
					  , transactionFrag
 | 
				
			||||||
  ) where
 | 
					  ) where
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import Data.Default (def)
 | 
					import Data.Default (def)
 | 
				
			||||||
@ -29,6 +30,7 @@ import qualified Text.Blaze.Html5 as H
 | 
				
			|||||||
import qualified Text.Blaze.Html5.Attributes as A
 | 
					import qualified Text.Blaze.Html5.Attributes as A
 | 
				
			||||||
import Text.Blaze.Internal (preEscapedString)
 | 
					import Text.Blaze.Internal (preEscapedString)
 | 
				
			||||||
import Text.Hamlet (hamletFile)
 | 
					import Text.Hamlet (hamletFile)
 | 
				
			||||||
 | 
					import Text.Printf (printf)
 | 
				
			||||||
import Yesod
 | 
					import Yesod
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import Hledger
 | 
					import Hledger
 | 
				
			||||||
@ -103,3 +105,7 @@ mixedAmountAsHtml b _ =
 | 
				
			|||||||
    c = case isNegativeMixedAmount b of
 | 
					    c = case isNegativeMixedAmount b of
 | 
				
			||||||
      Just True -> "negative amount"
 | 
					      Just True -> "negative amount"
 | 
				
			||||||
      _ -> "positive 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
 | 
					      <th .amount style="text-align:right;">Amount
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $forall (torig, _, split, _, amt, _) <- items
 | 
					    $forall (torig, _, split, _, amt, _) <- items
 | 
				
			||||||
      <tr .title #transaction-#{tindex torig} title="#{showTransaction torig}">
 | 
					      <tr .title ##{transactionFrag torig} title="#{showTransaction torig}">
 | 
				
			||||||
        <td .date nowrap>
 | 
					        <td .date nowrap>
 | 
				
			||||||
          #{show (tdate torig)}
 | 
					          #{show (tdate torig)}
 | 
				
			||||||
        <td colspan=2>
 | 
					        <td colspan=2>
 | 
				
			||||||
 | 
				
			|||||||
@ -21,7 +21,7 @@
 | 
				
			|||||||
      $forall (torig, tacct, split, _acct, amt, bal) <- items
 | 
					      $forall (torig, tacct, split, _acct, amt, bal) <- items
 | 
				
			||||||
        <tr ##{tindex torig} title="#{showTransaction torig}" style="vertical-align:top;">
 | 
					        <tr ##{tindex torig} title="#{showTransaction torig}" style="vertical-align:top;">
 | 
				
			||||||
          <td .date>
 | 
					          <td .date>
 | 
				
			||||||
            <a href="@{JournalR}#transaction-#{tindex torig}">
 | 
					            <a href="@{JournalR}##{transactionFrag torig}">
 | 
				
			||||||
              #{show (tdate tacct)}
 | 
					              #{show (tdate tacct)}
 | 
				
			||||||
          <td>
 | 
					          <td>
 | 
				
			||||||
            #{textElideRight 30 (tdescription tacct)}
 | 
					            #{textElideRight 30 (tdescription tacct)}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user