Merge pull request #2803 from poanetwork/vb-block-validator-custom-tooltip

Fix block validator custom tooltip
pull/2826/head
Victor Baranov 5 years ago committed by GitHub
commit 982b65fb91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 51
      apps/block_scout_web/assets/css/components/_custom_tooltips_block_details.scss
  3. 2
      apps/block_scout_web/lib/block_scout_web/templates/address/_link.html.eex
  4. 6
      apps/block_scout_web/lib/block_scout_web/templates/address/_responsive_hash.html.eex
  5. 3
      apps/block_scout_web/lib/block_scout_web/templates/block/_tile.html.eex
  6. 5
      apps/block_scout_web/lib/block_scout_web/templates/block/overview.html.eex
  7. 3
      apps/block_scout_web/lib/block_scout_web/templates/chain/_block.html.eex
  8. 2
      apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/_token_balances.html.eex
  9. 3
      apps/block_scout_web/lib/block_scout_web/templates/tokens/inventory/_token.html.eex
  10. 6
      apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex
  11. 4
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_pending_tile.html.eex
  12. 4
      apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex
  13. 6
      apps/block_scout_web/lib/block_scout_web/views/address_view.ex
  14. 34
      apps/block_scout_web/priv/gettext/default.pot
  15. 34
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  16. 24
      apps/block_scout_web/test/block_scout_web/views/address_view_test.exs

