mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:56:46 +00:00
Refactoring, made things look a _little_ better.
This commit is contained in:
parent
68ff94f27e
commit
45fc3b74ed
@ -140,54 +140,66 @@ class OBPTransactionSnippet extends StatefulSnippet with PaginatorSnippet[OBPEnv
|
||||
}
|
||||
}
|
||||
|
||||
val theAccount = thisAccount.theAccount
|
||||
val otherUnmediatedHolder = otherAccount.holder.get
|
||||
val otherMediatedHolder = otherAccount.mediated_holder(consumer)
|
||||
|
||||
def useDefaultImageIfBlank(toCheck: String) = {
|
||||
if(toCheck.equals("")) "/images/blank.gif"
|
||||
else toCheck
|
||||
}
|
||||
|
||||
val aliasImageSrc = {
|
||||
otherMediatedHolder._2 match{
|
||||
case Full(APublicAlias) => "/images/public_alias.png"
|
||||
case Full(APrivateAlias) => "/images/private_alias.png"
|
||||
case _ => "/images/blank.gif"
|
||||
}
|
||||
}
|
||||
|
||||
val moreInfo = {
|
||||
val moreInfo = for{
|
||||
a <- theAccount
|
||||
info <- a.getMediatedOtherAccountMoreInfo(consumer, otherUnmediatedHolder)
|
||||
} yield info
|
||||
|
||||
moreInfo getOrElse ""
|
||||
}
|
||||
|
||||
val logoImageSrc = {
|
||||
val imageUrl = for{
|
||||
a <- theAccount
|
||||
logo <- a.getMediatedOtherAccountImageURL(consumer, otherUnmediatedHolder)
|
||||
} yield logo
|
||||
|
||||
useDefaultImageIfBlank(imageUrl getOrElse "")
|
||||
}
|
||||
|
||||
val otherAccWebsiteUrl = {
|
||||
val url = for{
|
||||
a <- theAccount
|
||||
link <- a.getMediatedOtherAccountURL(consumer, otherUnmediatedHolder)
|
||||
} yield link
|
||||
|
||||
url getOrElse ""
|
||||
}
|
||||
|
||||
(
|
||||
".amount *" #> transactionValue.mediated_amount(consumer).getOrElse(FORBIDDEN) &
|
||||
".other_account_holder *" #> {
|
||||
val otherMediatedHolder = otherAccount.mediated_holder(consumer)
|
||||
val holderName = otherMediatedHolder._1 match {
|
||||
case Full(h) => h
|
||||
case _ => FORBIDDEN
|
||||
}
|
||||
val aliasType = otherMediatedHolder._2 match{
|
||||
case Full(APublicAlias) => <img class="alias_image" src="/images/public_alias.png"/>
|
||||
case Full(APrivateAlias) => <img class="alias_image" src="/images/private_alias.png"/>
|
||||
case _ => <span></span>
|
||||
}
|
||||
|
||||
val theAccount = thisAccount.theAccount
|
||||
val otherUnmediatedHolder = otherAccount.holder.get
|
||||
|
||||
val otherAccountMoreInfo = (for{
|
||||
a <- theAccount
|
||||
moreInfo <- a.getMediatedOtherAccountMoreInfo(consumer, otherUnmediatedHolder)
|
||||
} yield moreInfo)
|
||||
|
||||
val moreInfo = if(otherAccountMoreInfo.isDefined) Text("More information: " + otherAccountMoreInfo.get) else NodeSeq.Empty
|
||||
|
||||
val otherAccountURL = for{
|
||||
a <- theAccount
|
||||
moreInfo <- a.getMediatedOtherAccountURL(consumer, otherUnmediatedHolder)
|
||||
} yield moreInfo
|
||||
|
||||
val url = if(otherAccountURL.isDefined) <a href={otherAccountURL.get}>Website</a> else NodeSeq.Empty
|
||||
|
||||
val otherAccountImageURL = for{
|
||||
a <- theAccount
|
||||
moreInfo <- a.getMediatedOtherAccountImageURL(consumer, otherUnmediatedHolder)
|
||||
} yield moreInfo
|
||||
|
||||
val image = if(otherAccountImageURL.isDefined) <img src={otherAccountImageURL.get} alt="account image" height="50" width="50" /> else NodeSeq.Empty
|
||||
|
||||
<span>{aliasType}{holderName} {moreInfo}{url}{image}</span>
|
||||
} &
|
||||
".other_account_holder_name *" #> otherMediatedHolder._1.getOrElse(FORBIDDEN) &
|
||||
".alias_image [src]" #> aliasImageSrc &
|
||||
".other_account_more_info *" #> moreInfo &
|
||||
".other_account_logo_img [src]" #> logoImageSrc &
|
||||
".other_acc_ext [href]" #> otherAccWebsiteUrl &
|
||||
".currency *" #> transactionValue.mediated_currency(consumer).getOrElse(FORBIDDEN) &
|
||||
".date_cleared *" #> formatDate(transactionDetails.mediated_posted(consumer))&
|
||||
".narrative *" #> displayNarrative &
|
||||
".new_balance *" #> {
|
||||
transactionDetails.new_balance.get.mediated_amount(consumer).getOrElse(FORBIDDEN) + " " +
|
||||
transactionDetails.new_balance.get.mediated_currency(consumer).getOrElse(FORBIDDEN)
|
||||
} &
|
||||
".comments_link *" #> <a href={consumer + "/transactions/" + envelopeID + "/comments"}>Comments ({(obpEnvelope.mediated_comments(consumer) getOrElse List()).size})</a>).apply(xhtml)
|
||||
transactionDetails.new_balance.get.mediated_currency(consumer).getOrElse(FORBIDDEN)} &
|
||||
".comments_ext [href]" #> {consumer + "/transactions/" + envelopeID + "/comments"} &
|
||||
".comments_title *" #> {"Comments (" + (obpEnvelope.mediated_comments(consumer) getOrElse List()).size + ")"}
|
||||
).apply(xhtml)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
BIN
MavLift/src/main/webapp/images/blank.gif
Normal file
BIN
MavLift/src/main/webapp/images/blank.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 B |
@ -44,13 +44,13 @@ Open Bank Project (http://www.openbankproject.com)
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<!--<th class="span-1">Account</th>
|
||||
<th class="span-1">Posted</th> -->
|
||||
<th>Cleared</th>
|
||||
<th>Date</th>
|
||||
<th>Amount</th>
|
||||
<th>Currency</th>
|
||||
<!-- <th class="span-1">Type</th> -->
|
||||
<th>To/From</th>
|
||||
<th>More Info</th>
|
||||
<th></th> <!-- Logo -->
|
||||
<th></th> <!-- Website -->
|
||||
<th>Narrative</th>
|
||||
<th>Comments</th>
|
||||
<th>Balance</th>
|
||||
@ -58,16 +58,15 @@ Open Bank Project (http://www.openbankproject.com)
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class=lift:OBPTransactionSnippet.showAll>
|
||||
<!-- <td class="opb_transaction_other_account">other account</td>
|
||||
<td class="obp_transaction_date_start">start date</td> -->
|
||||
<td class="date_cleared">completed date</td>
|
||||
<td class="amount">obp_transaction_amount</td>
|
||||
<td class="currency">obp_transaction_currency</td>
|
||||
<!-- <td class="obp_transaction_type_en">obp_transaction_type_en</td> -->
|
||||
<!-- <td class="obp_transaction_type_de">obp_transaction_type_de</td> -->
|
||||
<td class="other_account_holder">obp_transaction_data_blob</td>
|
||||
<td class="other_account_holder"><img class="alias_image" src="/images/blank.gif" /><span class="other_account_holder_name">Holder name</span></td>
|
||||
<td class="other_account_more_info">More info on the other account</td>
|
||||
<td class="other_account_logo"><img src="#" height="50" class="other_account_logo_img"/></td>
|
||||
<td class="other_account_website"><a href="#" class="other_acc_title other_acc_ext">Website</a></td>
|
||||
<td class="narrative">narrative</td>
|
||||
<td class="comments_link">link to comments</td>
|
||||
<td class="comments_link"><a href="#" class="comments_title comments_ext">Comments</a></td>
|
||||
<td class="new_balance">obp_transaction_new_balance</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user