Style and internationalize the blocks table.

pull/2/head
CJ Bryan and Matt Olenick 7 years ago
parent 0da5f67763
commit 46b796bb65
  1. 10
      assets/css/components/_blocks.scss
  2. 25
      lib/explorer_web/templates/page/index.html.eex
  3. 8
      lib/mix/tasks/scrape.ex
  4. 14
      priv/gettext/default.pot
  5. 14
      priv/gettext/en/LC_MESSAGES/default.po
  6. 4
      test/explorer_web/features/contributor_browsing_test.exs
  7. 2
      test/mix/tasks/scrape_test.exs

@ -1,9 +1,9 @@
.blocks { .blocks {
@extend .table; &__title {
@extend h2;
text-align: left; }
td { &__table {
padding-right: 4em; @extend .table;
} }
} }

@ -2,11 +2,22 @@
<div class="blocks"> <div class="blocks">
<div class="blocks__title"><%= gettext "blocks-title" %></div> <div class="blocks__title"><%= gettext "blocks-title" %></div>
<%= for block <- @blocks do %> <table class="blocks__table">
<div class="blocks__row"> <thead class="blocks__header">
<div class="blocks__column--number"><%= block.number %></div> <tr>
<div class="blocks__column--gas-used"><%= block.gas_used %></div> <th><%= gettext "Height" %></th>
<div class="blocks__column--validated-at"><%= block.timestamp |> Timex.from_now %></div> <th><%= gettext "Age" %></th>
</div> <th><%= gettext "Gas Used" %></th>
<% end %> </tr>
</thead>
<tbody>
<%= for block <- @blocks do %>
<tr class="blocks__row">
<td class="blocks__column--height"><%= block.number %></td>
<td class="blocks__column--age"><%= block.timestamp |> Timex.from_now %></td>
<td class="blocks__column--gas-used"><%= block.gas_used %></td>
</tr>
<% end %>
</tbody>
</table>
</div> </div>

@ -31,10 +31,10 @@ defmodule Mix.Tasks.Scrape do
parent_hash: "0x0", parent_hash: "0x0",
nonce: "0", nonce: "0",
miner: "0x0", miner: "0x0",
difficulty: "0", difficulty: 0,
total_difficulty: "0", total_difficulty: 0,
size: "0", size: 0,
gas_limit: "0", gas_limit: 0,
} }
end end

@ -19,6 +19,18 @@ msgstr ""
msgid "explorer-welcome" msgid "explorer-welcome"
msgstr "" msgstr ""
#: lib/explorer_web/templates/page/index.html.eex:2 #: lib/explorer_web/templates/page/index.html.eex:4
msgid "blocks-title" msgid "blocks-title"
msgstr "" msgstr ""
#: lib/explorer_web/templates/page/index.html.eex:9
msgid "Gas Used"
msgstr ""
#: lib/explorer_web/templates/page/index.html.eex:8
msgid "Height"
msgstr ""
#: lib/explorer_web/templates/page/index.html.eex:10
msgid "Validated"
msgstr ""

@ -19,6 +19,18 @@ msgstr "POA Network Explorer"
msgid "explorer-welcome" msgid "explorer-welcome"
msgstr "Welcome to our blockchain explorer." msgstr "Welcome to our blockchain explorer."
#: lib/explorer_web/templates/page/index.html.eex:2 #: lib/explorer_web/templates/page/index.html.eex:4
msgid "blocks-title" msgid "blocks-title"
msgstr "Blocks" msgstr "Blocks"
#: lib/explorer_web/templates/page/index.html.eex:9
msgid "Gas Used"
msgstr "Gas Used"
#: lib/explorer_web/templates/page/index.html.eex:8
msgid "Height"
msgstr "Height"
#: lib/explorer_web/templates/page/index.html.eex:10
msgid "Age"
msgstr "Age"

@ -21,8 +21,8 @@ defmodule ExplorerWeb.UserListTest do
session session
|> visit("/en") |> visit("/en")
|> assert_has(css(".blocks__title", text: "Blocks")) |> assert_has(css(".blocks__title", text: "Blocks"))
|> assert_has(css(".blocks__column--number", count: 5, text: "4")) |> assert_has(css(".blocks__column--height", count: 5, text: "4"))
|> assert_has(css(".blocks__column--validated-at", count: 5, text: "1 hour ago")) |> assert_has(css(".blocks__column--age", count: 5, text: "1 hour ago"))
|> assert_has(css(".blocks__column--gas-used", count: 5, text: "10")) |> assert_has(css(".blocks__column--gas-used", count: 5, text: "10"))
end end
end end

@ -12,6 +12,6 @@ defmodule Scrape.Test do
|> Repo.all |> Repo.all
|> List.first |> List.first
assert(last_block.height) assert(last_block.number)
end end
end end

Loading…
Cancel
Save