Merge fix for PR 33 (#37)

* Added claim link to transaction
* Added 'View' link next to Claim label
This commit is contained in:
Akinwale Ariwodola 2018-10-19 12:54:54 +01:00 committed by GitHub
parent c13c06f74f
commit d8734c1b8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 227 additions and 214 deletions

428
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -452,6 +452,8 @@ class MainController extends AppController {
$this->loadModel('Transactions');
$this->loadModel('Inputs');
$this->loadModel('Outputs');
$this->loadModel('Claims');
$sourceAddress = $this->request->query('address');
$tx = $this->Transactions->find()->select(
@ -475,6 +477,8 @@ class MainController extends AppController {
$outputs[$i]->IsClaim = (strpos($outputs[$i]->ScriptPubKeyAsm, 'CLAIM') > -1);
$outputs[$i]->IsSupportClaim = (strpos($outputs[$i]->ScriptPubKeyAsm, 'SUPPORT_CLAIM') > -1);
$outputs[$i]->IsUpdateClaim = (strpos($outputs[$i]->ScriptPubKeyAsm, 'UPDATE_CLAIM') > -1);
$claim = $this->Claims->find()->where(['TransactionHash' => $tx->Hash, 'Vout' => $outputs[$i]->Vout])->first();
$outputs[$i]->Claim = $claim;
}
$totalIn = 0;

View file

@ -13,6 +13,11 @@ class Claim extends Entity {
$link = 'lbry://' . $link;
return $link;
}
function getExplorerLink() {
$link = '/claims/' . $this->ClaimId;
return $link;
}
}
?>

View file

@ -136,6 +136,7 @@
foreach ($outputs as $out): ?>
<div id="output-<?php echo $out->Vout ?>" class="output <?php if (isset($out['OutputAddresses']) && count($out['OutputAddresses']) > 0 && $out['OutputAddresses'][0]->Address == $sourceAddress): ?>is-source<?php endif; ?>">
<div class="labels">
<?php if($out->IsClaim or $out->IsSupportClaim or $out->IsUpdateClaim): ?><a class="view-claim" href="<?php echo $out->Claim->getExplorerLink() ?>">View</a><?php endif; ?>
<?php if($out->IsSupportClaim): ?><div class="support">SUPPORT</div><?php endif; ?>
<?php if($out->IsUpdateClaim): ?><div class="update">UPDATE</div><?php endif; ?>
<?php if($out->IsClaim): ?><div class="claim">CLAIM</div><?php endif; ?>

View file

@ -252,6 +252,7 @@ footer .content .page-time { position: absolute; right: 12px; bottom: 0px; paddi
.tx-details-layout .outputs .output .labels .support { background: #ffeb3b }
.tx-details-layout .outputs .output .labels .update { background: #ea80fc }
.tx-details-layout .outputs .output .labels .claim { background: #76ff03 }
.tx-details-layout .outputs .output .view-claim { font-size: 80%; }
.tx-details-layout .inputs .input .value, .tx-details-layout .outputs .output .value { font-weight: normal }
.tx-details-layout .inputs .input.is-source, .tx-details-layout .outputs .output.is-source { border-right-width: 18px; border-right-color: #1e88e5; background: #e3f2fd }
.tx-details-layout .inputs .input.highlighted, .tx-details-layout .outputs .output.highlighted { background: #f1f8e9 }