From 7899669c4b9b1480b58cff12d9bdf6df82335760 Mon Sep 17 00:00:00 2001 From: marcdeb1 Date: Sat, 6 Apr 2019 16:07:30 +0200 Subject: [PATCH] Added information to claim page --- src/Controller/MainController.php | 2 +- src/Template/Main/claims.ctp | 17 ++++++++++++++++- src/Template/Main/tx.ctp | 9 +++++++-- webroot/css/main.css | 11 ++++++----- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 0e9a4b6..59c8188 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -169,7 +169,7 @@ class MainController extends AppController { $this->set('currentPage', $page); $this->set('claims', $claims); } else { - $claim = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_id' => $id])->order(['Claims.created_at' => 'DESC'])->first(); + $claim = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->select(['claim_bid' => 'O.value'])->leftJoin(['O' => 'output'], ['Claims.transaction_hash_id = O.transaction_hash AND Claims.vout = O.vout'])->where(['Claims.claim_id' => $id])->order(['Claims.created_at' => 'DESC'])->first(); if (!$claim) { return $this->redirect('/'); } diff --git a/src/Template/Main/claims.ctp b/src/Template/Main/claims.ctp index 58e67d6..6d06df1 100644 --- a/src/Template/Main/claims.ctp +++ b/src/Template/Main/claims.ctp @@ -44,7 +44,7 @@ $cost = 'Free'; if (isset($claim->price) && $claim->price > 0) { $cost = $this->Amount->formatCurrency($claim->price) . ' LBC'; } else if (isset($claim->fee) && strtolower($claim->fee_currency) === 'lbc') { - $cost = $this->Amount->formatCurrency($claim->fee) . ' LBC'; + $cost = (float) ($claim->fee) . ' LBC'; } $desc = $claim->description; @@ -66,6 +66,10 @@ if (strlen(trim($desc)) == 0) {
+
+
bid_state; ?>
+
+
is_nsfw && strlen(trim($claim->thumbnail_url)) > 0): ?> @@ -101,6 +105,17 @@ if (strlen(trim($desc)) == 0) {
+ +
Claim bid
+
Effective amount
+ +
claim_bid) . ' LBC'; ?>
+
effective_amount / 100000000) . ' LBC'; ?>
+ +
+ +
Stream hash
+
sd_hash ?>
diff --git a/src/Template/Main/tx.ctp b/src/Template/Main/tx.ctp index 1f6a391..42da9e6 100644 --- a/src/Template/Main/tx.ctp +++ b/src/Template/Main/tx.ctp @@ -19,7 +19,12 @@
transaction_time - strtotime($tx->created_at)) > 3600) ? $tx->transaction_time : $tx->created_at; + $transaction_time = \DateTime::createFromFormat('U', $tx->transaction_time); + if($tx->transaction_time == null || strlen(trim($tx->transaction_time)) == 0) { + $created_time = $tx->created_at; + } else { + $created_time = (abs($tx->transaction_time - strtotime($tx->created_at)) > 3600) ? $transaction_time : $tx->created_at; + } ?>

Time Created

@@ -29,7 +34,7 @@

Block Time

transaction_time == null || strlen(trim($tx->transaction_time)) == 0) ? 'Not yet confirmed' : - \DateTime::createFromFormat('U', $tx->transaction_time)->format('j M Y H:i:s') . ' UTC' ?> + $transaction_time->format('j M Y H:i:s') . ' UTC' ?> transaction_time > $tx->created_at->getTimestamp()): $diffSeconds = $tx->transaction_time - $tx->created_at->getTimestamp(); diff --git a/webroot/css/main.css b/webroot/css/main.css index 2f1a828..ae5e40f 100644 --- a/webroot/css/main.css +++ b/webroot/css/main.css @@ -69,7 +69,7 @@ border-radius: 0 8px 8px 0 } .claims-grid .claim-grid-item.last-item { margin-right: 0 } .claims-grid .claim-grid-item.last-row { margin-bottom: 0 } .claims-grid .claim-grid-item .price-tag { font-size: 65%; position: absolute; left: 0; top: 0; z-index: 505; background: #155b4a; color: #fff; text-align: center; padding: 4px 12px } -.claims-grid .claim-grid-item .tags { font-size: 65%; position: absolute; right: 0; top: 0; z-index: 505 } +.claims-grid .claim-grid-item .tags, .claim-info .tags { font-size: 65%; position: absolute; right: 0; top: 0; z-index: 505 } .claims-grid .claim-grid-item .thumbnail { width: 100%; height: 200px; background: #f0f0f0; display: block; position: relative; overflow: hidden;} .claims-grid .claim-grid-item .thumbnail img { width: 100%; position: absolute; left: 0; top: 0; border-bottom: 1px solid #eee } .claims-grid .claim-grid-item .thumbnail.purple { background: #ab47bc } @@ -79,9 +79,9 @@ border-radius: 0 8px 8px 0 } .claims-grid .claim-grid-item .thumbnail.green { background: #66bb6a } .claims-grid .claim-grid-item .thumbnail.yellow { background: #fdd835 } .claims-grid .claim-grid-item .thumbnail .autothumb { display: block; margin: 73px auto 0 auto; text-align: center; font-size: 240%; color: #fff; line-height: 54px } -.claims-grid .claim-grid-item .tags > div { display: inline-block; padding: 4px 12px; margin-left: 2px } +.claims-grid .claim-grid-item .tags > div, .claim-info .tags > div { display: inline-block; padding: 4px 12px; margin-left: 2px } .claims-grid .claim-grid-item .tags .nsfw { background: #e53935; text-align: center; color: #fff; position: relative; left: 1px } -.claims-grid .claim-grid-item .tags .bid-state { background: #551CA1; text-align: center; color: #fff; } +.claims-grid .claim-grid-item .tags .bid-state, .claim-info .bid-state { background: #551CA1; text-align: center; color: #fff; } .claims-grid .claim-grid-item .tags .content-type { background: #880e4f; text-align: center; color: #fff; } .claims-grid .claim-grid-item .metadata { padding: 24px; font-size: 90% } .claims-grid .claim-grid-item .title { font-size: 120%; height: 25px; line-height: 25px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap } @@ -95,11 +95,12 @@ border-radius: 0 8px 8px 0 } .claims-grid .claim-grid-item .spacer { height: 16px } .claims-body { width: 1200px; margin: 0 auto 0 auto; cursor: default } -.claims-body .claim-info { width: 400px; float: left; /*box-shadow: 0 2px 4px rgba(0,0,0,.175);*/ border: 1px solid rgba(0,0,0,.15); cursor: default } +.claims-body .claim-info { position: relative; width: 400px; float: left; /*box-shadow: 0 2px 4px rgba(0,0,0,.175);*/ border: 1px solid rgba(0,0,0,.15); cursor: default } .claims-body .claim-info .thumbnail { width: 100%; height: 220px; background: #f0f0f0; display: block; position: relative; overflow: hidden } .claims-body .claim-info .thumbnail img { width: 100% } .claims-body .claim-info .content { padding: 24px } -.claims-body .claim-info .content .label { font-size: inherit; text-decoration: underline; color: #666666 } +.claims-body .claim-info .content .label { display: inline; font-size: inherit; text-decoration: underline; color: #666666 } +.claims-body .claim-info .content .help-text { text-decoration: underline dotted grey; cursor: help; } .claims-body .claim-info .content .value { font-weight: 300; margin-bottom: 24px; word-break: break-word; word-wrap: break-word } .claims-body .claim-info .content .value:last-child { margin-bottom: 0 } .claims-body .claim-info .content .half-width { width: 50%; float: left }