diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex index 730b09eb8f..6f834034cf 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex @@ -21,10 +21,12 @@ defmodule BlockScoutWeb.AddressController do nil next_page_params -> + next_params = Map.put(next_page_params, "prev_page_path", cur_page_path(conn, params)) + address_path( conn, :index, - next_page_params + next_params ) end @@ -34,7 +36,8 @@ defmodule BlockScoutWeb.AddressController do address_count: Chain.count_addresses_with_balance_from_cache(), exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), total_supply: Chain.total_supply(), - next_page_path: next_page_path + next_page_path: next_page_path, + prev_page_path: params["prev_page_path"] ) end @@ -49,4 +52,14 @@ defmodule BlockScoutWeb.AddressController do def validation_count(%Address{} = address) do Chain.address_to_validation_count(address) end + + defp cur_page_path(conn, %{"hash" => _hash, "fetched_coin_balance" => _balance} = params) do + address_path( + conn, + :index, + params + ) + end + + defp cur_page_path(conn, _), do: address_path(conn, :index) end diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex index cf4e0efb95..535b732f44 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex @@ -8,8 +8,19 @@ <%= gettext " addresses of" %> <%= Cldr.Number.to_string!(@address_count, format: "#,###") %> <%= gettext "total addresses with a balance" %> -
+ <%= if @next_page_path do %> + " class="button button-secondary button-small float-right mt-0 ml-1"> + <%= gettext("Next") %> + + <% end %> + <%= if @prev_page_path do %> + " class="button button-secondary button-small float-right mt-0"> + <%= gettext("Back") %> + + <% end %> + +