@ -5,6 +5,7 @@
- [#2449](https://github.com/poanetwork/blockscout/pull/2449) - add ability to send notification events through postgres notify
### Fixes
- [#2803](https://github.com/poanetwork/blockscout/pull/2803) - Fix block validator custom tooltip
### Chore
- [#2817](https://github.com/poanetwork/blockscout/pull/2817) - move docker integration documentation to blockscout docs

@ -1,4 +1,5 @@
/* Custom Tooltips for Block Details Page */
$tooltip-background-color: $btn-line-color !default;
.tooltipCustom {
position: relative;
@ -8,23 +9,20 @@
.tooltipCustom .tooltiptextTopMiner {
visibility: hidden;
position: absolute;
width: 50%;
width: 100%;
background-color: white;
color: black;
color: $tooltip-background-color;
text-align: center;
border-radius: 6px;
left: 25%;
left: 0%;
bottom: 100%;
padding: 15px 0px;
padding: 15px;
display: inline-block;
z-index: 1;
font-family: Nunito;
margin-bottom: 15px;
opacity: 0;
transition: opacity 0.5s;
@include media-breakpoint-down(lg) {
left: 60%;
}
}
.tooltipCustom .tooltiptextTopMiner::after {
@ -43,44 +41,5 @@
opacity: 1;
}
.tooltipCustom .tooltiptextTopR {
visibility: hidden;
position: absolute;
width: 50%;
background-color: $primary;
color: white;
text-align: center;
border-radius: 6px;
left: 52%;
bottom: 120%;
padding: 15px 10px;
font-family: Nunito;
display: inline-block;
z-index: 1;
margin-bottom: 15px;
opacity: 0;
transition: opacity 0.5s;
@include media-breakpoint-down(lg) {
bottom: 100%;
padding: 9px 10px;
}
}
.tooltipCustom .tooltiptextTopR::after {
content: '';
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: $primary transparent transparent transparent;
}
.tooltipCustom:hover .tooltiptextTopR {
visibility: visible;
opacity: 1;
}
/* Custom Tooltips for Block Details Page end*/

@ -1,5 +1,5 @@
<%= if @address do %>
<%= link to: address_path(BlockScoutWeb.Endpoint, :show, @address), "data-test": "address_hash_link", class: assigns[:class] do %>
<%= render BlockScoutWeb.AddressView, "_responsive_hash.html", address: @address, contract: @contract, truncate: assigns[:truncate] %>
<%= render BlockScoutWeb.AddressView, "_responsive_hash.html", address: @address, contract: @contract, truncate: assigns[:truncate], use_custom_tooltip: @use_custom_tooltip %>
<% end %>
<% end %>

@ -1,6 +1,10 @@
<span class="<%= if @contract do %>contract-address<% end %>" data-address-hash="<%= @address %>">
<%= if name = primary_name(@address) do %>
<span data-toggle="tooltip" data-placement="top" title="<%= @address %>"><%= name %> (<%= short_hash(@address) %>...)</span>
<%= if @use_custom_tooltip == true do %>
<span><%= name %> (<%= short_hash(@address) %>...)</span>
<% else %>
<span data-toggle="tooltip" data-placement="top" title="<%= @address %>"><%= name %> (<%= short_hash(@address) %>...)</span>
<% end %>
<% else %>
<%= if assigns[:truncate] do %>
<%= BlockScoutWeb.AddressView.trimmed_hash(@address.hash) %>

@ -39,7 +39,8 @@
<%= render BlockScoutWeb.AddressView,
"_link.html",
address: @block.miner,
contract: false %>
contract: false,
use_custom_tooltip: false %>
</div>
<%= if show_reward?(@block.rewards) do %>
<div class="text-nowrap text-truncate mt-3 mt-md-0">

@ -124,7 +124,7 @@
<h2 class="card-title balance-card-title"><%= gettext "Miner" %></h2>
<div class="text-right tooltipCustom">
<!-- Validator's Name -->
<span class="tooltiptextTopMiner"> Validator's Name</span>
<span class="tooltiptextTopMiner"> <%= @block.miner %></span>
<h3 class="address-balance-text text-truncate" >
@ -132,7 +132,8 @@
"_link.html",
address: @block.miner,
contract: false,
class: "" %>
class: "",
use_custom_tooltip: true %>
</h3>
</div>
</div>

@ -16,7 +16,8 @@
<%= render BlockScoutWeb.AddressView,
"_link.html",
address: @block.miner,
contract: false %>
contract: false,
use_custom_tooltip: false %>
</div>
<%= if BlockScoutWeb.BlockView.show_reward?(@block.rewards) do %>
<div class="text-truncate">

@ -2,7 +2,7 @@
<div class="row">
<div class="col-md-7 col-lg-8 d-flex flex-column">
<span>
<%= render BlockScoutWeb.AddressView, "_link.html", address: @token_balance.address, contract: BlockScoutWeb.AddressView.contract?(@token_balance.address) %>
<%= render BlockScoutWeb.AddressView, "_link.html", address: @token_balance.address, contract: BlockScoutWeb.AddressView.contract?(@token_balance.address), use_custom_tooltip: false %>
</span>
<span>

@ -20,7 +20,8 @@
<%= render BlockScoutWeb.AddressView,
"_link.html",
address: @token_transfer.to_address,
contract: false %>
contract: false,
use_custom_tooltip: false %>
</span>
</span>
</div>

@ -13,7 +13,8 @@
BlockScoutWeb.AddressView,
"_responsive_hash.html",
address: @token_transfer.from_address,
contract: BlockScoutWeb.AddressView.contract?(@token_transfer.from_address)
contract: BlockScoutWeb.AddressView.contract?(@token_transfer.from_address),
use_custom_tooltip: false
) %>
<% end %>
&rarr;
@ -22,7 +23,8 @@
BlockScoutWeb.AddressView,
"_responsive_hash.html",
address: @token_transfer.to_address,
contract: BlockScoutWeb.AddressView.contract?(@token_transfer.to_address)
contract: BlockScoutWeb.AddressView.contract?(@token_transfer.to_address),
use_custom_tooltip: false
) %>
<% end %>
</span>

@ -8,10 +8,10 @@
<div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0">
<%= render BlockScoutWeb.TransactionView, "_link.html", transaction_hash: @transaction.hash %>
<span class="text-nowrap">
<%= render BlockScoutWeb.AddressView, "_link.html", address: @transaction.from_address, contract: BlockScoutWeb.AddressView.contract?(@transaction.from_address) %>
<%= render BlockScoutWeb.AddressView, "_link.html", address: @transaction.from_address, contract: BlockScoutWeb.AddressView.contract?(@transaction.from_address), use_custom_tooltip: false %>
&rarr;
<%= if @transaction.to_address_hash do %>
<%= render BlockScoutWeb.AddressView, "_link.html", address: @transaction.to_address, contract: BlockScoutWeb.AddressView.contract?(@transaction.to_address) %>
<%= render BlockScoutWeb.AddressView, "_link.html", address: @transaction.to_address, contract: BlockScoutWeb.AddressView.contract?(@transaction.to_address), use_custom_tooltip: false %>
<% else %>
<%= gettext("Contract Address Pending") %>
<% end %>

@ -7,9 +7,9 @@
<div class="col-12 col-md-8 col-lg-10 d-flex flex-column text-nowrap">
<%= render BlockScoutWeb.TransactionView, "_link.html", transaction_hash: @token_transfer.transaction_hash %>
<span class="text-nowrap">
<%= render BlockScoutWeb.AddressView, "_link.html", address: @token_transfer.from_address, contract: BlockScoutWeb.AddressView.contract?(@token_transfer.from_address) %>
<%= render BlockScoutWeb.AddressView, "_link.html", address: @token_transfer.from_address, contract: BlockScoutWeb.AddressView.contract?(@token_transfer.from_address), use_custom_tooltip: false %>
&rarr;
<%= render BlockScoutWeb.AddressView, "_link.html", address: @token_transfer.to_address, contract: BlockScoutWeb.AddressView.contract?(@token_transfer.to_address) %>
<%= render BlockScoutWeb.AddressView, "_link.html", address: @token_transfer.to_address, contract: BlockScoutWeb.AddressView.contract?(@token_transfer.to_address), use_custom_tooltip: false %>
</span>
<span class="tile-title text-truncate">

@ -271,7 +271,8 @@ defmodule BlockScoutWeb.AddressView do
partial: "_responsive_hash.html",
address: current_address,
contract: contract?,
truncate: truncate
truncate: truncate,
use_custom_tooltip: false
]
end
@ -281,7 +282,8 @@ defmodule BlockScoutWeb.AddressView do
partial: "_link.html",
address: address,
contract: contract?,
truncate: truncate
truncate: truncate,
use_custom_tooltip: false
]
end

