Merge pull request #946 from poanetwork/txn-dropdown-menu

Add transaction dropdown menu to navbar
pull/955/head
Andrew Cravenho 6 years ago committed by GitHub
commit e4e79adea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex
  2. 55
      apps/block_scout_web/lib/block_scout_web/templates/pending_transaction/index.html.eex
  3. 55
      apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex
  4. 50
      apps/block_scout_web/priv/gettext/default.pot
  5. 50
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  6. 8
      apps/block_scout_web/test/block_scout_web/features/pages/transaction_list_page.ex
  7. 9
      apps/block_scout_web/test/block_scout_web/features/viewing_transactions_test.exs

@ -15,7 +15,7 @@
</span>
<%= gettext("Blocks") %>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<div class="dropdown-menu" aria-labelledby="navbarBlocksDropdown">
<%= link to: block_path(@conn, :index), class: "dropdown-item" do %>
<%= gettext("Blocks") %>
<% end %>
@ -27,13 +27,26 @@
<% end %>
</div>
</li>
<li class="nav-item">
<%= link to: transaction_path(@conn, :index), class: "nav-link topnav-nav-link" do %>
<li class="nav-item dropdown">
<a href="#" role="button" id="navbarTransactionsDropdown" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="nav-link-icon">
<%= render BlockScoutWeb.IconsView, "_transaction_icon.html" %>
</span>
<%= gettext("Transactions") %>
<% end %>
</a>
<div class="dropdown-menu" aria-labeledby="navbarTransactionsDropdown">
<%= link(
gettext("Validated"),
class: "dropdown-item",
to: transaction_path(@conn, :index)
) %>
<%= link(
gettext("Pending"),
class: "dropdown-item",
"data-test": "pending_transactions_link",
to: pending_transaction_path(@conn, :index)
) %>
</div>
</li>
<li class="nav-item">
<%= link to: address_path(@conn, :index), class: "nav-link topnav-nav-link" do %>

@ -1,48 +1,14 @@
<section class="container" data-page="transaction-pending-list">
<div class="card">
<div class="card-header">
<!-- DESKTOP TAB NAV -->
<ul class="nav nav-tabs card-header-tabs d-none d-md-inline-flex">
<li class="nav-item">
<%= link(
gettext("Validated"),
class: "nav-link",
to: transaction_path(@conn, :index)
) %>
</li>
<li class="nav-item">
<%= link(
gettext("Pending"),
class: "nav-link active",
"data-test": "pending_transactions_link",
to: pending_transaction_path(@conn, :index)
) %>
</li>
</ul>
<div class="card-body">
<!-- MOBILE DROPDOWN NAV -->
<ul class="nav nav-tabs card-header-tabs d-lg-none">
<li class="nav-item dropdown flex-fill text-center">
<a class="nav-link active dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"><%= gettext("Pending") %></a>
<div class="dropdown-menu">
<%= link(
gettext("Validated"),
class: "dropdown-item",
to: transaction_path(@conn, :index)
) %>
<%= link(
gettext("Pending"),
class: "dropdown-item active",
"data-test": "pending_transactions_link",
to: pending_transaction_path(@conn, :index)
) %>
</div>
</li>
</ul>
</div>
<h1><%= gettext "Pending Transactions" %></h1>
<p>
<%= gettext("Showing") %>
<span data-selector="transaction-pending-count"><%= Cldr.Number.to_string!(@pending_transaction_count, format: "#,###") %></span>
<%= gettext("Pending Transactions") %>
</p>
<div class="card-body">
<div data-selector="channel-batching-message" style="display:none;">
<div data-selector="reload-button" class="alert alert-info">
<a href="#" class="alert-link"><span data-selector="channel-batching-count"></span> <%= gettext "More transactions have come in" %></a>
@ -53,12 +19,7 @@
<a href="#" class="alert-link"><%= gettext "Connection Lost, click to load newer transactions" %></a>
</div>
</div>
<h2 class="card-title mb-0"><%= gettext "Transactions" %></h2>
<p>
<%= gettext("Showing") %>
<span data-selector="transaction-pending-count"><%= Cldr.Number.to_string!(@pending_transaction_count, format: "#,###") %></span>
<%= gettext("Pending Transactions") %>
</p>
<span data-selector="transactions-pending-list">
<%= for transaction <- @transactions do %>
<%= render BlockScoutWeb.TransactionView, "_tile.html", transaction: transaction %>

