add Back button

pull/1812/head
Ayrat Badykov 6 years ago
parent dc26688368
commit d733a5d0f2
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 17
      apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex
  2. 18
      apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex

@ -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

@ -8,8 +8,19 @@
<%= gettext " addresses of" %>
<%= Cldr.Number.to_string!(@address_count, format: "#,###") %>
<%= gettext "total addresses with a balance" %>
</p>
<%= if @next_page_path do %>
<a href="<%= "#{@next_page_path}" %>" class="button button-secondary button-small float-right mt-0 ml-1">
<%= gettext("Next") %>
</a>
<% end %>
<%= if @prev_page_path do %>
<a href="<%= "#{@prev_page_path}" %>" class="button button-secondary button-small float-right mt-0">
<%= gettext("Back") %>
</a>
<% end %>
</p>
<br>
<span data-selector="top-addresses-list">
<%= for {{address, tx_count}, index} <- Enum.with_index(@address_tx_count_pairs, 1) do %>
<%= render "_tile.html",
@ -17,11 +28,6 @@
total_supply: @total_supply, tx_count: tx_count,
validation_count: validation_count(address) %>
<% end %>
<%= if @next_page_path do %>
<a href="<%= "#{@next_page_path}" %>" class="button button-secondary button-small float-right mt-4">
<%= gettext("Next") %>
</a>
<% end %>
</span>
</div>
</div>

Loading…
Cancel
Save