@ -186,7 +186,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/_link.html.eex:2
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:28
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:46
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:48
msgid "Block #%{number}"
msgstr ""
@ -251,7 +251,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:32
#: lib/block_scout_web/templates/address/overview.html.eex:97
#: lib/block_scout_web/templates/address_validation/index.html.eex:13
#: lib/block_scout_web/views/address_view.ex:311
#: lib/block_scout_web/views/address_view.ex:313
msgid "Blocks Validated"
msgstr ""
@ -305,13 +305,13 @@ msgstr ""
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149
#: lib/block_scout_web/views/address_view.ex:307
#: lib/block_scout_web/views/address_view.ex:309
msgid "Code"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:20
#: lib/block_scout_web/views/address_view.ex:310
#: lib/block_scout_web/views/address_view.ex:312
msgid "Coin Balance History"
msgstr ""
@ -526,7 +526,7 @@ msgid "Decoded"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/address_view.ex:308
#: lib/block_scout_web/views/address_view.ex:310
msgid "Decompiled Code"
msgstr ""
@ -546,16 +546,16 @@ msgid "Decompiler version"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/_tile.html.eex:56
#: lib/block_scout_web/templates/block/_tile.html.eex:57
#: lib/block_scout_web/templates/block/overview.html.eex:108
#: lib/block_scout_web/templates/block/overview.html.eex:158
#: lib/block_scout_web/templates/block/overview.html.eex:159
msgid "Gas Limit"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/_tile.html.eex:61
#: lib/block_scout_web/templates/block/_tile.html.eex:62
#: lib/block_scout_web/templates/block/overview.html.eex:101
#: lib/block_scout_web/templates/block/overview.html.eex:152
#: lib/block_scout_web/templates/block/overview.html.eex:153
msgid "Gas Used"
msgstr ""
@ -934,7 +934,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:8
#: lib/block_scout_web/templates/address_token/index.html.eex:8
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9
#: lib/block_scout_web/views/address_view.ex:304
#: lib/block_scout_web/views/address_view.ex:306
msgid "Tokens"
msgstr ""
@ -987,7 +987,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6
#: lib/block_scout_web/views/address_view.ex:306
#: lib/block_scout_web/views/address_view.ex:308
#: lib/block_scout_web/views/transaction_view.ex:314
msgid "Internal Transactions"
msgstr ""
@ -1076,7 +1076,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_logs/index.html.eex:8
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:17
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8
#: lib/block_scout_web/views/address_view.ex:312
#: lib/block_scout_web/views/address_view.ex:314
#: lib/block_scout_web/views/transaction_view.ex:315
msgid "Logs"
msgstr ""
@ -1267,7 +1267,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:58
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25
#: lib/block_scout_web/views/address_view.ex:309
#: lib/block_scout_web/views/address_view.ex:311
#: lib/block_scout_web/views/tokens/overview_view.ex:37
msgid "Read Contract"
msgstr ""
@ -1301,8 +1301,8 @@ msgid "Responses"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/_tile.html.eex:47
#: lib/block_scout_web/templates/chain/_block.html.eex:23
#: lib/block_scout_web/templates/block/_tile.html.eex:48
#: lib/block_scout_web/templates/chain/_block.html.eex:24
#: lib/block_scout_web/views/internal_transaction_view.ex:28
msgid "Reward"
msgstr ""
@ -1366,7 +1366,7 @@ msgid "Show Validator Info"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/overview.html.eex:145
#: lib/block_scout_web/templates/block/overview.html.eex:146
msgid "Block Rewards"
msgstr ""
@ -1559,7 +1559,7 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:145
#: lib/block_scout_web/templates/layout/_topnav.html.eex:64
#: lib/block_scout_web/views/address_view.ex:305
#: lib/block_scout_web/views/address_view.ex:307
msgid "Transactions"
msgstr ""

