From 6288d8ea4eb7585df63dea9d0980da5551c3b5f9 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Sun, 5 May 2019 13:51:07 +0300 Subject: [PATCH] Fix display of verification alternatives in the tx details page --- .../address/_verify_other_explorers.html.eex | 8 ++++---- .../templates/transaction/overview.html.eex | 4 +++- .../lib/block_scout_web/views/address_view.ex | 14 +++++++++----- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorers.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorers.html.eex index ca87829ccb..542bdf74c3 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorers.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/_verify_other_explorers.html.eex @@ -12,8 +12,8 @@
<%= link( - address_link_to_other_explorer("https://blockchair.com/ethereum/address/", @address), - to: address_link_to_other_explorer("https://blockchair.com/ethereum/address/", @address) + address_link_to_other_explorer("https://blockchair.com/ethereum/address/", @address, false), + to: address_link_to_other_explorer("https://blockchair.com/ethereum/address/", @address ,true) ) %>
@@ -27,8 +27,8 @@
<%= link( - address_link_to_other_explorer("https://www.etherchain.org/account/", @address), - to: address_link_to_other_explorer("https://www.etherchain.org/account/", @address) + address_link_to_other_explorer("https://www.etherchain.org/account/", @address, false), + to: address_link_to_other_explorer("https://www.etherchain.org/account/", @address, true) ) %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex index 49be29b2ad..b0dbfdd1ec 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex @@ -50,7 +50,9 @@ <% end %> - <%= render BlockScoutWeb.AddressView, "_verify_other_explorers.html", address: @transaction |> BlockScoutWeb.AddressView.address_partial_selector(:to, nil) |> BlockScoutWeb.RenderHelpers.render_partial() %> + <%= if contract_creation?(@transaction) do %> + <%= render BlockScoutWeb.AddressView, "_verify_other_explorers.html", address: to_address_hash(@transaction) %> + <% end %>
diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_view.ex index 2d07168088..c777fd74a7 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_view.ex @@ -256,15 +256,19 @@ defmodule BlockScoutWeb.AddressView do nil end - def address_link_to_other_explorer(link, address) do - link <> trimmed_hash(address) + def address_link_to_other_explorer(link, address, full) do + if full do + link <> to_string(address) + else + link <> trimmed_hash(address) + end end - def address_link_to_other_explorer(_, address), do: "" + def address_link_to_other_explorer(_, address, full), do: "" - def address_link_to_other_explorer(_, _), do: "" + def address_link_to_other_explorer(_, _, full), do: "" - def address_link_to_other_explorer(link, _), do: "" + def address_link_to_other_explorer(link, _, full), do: "" defp matching_address_check(%Address{hash: hash} = current_address, %Address{hash: hash}, contract?, truncate) do [