From c09da8ade8587406cbb76f02040d3d0afdde5360 Mon Sep 17 00:00:00 2001 From: marcdeb1 Date: Wed, 10 Oct 2018 14:47:17 +0200 Subject: [PATCH] Added claim link to transaction --- src/Controller/MainController.php | 4 ++++ src/Model/Entity/Claim.php | 5 +++++ src/Template/Main/tx.ctp | 6 +++--- webroot/css/main.css | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 5ac133c..9c532d0 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -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; diff --git a/src/Model/Entity/Claim.php b/src/Model/Entity/Claim.php index e2d3cb7..52fe0a4 100644 --- a/src/Model/Entity/Claim.php +++ b/src/Model/Entity/Claim.php @@ -13,6 +13,11 @@ class Claim extends Entity { $link = 'lbry://' . $link; return $link; } + + function getExplorerLink() { + $link = '/claims/' . $this->ClaimId; + return $link; + } } ?> \ No newline at end of file diff --git a/src/Template/Main/tx.ctp b/src/Template/Main/tx.ctp index 59805b0..000115d 100644 --- a/src/Template/Main/tx.ctp +++ b/src/Template/Main/tx.ctp @@ -136,9 +136,9 @@ foreach ($outputs as $out): ?>
- IsSupportClaim): ?>
SUPPORT
- IsUpdateClaim): ?>
UPDATE
- IsClaim): ?>
CLAIM
+ IsSupportClaim): ?> + IsUpdateClaim): ?> + IsClaim): ?>
diff --git a/webroot/css/main.css b/webroot/css/main.css index 9510485..684b350 100644 --- a/webroot/css/main.css +++ b/webroot/css/main.css @@ -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 { text-decoration: none; color: black } .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 }