@ -186,7 +186,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/_link.html.eex:2
#: lib/block_scout_web/templates/internal_transaction/_tile.html.eex:28
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:46
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:48
msgid "Block #%{number}"
msgstr ""
@ -251,7 +251,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:32
#: lib/block_scout_web/templates/address/overview.html.eex:97
#: lib/block_scout_web/templates/address_validation/index.html.eex:13
#: lib/block_scout_web/views/address_view.ex:311
#: lib/block_scout_web/views/address_view.ex:313
msgid "Blocks Validated"
msgstr ""
@ -305,13 +305,13 @@ msgstr ""
#: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:126
#: lib/block_scout_web/templates/api_docs/_eth_rpc_item.html.eex:149
#: lib/block_scout_web/views/address_view.ex:307
#: lib/block_scout_web/views/address_view.ex:309
msgid "Code"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:20
#: lib/block_scout_web/views/address_view.ex:310
#: lib/block_scout_web/views/address_view.ex:312
msgid "Coin Balance History"
msgstr ""
@ -526,7 +526,7 @@ msgid "Decoded"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/address_view.ex:308
#: lib/block_scout_web/views/address_view.ex:310
msgid "Decompiled Code"
msgstr ""
@ -546,16 +546,16 @@ msgid "Decompiler version"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/_tile.html.eex:56
#: lib/block_scout_web/templates/block/_tile.html.eex:57
#: lib/block_scout_web/templates/block/overview.html.eex:108
#: lib/block_scout_web/templates/block/overview.html.eex:158
#: lib/block_scout_web/templates/block/overview.html.eex:159
msgid "Gas Limit"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/_tile.html.eex:61
#: lib/block_scout_web/templates/block/_tile.html.eex:62
#: lib/block_scout_web/templates/block/overview.html.eex:101
#: lib/block_scout_web/templates/block/overview.html.eex:152
#: lib/block_scout_web/templates/block/overview.html.eex:153
msgid "Gas Used"
msgstr ""
@ -934,7 +934,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/_tabs.html.eex:8
#: lib/block_scout_web/templates/address_token/index.html.eex:8
#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9
#: lib/block_scout_web/views/address_view.ex:304
#: lib/block_scout_web/views/address_view.ex:306
msgid "Tokens"
msgstr ""
@ -987,7 +987,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:11
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6
#: lib/block_scout_web/views/address_view.ex:306
#: lib/block_scout_web/views/address_view.ex:308
#: lib/block_scout_web/views/transaction_view.ex:314
msgid "Internal Transactions"
msgstr ""
@ -1076,7 +1076,7 @@ msgstr ""
#: lib/block_scout_web/templates/address_logs/index.html.eex:8
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:17
#: lib/block_scout_web/templates/transaction_log/index.html.eex:8
#: lib/block_scout_web/views/address_view.ex:312
#: lib/block_scout_web/views/address_view.ex:314
#: lib/block_scout_web/views/transaction_view.ex:315
msgid "Logs"
msgstr ""
@ -1267,7 +1267,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address/_tabs.html.eex:58
#: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25
#: lib/block_scout_web/views/address_view.ex:309
#: lib/block_scout_web/views/address_view.ex:311
#: lib/block_scout_web/views/tokens/overview_view.ex:37
msgid "Read Contract"
msgstr ""
@ -1301,8 +1301,8 @@ msgid "Responses"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/_tile.html.eex:47
#: lib/block_scout_web/templates/chain/_block.html.eex:23
#: lib/block_scout_web/templates/block/_tile.html.eex:48
#: lib/block_scout_web/templates/chain/_block.html.eex:24
#: lib/block_scout_web/views/internal_transaction_view.ex:28
msgid "Reward"
msgstr ""
@ -1366,7 +1366,7 @@ msgid "Show Validator Info"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/block/overview.html.eex:145
#: lib/block_scout_web/templates/block/overview.html.eex:146
msgid "Block Rewards"
msgstr ""
@ -1559,7 +1559,7 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:18
#: lib/block_scout_web/templates/chain/show.html.eex:145
#: lib/block_scout_web/templates/layout/_topnav.html.eex:64
#: lib/block_scout_web/views/address_view.ex:305
#: lib/block_scout_web/views/address_view.ex:307
msgid "Transactions"
msgstr ""

