Skip to content

Commit

Permalink
Fixed block height link bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Lemke committed Nov 25, 2018
1 parent 6b99213 commit 00227ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ $(document).ready(function () {
}

if(data.miner !== '?') {
data.miner = '<span data-toogle="tooltip" class="tag" title="Identified by: ' + data.miner.identifiedBy + '">' + data.miner.name + '</span>';
data.miner = '<span class="tag" data-toogle="tooltip" title="Identified by: ' + data.miner.identifiedBy + '">' + data.miner.name + '</span>';
}

$('#block-list').prepend(
'<tr>' +
'<td class="data-cell monospace"><a href="/block-height/' + data.height + '">' + data.height + '</a></td>' +
'<td class="data-cell monospace"><a href="/block-height/' + data.height_number + '">' + data.height + '</a></td>' +
'<td class="data-cell monospace">' + data.time + '<span class="d-none block-timestamp">' + data.timeUTC + '</span>' +'</td>' +
'<td class="data-cell monospace text-right block-time-ago">' + data.timeAgo + '</td>' +
'<td class="data-cell monospace"><span>' + data.miner + '</span></td>' +
Expand All @@ -69,8 +69,10 @@ $(document).ready(function () {
'</tr>'
);

$('[data-toggle="tooltip"]').tooltip('dispose');
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="popover"]').popover({html:true, container:"body"});
//$('[data-toggle="popover"]').popover({html:true, container:"body"});
//$("[data-toggle='toggle']").toggle();

latestBlock = latestBlock + 1;
}
Expand Down
3 changes: 2 additions & 1 deletion routes/baseActionsRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ router.get('/newblocks', (req, res) => {
let formatExchangedCurrency = utils.formatExchangedCurrency(currencyValue);

let height = block.height.toLocaleString();
let height_number = block.height;
let timeUTC = new Date(parseInt(block.time) * 1000).getTime();
let time = moment.utc(new Date(parseInt(block.time) * 1000)).format("Y-MM-DD HH:mm:ss");
let timeAgo = moment.duration(moment.utc(new Date()).diff(moment.utc(new Date(parseInt(block.time) * 1000)))).format('m') + ' min';
Expand All @@ -1056,7 +1057,7 @@ router.get('/newblocks', (req, res) => {
let weight = block.weight.toLocaleString();
let radialProgressBarPercent = new Decimal(100 * block.weight / coinConfig.maxBlockWeight).toDecimalPlaces(2);

res.send({height: height, time: time, timeUTC: timeUTC, timeAgo: timeAgo, miner: miner, transactions: transactions,
res.send({height: height, height_number: height_number, time: time, timeUTC: timeUTC, timeAgo: timeAgo, miner: miner, transactions: transactions,
currencyValue: currencyValue, currencyValueFormatted: currencyValueFormatted, size: size, weight: weight, radialProgressBarPercent: radialProgressBarPercent
, currencyFormatType: currencyFormatType, exchangeRate: exchangeRate, formatExchangedCurrency: formatExchangedCurrency});
} else {
Expand Down
2 changes: 1 addition & 1 deletion views/includes/blocks-list.pug
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ table(class="table table-striped table-responsive-sm mb-0")
- var timeAgo = moment.duration(moment.utc(new Date()).diff(moment.utc(new Date(parseInt(block.time) * 1000))));
td(class="data-cell monospace text-right block-time-ago") #{timeAgo.format("m") + " min"}
td(class="data-cell monospace")
if (block.miner && block.miner.name)
if (block.miner)
span(data-toggle="tooltip", title=("Identified by: " + block.miner.identifiedBy), class="tag") #{block.miner.name}
else
span ?
Expand Down

0 comments on commit 00227ed

Please sign in to comment.