Disable pagination with scrivener for transactions

pull/3/head
Doc Ritezel 7 years ago
parent b819733bf2
commit 3c1f089e83
  1. 3
      assets/css/components/_transactions.scss
  2. 22
      lib/explorer_web/controllers/pending_transaction_controller.ex
  3. 12
      lib/explorer_web/controllers/transaction_controller.ex
  4. 1
      lib/explorer_web/templates/pending_transaction/index.html.eex
  5. 1
      lib/explorer_web/templates/transaction/index.html.eex

@ -11,10 +11,9 @@
&__title {
@include explorer-typography("title");
color: explorer-color("slate", "100");
margin: 0;
}
&__headline-title { line-height: 18px; }
&__title { margin: 0; }
&__table {
@extend %table;

@ -10,21 +10,27 @@ defmodule ExplorerWeb.PendingTransactionController do
def index(conn, params) do
query = from transaction in Transaction,
left_join: receipt in assoc(transaction, :receipt),
left_join: block_transaction in assoc(transaction, :block_transaction),
join: to_address in assoc(transaction, :to_address),
join: from_address in assoc(transaction, :from_address),
inner_join: to_address in assoc(transaction, :to_address),
inner_join: from_address in assoc(transaction, :from_address),
preload: [to_address: to_address, from_address: from_address],
order_by: [desc: transaction.inserted_at],
where: is_nil(receipt.transaction_id)
total_query = from transaction in Transaction,
select: fragment("count(?)", transaction.id),
left_join: receipt in assoc(transaction, :receipt),
where: is_nil(receipt.transaction_id)
transactions = query |> Repo.paginate(params)
transactions = Repo.paginate(
query,
params
|> Map.put(:total_entries, Repo.one(total_query))
|> Map.put(:page_size, 25)
)
entries = transactions.entries |> Enum.map(&PendingTransactionForm.build/1)
render(
conn,
"index.html",
transactions:
transactions
|> Map.put(:entries, transactions.entries
|> Enum.map(&PendingTransactionForm.build/1))
transactions: Map.put(transactions, :entries, entries)
)
end
end

@ -17,8 +17,16 @@ defmodule ExplorerWeb.TransactionController do
block: block, receipt: receipt,
to_address: to_address, from_address: from_address],
order_by: [desc: block.timestamp]
transactions = Repo.paginate(query, params)
total_query = from transaction in Transaction,
select: fragment("count(?)", transaction.id),
inner_join: receipt in assoc(transaction, :receipt),
inner_join: block in assoc(transaction, :block)
transactions = Repo.paginate(
query,
params
|> Map.put(:total_entries, Repo.one(total_query))
|> Map.put(:page_size, 25)
)
render(conn, "index.html", transactions: transactions)
end

@ -2,7 +2,6 @@
<section class="container__subsection">
<div class="transactions__headline">
<h1 class="transactions__headline-title"><%= gettext("Showing %{count} Pending Transactions", count: @transactions.total_entries) %></h1>
<div class="transactions__pagination"><%= pagination_links @conn, @transactions, ["en"], view_style: :bulma, first: true, distance: 1, previous: Phoenix.HTML.raw("&lsaquo;"), next: Phoenix.HTML.raw("&rsaquo;"), path: &pending_transaction_path/4 %></div>
</div>
<div class="transactions">
<div class="transactions__tabs">

@ -2,7 +2,6 @@
<section class="container__subsection">
<div class="transactions__headline">
<h1 class="transactions__headline-title"><%= gettext("Showing %{count} Transactions", count: @transactions.total_entries) %></h1>
<div class="transactions__pagination"><%= pagination_links @conn, @transactions, ["en"], view_style: :bulma, first: true, distance: 1, previous: Phoenix.HTML.raw("&lsaquo;"), next: Phoenix.HTML.raw("&rsaquo;"), path: &transaction_path/4 %></div>
</div>
<div class="transactions">
<div class="transactions__tabs">

Loading…
Cancel
Save