@ -32,7 +32,8 @@ defmodule BlockScoutWeb.AddressViewTest do
partial: "_link.html",
address: ^to_address,
contract: false,
truncate: true
truncate: true,
use_custom_tooltip: false
] = AddressView.address_partial_selector(transaction, :to, nil, true)
end
@ -44,7 +45,8 @@ defmodule BlockScoutWeb.AddressViewTest do
partial: "_link.html",
address: ^to_address,
contract: false,
truncate: false
truncate: false,
use_custom_tooltip: false
] = AddressView.address_partial_selector(transaction, :to, nil)
end
@ -56,7 +58,8 @@ defmodule BlockScoutWeb.AddressViewTest do
partial: "_link.html",
address: ^to_address,
contract: false,
truncate: false
truncate: false,
use_custom_tooltip: false
] = AddressView.address_partial_selector(transaction, :to, nil)
end
@ -68,7 +71,8 @@ defmodule BlockScoutWeb.AddressViewTest do
partial: "_responsive_hash.html",
address: ^to_address,
contract: false,
truncate: false
truncate: false,
use_custom_tooltip: false
] = AddressView.address_partial_selector(transaction, :to, transaction.to_address)
end
@ -81,7 +85,8 @@ defmodule BlockScoutWeb.AddressViewTest do
partial: "_link.html",
address: ^contract_address,
contract: true,
truncate: false
truncate: false,
use_custom_tooltip: false
] = AddressView.address_partial_selector(transaction, :to, transaction.to_address)
end
@ -94,7 +99,8 @@ defmodule BlockScoutWeb.AddressViewTest do
partial: "_responsive_hash.html",
address: ^contract_address,
contract: true,
truncate: false
truncate: false,
use_custom_tooltip: false
] = AddressView.address_partial_selector(transaction, :to, contract_address)
end
@ -106,7 +112,8 @@ defmodule BlockScoutWeb.AddressViewTest do
partial: "_link.html",
address: ^to_address,
contract: false,
truncate: false
truncate: false,
use_custom_tooltip: false
] = AddressView.address_partial_selector(transaction, :to, nil)
end
@ -118,7 +125,8 @@ defmodule BlockScoutWeb.AddressViewTest do
partial: "_responsive_hash.html",
address: ^from_address,
contract: false,
truncate: false
truncate: false,
use_custom_tooltip: false
] = AddressView.address_partial_selector(transaction, :from, transaction.from_address)
end
end

Loading…
Cancel
Save