From 17f71985eaab52318749238c5d2aa0271446f806 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 10 Aug 2020 17:15:15 +0300 Subject: [PATCH] Unlimited number of tokens in search results --- CHANGELOG.md | 1 + apps/block_scout_web/assets/css/components/_navbar.scss | 8 ++++++++ .../lib/block_scout_web/templates/layout/_topnav.html.eex | 1 + apps/block_scout_web/priv/gettext/default.pot | 2 +- .../priv/gettext/en/LC_MESSAGES/default.po | 4 ++-- apps/explorer/lib/explorer/chain.ex | 2 -- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a667e96beb..4d6e5e4231 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - [#3224](https://github.com/poanetwork/blockscout/pull/3224) - Top tokens page ### Fixes +- [#3231](https://github.com/poanetwork/blockscout/pull/3231) - Improve search: unlimited number of searching results - [#3231](https://github.com/poanetwork/blockscout/pull/3231) - Improve search: allow search with space - [#3231](https://github.com/poanetwork/blockscout/pull/3231) - Improve search: order by token holders in descendant order - [#3226](https://github.com/poanetwork/blockscout/pull/3226) - Fix notifier query for live update of token transfers diff --git a/apps/block_scout_web/assets/css/components/_navbar.scss b/apps/block_scout_web/assets/css/components/_navbar.scss index 05ab0f109d..e22a3ee82c 100644 --- a/apps/block_scout_web/assets/css/components/_navbar.scss +++ b/apps/block_scout_web/assets/css/components/_navbar.scss @@ -186,6 +186,14 @@ $navbar-logo-width: auto !default; } } +.input-group { + + .awesomplete > ul { + overflow-y: auto !important; + max-height: 300px !important; + } +} + .navbar-collapse.collapsing, .navbar-collapse.collapse.show { display: flex; diff --git a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex index cc6956779f..abe4e6e9b6 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex @@ -174,6 +174,7 @@ ], [ url: "#{chain_path(@conn, :token_autocomplete)}?q=", limit: 0, + maxItems: 1000, minChars: 2, value: "contract_address_hash", label: "contract_address_hash", diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 13afaf24e4..fdf58f2081 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -1244,7 +1244,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/index.html.eex:14 #: lib/block_scout_web/templates/layout/_topnav.html.eex:172 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:189 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:190 msgid "Search" msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index a10040b7b6..fdf58f2081 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -1244,7 +1244,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_logs/index.html.eex:14 #: lib/block_scout_web/templates/layout/_topnav.html.eex:172 -#: lib/block_scout_web/templates/layout/_topnav.html.eex:189 +#: lib/block_scout_web/templates/layout/_topnav.html.eex:190 msgid "Search" msgstr "" @@ -1940,7 +1940,7 @@ msgstr "" msgid "Copy Raw Trace" msgstr "" -#, elixir-format, fuzzy +#, elixir-format #: lib/block_scout_web/templates/layout/_topnav.html.eex:170 msgid "Search by address, token symbol, name, transaction hash, or block number" msgstr "" diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index d6d01669dd..504f3ac721 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -1043,7 +1043,6 @@ defmodule Explorer.Chain do query = from(token in Token, where: fragment("to_tsvector('english', symbol || ' ' || name ) @@ to_tsquery(?)", ^term_final), - limit: 5, select: %{ contract_address_hash: token.contract_address_hash, symbol: token.symbol, @@ -1066,7 +1065,6 @@ defmodule Explorer.Chain do query = from(smart_contract in SmartContract, where: fragment("to_tsvector('english', name ) @@ to_tsquery(?)", ^term_final), - limit: 5, select: %{contract_address_hash: smart_contract.address_hash, name: smart_contract.name} )