From a8efa47ad2467dc168b0a1afdc3b1e72a72820db Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 18 Mar 2019 13:08:05 +0300 Subject: [PATCH] Exclude exact timestamp from tiles and fix path mask for showing of exact timestamp --- apps/block_scout_web/assets/js/lib/from_now.js | 3 ++- .../templates/internal_transaction/_tile.html.eex | 2 +- .../lib/block_scout_web/templates/transaction/_tile.html.eex | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/block_scout_web/assets/js/lib/from_now.js b/apps/block_scout_web/assets/js/lib/from_now.js index f4bad344cb..8a00fefd80 100644 --- a/apps/block_scout_web/assets/js/lib/from_now.js +++ b/apps/block_scout_web/assets/js/lib/from_now.js @@ -21,7 +21,8 @@ function tryUpdateAge (el) { function updateAge (el, timestamp) { let fromNow = timestamp.fromNow() // show the exact time only for transaction details page. Otherwise, short entry - if (window.location.pathname.startsWith('/tx/')) { + const elInTile = el.hasAttribute('in-tile') + if (window.location.pathname.includes('/tx/') && !elInTile) { const offset = moment().utcOffset() / 60 const sign = offset && Math.sign(offset) ? '+' : '-' const formatDate = `MMMM-DD-YYYY hh:mm:ss A ${sign}${offset} UTC` diff --git a/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex index 9a0630e97d..2265a397be 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/internal_transaction/_tile.html.eex @@ -23,7 +23,7 @@ to: block_path(BlockScoutWeb.Endpoint, :show, @internal_transaction.block_number) ) %> - + <%= if assigns[:current_address] do %> <%= if assigns[:current_address].hash == @internal_transaction.from_address_hash do %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex index a254d02c04..da3884b417 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/_tile.html.eex @@ -35,7 +35,7 @@ <%= @transaction |> block_number() |> BlockScoutWeb.RenderHelpers.render_partial() %> - + <%= if from_or_to_address?(@transaction, assigns[:current_address]) do %> <%= if @transaction.from_address_hash == assigns[:current_address].hash do %>