From 0df2160963578ab926b45065067ac3016f472cde Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Mon, 5 Oct 2020 10:42:10 +0300 Subject: [PATCH] Fix pagination for bridged tokens list page --- CHANGELOG.md | 9 +++++++++ apps/block_scout_web/lib/block_scout_web/chain.ex | 4 ++++ .../controllers/tokens/bridged_tokens_controller.ex | 2 +- .../templates/bridged_tokens/index.html.eex | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f482d10073..02da3ead56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ ## Current +### Features + + +### Fixes +- [#3329](https://github.com/poanetwork/blockscout/pull/3329) - Fix pagination for bridged tokens list page + +### Chore + + ## 3.3.3-beta diff --git a/apps/block_scout_web/lib/block_scout_web/chain.ex b/apps/block_scout_web/lib/block_scout_web/chain.ex index 23efee7c7a..be2b1762ac 100644 --- a/apps/block_scout_web/lib/block_scout_web/chain.ex +++ b/apps/block_scout_web/lib/block_scout_web/chain.ex @@ -220,6 +220,10 @@ defmodule BlockScoutWeb.Chain do %{"contract_address_hash" => contract_address_hash, "holder_count" => holder_count} end + defp paging_params([%Token{contract_address_hash: contract_address_hash, holder_count: holder_count}, _]) do + %{"contract_address_hash" => contract_address_hash, "holder_count" => holder_count} + end + defp paging_params({%Reward{block: %{number: number}}, _}) do %{"block_number" => number, "index" => 0} end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/bridged_tokens_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/bridged_tokens_controller.ex index 3aeea6602f..460268f7f5 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/tokens/bridged_tokens_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/tokens/bridged_tokens_controller.ex @@ -21,7 +21,7 @@ defmodule BlockScoutWeb.BridgedTokensController do nil next_page_params -> - tokens_path( + bridged_tokens_path( conn, :index, Map.delete(next_page_params, "type") diff --git a/apps/block_scout_web/lib/block_scout_web/templates/bridged_tokens/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/bridged_tokens/index.html.eex index 6277ab16cd..cd125f6538 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/bridged_tokens/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/bridged_tokens/index.html.eex @@ -32,7 +32,7 @@ - + <%= render BlockScoutWeb.CommonComponentsView, "_table-loader.html", total_supply: @total_supply %>