@ -1,48 +1,14 @@
<section class="container" data-page="transaction-list">
<div class="card">
<div class="card-header">
<!-- DESKTOP TAB NAV -->
<ul class="nav nav-tabs card-header-tabs d-none d-lg-inline-flex">
<li class="nav-item">
<%= link(
gettext("Validated"),
class: "nav-link active",
to: transaction_path(@conn, :index)
) %>
</li>
<li class="nav-item">
<%= link(
gettext("Pending"),
class: "nav-link",
"data-test": "pending_transactions_link",
to: pending_transaction_path(@conn, :index)
) %>
</li>
</ul>
<div class="card-body">
<!-- MOBILE DROPDOWN NAV -->
<ul class="nav nav-tabs card-header-tabs d-lg-none">
<li class="nav-item dropdown flex-fill text-center">
<a class="nav-link active dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"><%= gettext("Validated") %></a>
<div class="dropdown-menu">
<%= link(
gettext("Validated"),
class: "dropdown-item active",
to: transaction_path(@conn, :index)
) %>
<%= link(
gettext("Pending"),
class: "dropdown-item",
"data-test": "pending_transactions_link",
to: pending_transaction_path(@conn, :index)
) %>
</div>
</li>
</ul>
</div>
<h1><%= gettext "Validated Transactions" %></h1>
<p>
<%= gettext("Showing") %>
<span data-selector="transaction-count"><%= Cldr.Number.to_string!(@transaction_estimated_count, format: "#,###") %></span>
<%= gettext("Validated Transactions") %>
</p>
<div class="card-body">
<div data-selector="channel-batching-message" class="d-none">
<div data-selector="reload-button" class="alert alert-info">
<a href="#" class="alert-link"><span data-selector="channel-batching-count"></span> <%= gettext "More transactions have come in" %></a>
@ -53,12 +19,7 @@
<a href="#" class="alert-link"><%= gettext "Connection Lost, click to load newer transactions" %></a>
</div>
</div>
<h1><%= gettext "Transactions" %></h1>
<p>
<%= gettext("Showing") %>
<span data-selector="transaction-count"><%= Cldr.Number.to_string!(@transaction_estimated_count, format: "#,###") %></span>
<%= gettext("Validated Transactions") %>
</p>
<span data-selector="transactions-list">
<%= for transaction <- @transactions do %>
<%= render BlockScoutWeb.TransactionView, "_tile.html", transaction: transaction %>

