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 {
@extend .table;
text-align: left;
&__title {
@extend h2;
}
td {
padding-right: 4em;
&__table {
@extend .table;
}
}

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

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

@ -19,6 +19,18 @@ msgstr ""
msgid "explorer-welcome"
msgstr ""
#: lib/explorer_web/templates/page/index.html.eex:2
#: lib/explorer_web/templates/page/index.html.eex:4
msgid "blocks-title"
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"
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"
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
|> visit("/en")
|> assert_has(css(".blocks__title", text: "Blocks"))
|> assert_has(css(".blocks__column--number", count: 5, text: "4"))
|> assert_has(css(".blocks__column--validated-at", count: 5, text: "1 hour ago"))
|> assert_has(css(".blocks__column--height", count: 5, text: "4"))
|> assert_has(css(".blocks__column--age", count: 5, text: "1 hour ago"))
|> assert_has(css(".blocks__column--gas-used", count: 5, text: "10"))
end
end

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

Loading…
Cancel
Save