parent
68c701da33
commit
22b86b59de
@ -1,5 +1,6 @@ |
||||
@import "blocks"; |
||||
@import "container"; |
||||
@import "header"; |
||||
@import "block-detail"; |
||||
@import "transactions"; |
||||
@import "footer"; |
||||
|
@ -0,0 +1,51 @@ |
||||
.block-detail { |
||||
&__container { |
||||
@extend %paper; |
||||
padding: explorer-size(-1) explorer-size(0); |
||||
} |
||||
|
||||
&__title { |
||||
@include explorer-typography("title"); |
||||
color: explorer-color("slate", "100"); |
||||
margin: 0; |
||||
} |
||||
|
||||
&__column { |
||||
@include explorer-typography("body1"); |
||||
} |
||||
|
||||
&__item { |
||||
display: flex; |
||||
flex-direction: row; |
||||
justify-content: space-between; |
||||
|
||||
dt { |
||||
color: explorer-color("slate", "100"); |
||||
min-width: explorer-size(3); |
||||
} |
||||
|
||||
dd { |
||||
color: explorer-color("slate", "100"); |
||||
text-overflow: ellipsis; |
||||
white-space: nowrap; |
||||
overflow: hidden; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@media (min-width: $explorer-breakpoint-lg) { |
||||
.block-detail { |
||||
&__attributes { |
||||
display: flex; |
||||
align-items: top; |
||||
justify-content: top; |
||||
} |
||||
|
||||
&__column { |
||||
width: explorer-size(1); |
||||
flex: 1; |
||||
margin-right: explorer-size(1); |
||||
& + & { margin-left: explorer-size(1); } |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,15 @@ |
||||
defmodule ExplorerWeb.BlockController do |
||||
use ExplorerWeb, :controller |
||||
import Ecto.Query |
||||
alias Explorer.Block |
||||
alias Explorer.Repo |
||||
alias Explorer.BlockForm |
||||
|
||||
def show(conn, params) do |
||||
block = Block |
||||
|> where(id: ^params["id"]) |
||||
|> first |> Repo.one |
||||
|> BlockForm.build |
||||
render(conn, "show.html", block: block) |
||||
end |
||||
end |
@ -0,0 +1,69 @@ |
||||
<section class="container__section"> |
||||
<div class="block-detail__container"> |
||||
<h2 class="block-detail__title"> |
||||
<%= gettext "Block #%{number} Details", number: @block.number %> |
||||
</h2> |
||||
<div class="block-detail__attributes"> |
||||
<div class="block-detail__column"> |
||||
<dl> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Number" %></dt> |
||||
<dd><%= @block.number %></dd> |
||||
</div> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Age" %></dt> |
||||
<dd><%= @block.age %></dd> |
||||
</div> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Timestamp" %></dt> |
||||
<dd><%= @block.formatted_timestamp %></dd> |
||||
</div> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Transactions" %></dt> |
||||
<dd><%= @block.transactions_count %></dd> |
||||
</div> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Hash" %></dt> |
||||
<dd><%= @block.hash %></dd> |
||||
</div> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Parent Hash" %></dt> |
||||
<dd><%= @block.parent_hash %></dd> |
||||
</div> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Miner" %></dt> |
||||
<dd><%= @block.miner %></dd> |
||||
</div> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Difficulty" %></dt> |
||||
<dd><%= @block.difficulty %></dd> |
||||
</div> |
||||
</dl> |
||||
</div> |
||||
<div class="block-detail__column"> |
||||
<dl> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Total Difficulty" %></dt> |
||||
<dd><%= @block.total_difficulty %></dd> |
||||
</div> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Size" %></dt> |
||||
<dd><%= @block.size %></dd> |
||||
</div> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Gas Used" %></dt> |
||||
<dd><%= @block.gas_used %></dd> |
||||
</div> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Gas Limit" %></dt> |
||||
<dd><%= @block.gas_limit %></dd> |
||||
</div> |
||||
<div class="block-detail__item"> |
||||
<dt><%= gettext "Nonce" %></dt> |
||||
<dd><%= @block.nonce %></dd> |
||||
</div> |
||||
</dl> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</section> |
@ -0,0 +1,4 @@ |
||||
defmodule ExplorerWeb.BlockView do |
||||
use ExplorerWeb, :view |
||||
@dialyzer :no_match |
||||
end |
@ -1,52 +1,86 @@ |
||||
#, elixir-format |
||||
#: lib/explorer_web/templates/block/show.html.eex:14 |
||||
#: lib/explorer_web/templates/page/index.html.eex:11 |
||||
#: lib/explorer_web/templates/page/index.html.eex:40 |
||||
#: lib/explorer_web/templates/page/index.html.eex:39 |
||||
msgid "Age" |
||||
msgstr "" |
||||
|
||||
#, elixir-format |
||||
#: lib/explorer_web/templates/page/index.html.eex:39 |
||||
#: lib/explorer_web/templates/page/index.html.eex:38 |
||||
msgid "Block" |
||||
msgstr "" |
||||
|
||||
#, elixir-format |
||||
#: lib/explorer_web/templates/page/index.html.eex:4 |
||||
msgid "Blocks" |
||||
msgstr "" |
||||
|
||||
#, elixir-format |
||||
#: lib/explorer_web/templates/layout/_footer.html.eex:2 |
||||
msgid "Copyright %{year} POA" |
||||
msgstr "" |
||||
|
||||
#, elixir-format |
||||
#: lib/explorer_web/templates/block/show.html.eex:54 |
||||
#: lib/explorer_web/templates/page/index.html.eex:13 |
||||
msgid "Gas Used" |
||||
msgstr "" |
||||
|
||||
#, elixir-format |
||||
#: lib/explorer_web/templates/page/index.html.eex:38 |
||||
#: lib/explorer_web/templates/block/show.html.eex:26 |
||||
#: lib/explorer_web/templates/page/index.html.eex:37 |
||||
msgid "Hash" |
||||
msgstr "" |
||||
|
||||
#, elixir-format |
||||
#: lib/explorer_web/templates/page/index.html.eex:10 |
||||
msgid "Height" |
||||
msgstr "" |
||||
|
||||
#, elixir-format |
||||
#: lib/explorer_web/templates/layout/_header.html.eex:4 |
||||
#: lib/explorer_web/templates/layout/_header.html.eex:6 |
||||
#: lib/explorer_web/templates/layout/app.html.eex:7 |
||||
msgid "POA Network Explorer" |
||||
msgstr "" |
||||
|
||||
#, elixir-format |
||||
#: lib/explorer_web/templates/block/show.html.eex:22 |
||||
#: lib/explorer_web/templates/page/index.html.eex:12 |
||||
#: lib/explorer_web/templates/page/index.html.eex:32 |
||||
#: lib/explorer_web/templates/page/index.html.eex:31 |
||||
msgid "Transactions" |
||||
msgstr "" |
||||
|
||||
#, elixir-format |
||||
#: lib/explorer_web/templates/page/index.html.eex:41 |
||||
#: lib/explorer_web/templates/page/index.html.eex:40 |
||||
msgid "Value" |
||||
msgstr "" |
||||
|
||||
#: lib/explorer_web/templates/block/show.html.eex:4 |
||||
msgid "Block #%{number} Details" |
||||
msgstr "" |
||||
|
||||
#: lib/explorer_web/templates/block/show.html.eex:38 |
||||
msgid "Difficulty" |
||||
msgstr "" |
||||
|
||||
#: lib/explorer_web/templates/block/show.html.eex:58 |
||||
msgid "Gas Limit" |
||||
msgstr "" |
||||
|
||||
#: lib/explorer_web/templates/block/show.html.eex:34 |
||||
msgid "Miner" |
||||
msgstr "" |
||||
|
||||
#: lib/explorer_web/templates/block/show.html.eex:62 |
||||
msgid "Nonce" |
||||
msgstr "" |
||||
|
||||
#: lib/explorer_web/templates/block/show.html.eex:10 |
||||
msgid "Number" |
||||
msgstr "" |
||||
|
||||
#: lib/explorer_web/templates/block/show.html.eex:30 |
||||
msgid "Parent Hash" |
||||
msgstr "" |
||||
|
||||
#: lib/explorer_web/templates/block/show.html.eex:50 |
||||
msgid "Size" |
||||
msgstr "" |
||||
|
||||
#: lib/explorer_web/templates/block/show.html.eex:18 |
||||
msgid "Timestamp" |
||||
msgstr "" |
||||
|
||||
#: lib/explorer_web/templates/block/show.html.eex:46 |
||||
msgid "Total Difficulty" |
||||
msgstr "" |
||||
|
@ -0,0 +1,11 @@ |
||||
defmodule ExplorerWeb.BlockControllerTest do |
||||
use ExplorerWeb.ConnCase |
||||
|
||||
describe "GET show/3" do |
||||
test "returns a block", %{conn: conn} do |
||||
insert(:block, id: 3) |
||||
conn = get(conn, "/en/blocks/3") |
||||
assert conn.assigns.block.id == 3 |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue