From 46b796bb65a6a71f72a1270908dd4cfd3f95b3bf Mon Sep 17 00:00:00 2001 From: CJ Bryan and Matt Olenick Date: Fri, 19 Jan 2018 13:53:20 -0800 Subject: [PATCH] Style and internationalize the blocks table. --- assets/css/components/_blocks.scss | 10 ++++---- .../templates/page/index.html.eex | 25 +++++++++++++------ lib/mix/tasks/scrape.ex | 8 +++--- priv/gettext/default.pot | 14 ++++++++++- priv/gettext/en/LC_MESSAGES/default.po | 14 ++++++++++- .../features/contributor_browsing_test.exs | 4 +-- test/mix/tasks/scrape_test.exs | 2 +- 7 files changed, 56 insertions(+), 21 deletions(-) diff --git a/assets/css/components/_blocks.scss b/assets/css/components/_blocks.scss index a5c54f39ee..3d891d34b4 100644 --- a/assets/css/components/_blocks.scss +++ b/assets/css/components/_blocks.scss @@ -1,9 +1,9 @@ .blocks { - @extend .table; - - text-align: left; + &__title { + @extend h2; + } - td { - padding-right: 4em; + &__table { + @extend .table; } } diff --git a/lib/explorer_web/templates/page/index.html.eex b/lib/explorer_web/templates/page/index.html.eex index 841ade49a6..0a580647a0 100644 --- a/lib/explorer_web/templates/page/index.html.eex +++ b/lib/explorer_web/templates/page/index.html.eex @@ -2,11 +2,22 @@
<%= gettext "blocks-title" %>
- <%= for block <- @blocks do %> -
-
<%= block.number %>
-
<%= block.gas_used %>
-
<%= block.timestamp |> Timex.from_now %>
-
- <% end %> + + + + + + + + + + <%= for block <- @blocks do %> + + + + + + <% end %> + +
<%= gettext "Height" %><%= gettext "Age" %><%= gettext "Gas Used" %>
<%= block.number %><%= block.timestamp |> Timex.from_now %><%= block.gas_used %>
diff --git a/lib/mix/tasks/scrape.ex b/lib/mix/tasks/scrape.ex index 5c004744f6..95623003bc 100644 --- a/lib/mix/tasks/scrape.ex +++ b/lib/mix/tasks/scrape.ex @@ -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 diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 4435e3c40d..8aa761e63c 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -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 "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index 4ba53d4518..f17c7abf9b 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -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" diff --git a/test/explorer_web/features/contributor_browsing_test.exs b/test/explorer_web/features/contributor_browsing_test.exs index 74300e290d..5d8de94899 100644 --- a/test/explorer_web/features/contributor_browsing_test.exs +++ b/test/explorer_web/features/contributor_browsing_test.exs @@ -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 diff --git a/test/mix/tasks/scrape_test.exs b/test/mix/tasks/scrape_test.exs index 11c58f54ce..2d519f2a4e 100644 --- a/test/mix/tasks/scrape_test.exs +++ b/test/mix/tasks/scrape_test.exs @@ -12,6 +12,6 @@ defmodule Scrape.Test do |> Repo.all |> List.first - assert(last_block.height) + assert(last_block.number) end end