@ -84,7 +84,7 @@ msgid "A string with the name of the module to be invoked."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:51
#: lib/block_scout_web/templates/layout/_topnav.html.eex:64
msgid "API"
msgstr ""
@ -99,7 +99,7 @@ msgid "API for the %{subnetwork} - BlockScout"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:43
#: lib/block_scout_web/templates/layout/_topnav.html.eex:56
msgid "Accounts"
msgstr ""
@ -258,8 +258,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_transaction/index.html.eex:14
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:53
#: lib/block_scout_web/templates/transaction/index.html.eex:53
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:19
#: lib/block_scout_web/templates/transaction/index.html.eex:19
msgid "Connection Lost, click to load newer transactions"
msgstr ""
@ -579,8 +579,8 @@ msgid "More internal transactions have come in"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:48
#: lib/block_scout_web/templates/transaction/index.html.eex:48
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:14
#: lib/block_scout_web/templates/transaction/index.html.eex:14
msgid "More transactions have come in"
msgstr ""
@ -642,9 +642,9 @@ msgstr ""
#: lib/block_scout_web/templates/address_validation/index.html.eex:117
#: lib/block_scout_web/templates/block/index.html.eex:20
#: lib/block_scout_web/templates/block_transaction/index.html.eex:50
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:70
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:31
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:34
#: lib/block_scout_web/templates/transaction/index.html.eex:70
#: lib/block_scout_web/templates/transaction/index.html.eex:31
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:24
msgid "Older"
msgstr ""
@ -660,12 +660,12 @@ msgid "Owner Address"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:82
#: lib/block_scout_web/templates/layout/_topnav.html.eex:95
msgid "POA Core"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:81
#: lib/block_scout_web/templates/layout/_topnav.html.eex:94
msgid "POA Sokol"
msgstr ""
@ -685,11 +685,7 @@ msgid "Parent Hash"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:16
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:27
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:35
#: lib/block_scout_web/templates/transaction/index.html.eex:16
#: lib/block_scout_web/templates/transaction/index.html.eex:35
#: lib/block_scout_web/templates/layout/_topnav.html.eex:44
#: lib/block_scout_web/templates/transaction/overview.html.eex:54
#: lib/block_scout_web/views/transaction_view.ex:57
#: lib/block_scout_web/views/transaction_view.ex:83
@ -698,7 +694,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_transaction/index.html.eex:60
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:60
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:5
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:9
msgid "Pending Transactions"
msgstr ""
@ -760,13 +757,13 @@ msgid "Responses"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:58
#: lib/block_scout_web/templates/layout/_topnav.html.eex:65
#: lib/block_scout_web/templates/layout/_topnav.html.eex:71
#: lib/block_scout_web/templates/layout/_topnav.html.eex:78
msgid "Search"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:58
#: lib/block_scout_web/templates/layout/_topnav.html.eex:71
msgid "Search by address, transaction hash, or block number"
msgstr ""
@ -792,8 +789,8 @@ msgid "Show QR Code"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:58
#: lib/block_scout_web/templates/transaction/index.html.eex:58
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:7
#: lib/block_scout_web/templates/transaction/index.html.eex:7
msgid "Showing"
msgstr ""
@ -1004,8 +1001,6 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:35
#: lib/block_scout_web/templates/chain/show.html.eex:71
#: lib/block_scout_web/templates/layout/_topnav.html.eex:35
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:56
#: lib/block_scout_web/templates/transaction/index.html.eex:56
#: lib/block_scout_web/views/address_view.ex:208
msgid "Transactions"
msgstr ""
@ -1048,16 +1043,13 @@ msgid "Used"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:9
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:30
#: lib/block_scout_web/templates/transaction/index.html.eex:9
#: lib/block_scout_web/templates/transaction/index.html.eex:27
#: lib/block_scout_web/templates/transaction/index.html.eex:30
#: lib/block_scout_web/templates/layout/_topnav.html.eex:39
msgid "Validated"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/index.html.eex:60
#: lib/block_scout_web/templates/transaction/index.html.eex:5
#: lib/block_scout_web/templates/transaction/index.html.eex:9
msgid "Validated Transactions"
msgstr ""

@ -84,7 +84,7 @@ msgid "A string with the name of the module to be invoked."
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:51
#: lib/block_scout_web/templates/layout/_topnav.html.eex:64
msgid "API"
msgstr ""
@ -99,7 +99,7 @@ msgid "API for the %{subnetwork} - BlockScout"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:43
#: lib/block_scout_web/templates/layout/_topnav.html.eex:56
msgid "Accounts"
msgstr ""
@ -258,8 +258,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_transaction/index.html.eex:14
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:53
#: lib/block_scout_web/templates/transaction/index.html.eex:53
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:19
#: lib/block_scout_web/templates/transaction/index.html.eex:19
msgid "Connection Lost, click to load newer transactions"
msgstr ""
@ -579,8 +579,8 @@ msgid "More internal transactions have come in"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:48
#: lib/block_scout_web/templates/transaction/index.html.eex:48
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:14
#: lib/block_scout_web/templates/transaction/index.html.eex:14
msgid "More transactions have come in"
msgstr ""
@ -642,9 +642,9 @@ msgstr ""
#: lib/block_scout_web/templates/address_validation/index.html.eex:117
#: lib/block_scout_web/templates/block/index.html.eex:20
#: lib/block_scout_web/templates/block_transaction/index.html.eex:50
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:70
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:31
#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:34
#: lib/block_scout_web/templates/transaction/index.html.eex:70
#: lib/block_scout_web/templates/transaction/index.html.eex:31
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:24
msgid "Older"
msgstr ""
@ -660,12 +660,12 @@ msgid "Owner Address"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:82
#: lib/block_scout_web/templates/layout/_topnav.html.eex:95
msgid "POA Core"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:81
#: lib/block_scout_web/templates/layout/_topnav.html.eex:94
msgid "POA Sokol"
msgstr ""
@ -685,11 +685,7 @@ msgid "Parent Hash"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:16
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:27
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:35
#: lib/block_scout_web/templates/transaction/index.html.eex:16
#: lib/block_scout_web/templates/transaction/index.html.eex:35
#: lib/block_scout_web/templates/layout/_topnav.html.eex:44
#: lib/block_scout_web/templates/transaction/overview.html.eex:54
#: lib/block_scout_web/views/transaction_view.ex:57
#: lib/block_scout_web/views/transaction_view.ex:83
@ -698,7 +694,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/address_transaction/index.html.eex:60
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:60
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:5
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:9
msgid "Pending Transactions"
msgstr ""
@ -760,13 +757,13 @@ msgid "Responses"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:58
#: lib/block_scout_web/templates/layout/_topnav.html.eex:65
#: lib/block_scout_web/templates/layout/_topnav.html.eex:71
#: lib/block_scout_web/templates/layout/_topnav.html.eex:78
msgid "Search"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:58
#: lib/block_scout_web/templates/layout/_topnav.html.eex:71
msgid "Search by address, transaction hash, or block number"
msgstr ""
@ -792,8 +789,8 @@ msgid "Show QR Code"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:58
#: lib/block_scout_web/templates/transaction/index.html.eex:58
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:7
#: lib/block_scout_web/templates/transaction/index.html.eex:7
msgid "Showing"
msgstr ""
@ -1004,8 +1001,6 @@ msgstr ""
#: lib/block_scout_web/templates/block_transaction/index.html.eex:35
#: lib/block_scout_web/templates/chain/show.html.eex:71
#: lib/block_scout_web/templates/layout/_topnav.html.eex:35
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:56
#: lib/block_scout_web/templates/transaction/index.html.eex:56
#: lib/block_scout_web/views/address_view.ex:208
msgid "Transactions"
msgstr ""
@ -1048,16 +1043,13 @@ msgid "Used"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:9
#: lib/block_scout_web/templates/pending_transaction/index.html.eex:30
#: lib/block_scout_web/templates/transaction/index.html.eex:9
#: lib/block_scout_web/templates/transaction/index.html.eex:27
#: lib/block_scout_web/templates/transaction/index.html.eex:30
#: lib/block_scout_web/templates/layout/_topnav.html.eex:39
msgid "Validated"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/index.html.eex:60
#: lib/block_scout_web/templates/transaction/index.html.eex:5
#: lib/block_scout_web/templates/transaction/index.html.eex:9
msgid "Validated Transactions"
msgstr ""

@ -11,10 +11,6 @@ defmodule BlockScoutWeb.TransactionListPage do
click(session, css("[data-transaction-hash='#{transaction_hash}'] [data-test='transaction_hash_link']"))
end
def click_pending(session) do
click(session, css("[data-test='pending_transactions_link']"))
end
def contract_creation(%Transaction{hash: hash}) do
css("[data-transaction-hash='#{hash}'] [data-test='transaction_type']", text: "Contract Creation")
end
@ -30,4 +26,8 @@ defmodule BlockScoutWeb.TransactionListPage do
def visit_page(session) do
visit(session, "/txs")
end
def visit_pending_transactions_page(session) do
visit(session, "/pending_transactions")
end
end

@ -74,10 +74,13 @@ defmodule BlockScoutWeb.ViewingTransactionsTest do
|> refute_has(TransactionListPage.transaction(pending))
end
test "viewing the pending tab", %{pending: pending, pending_contract: pending_contract, session: session} do
test "viewing the pending tranasctions list", %{
pending: pending,
pending_contract: pending_contract,
session: session
} do
session
|> TransactionListPage.visit_page()
|> TransactionListPage.click_pending()
|> TransactionListPage.visit_pending_transactions_page()
|> assert_has(TransactionListPage.transaction(pending))
|> assert_has(TransactionListPage.transaction(pending_contract))
|> assert_has(TransactionListPage.transaction_status(pending_contract))

Loading…
Cancel
Save