From 0c61d26c6a2ebda7cb1f2a7b1cfc543ed1ca2afa Mon Sep 17 00:00:00 2001 From: saneery Date: Tue, 23 Apr 2019 14:13:22 +0300 Subject: [PATCH] add block count to chain show view --- .../controllers/chain_controller.ex | 4 ++- .../templates/chain/show.html.eex | 8 ++++++ apps/block_scout_web/priv/gettext/default.pot | 25 +++++++++++-------- .../priv/gettext/en/LC_MESSAGES/default.po | 25 +++++++++++-------- 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex index e84b0a3438..e49e499250 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/chain_controller.ex @@ -11,6 +11,7 @@ defmodule BlockScoutWeb.ChainController do def show(conn, _params) do transaction_estimated_count = Chain.transaction_estimated_count() + block_count = Chain.block_count() exchange_rate = Market.get_exchange_rate(Explorer.coin()) || Token.null() @@ -22,7 +23,8 @@ defmodule BlockScoutWeb.ChainController do exchange_rate: exchange_rate, chart_data_path: market_history_chart_path(conn, :show), transaction_estimated_count: transaction_estimated_count, - transactions_path: recent_transactions_path(conn, :index) + transactions_path: recent_transactions_path(conn, :index), + block_count: block_count ) end diff --git a/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex index aa1621622a..dacbcb477b 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/chain/show.html.eex @@ -53,6 +53,14 @@ <%= Cldr.Number.to_string!(@transaction_estimated_count, format: "#,###") %> +
+ + <%= gettext "Total blocks" %> + + + <%= Cldr.Number.to_string!(@block_count, format: "#,###") %> + +
<%= gettext "Wallet addresses" %> diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index c4d03d82ec..395792d02a 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -175,7 +175,7 @@ msgid "BlockScout provides analytics data, API, and Smart Contract tools for the msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:72 +#: lib/block_scout_web/templates/chain/show.html.eex:80 #: lib/block_scout_web/templates/layout/_topnav.html.eex:16 #: lib/block_scout_web/templates/layout/_topnav.html.eex:20 msgid "Blocks" @@ -560,7 +560,7 @@ msgid "More internal transactions have come in" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:96 +#: lib/block_scout_web/templates/chain/show.html.eex:104 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:14 #: lib/block_scout_web/templates/transaction/index.html.eex:14 msgid "More transactions have come in" @@ -957,7 +957,7 @@ msgstr "" #: lib/block_scout_web/templates/block_transaction/index.html.eex:23 #: lib/block_scout_web/templates/block_transaction/index.html.eex:26 #: lib/block_scout_web/templates/block_transaction/index.html.eex:35 -#: lib/block_scout_web/templates/chain/show.html.eex:93 +#: lib/block_scout_web/templates/chain/show.html.eex:101 #: lib/block_scout_web/templates/layout/_topnav.html.eex:35 #: lib/block_scout_web/views/address_view.ex:294 msgid "Transactions" @@ -1031,12 +1031,12 @@ msgid "Verify & publish" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:71 +#: lib/block_scout_web/templates/chain/show.html.eex:79 msgid "View All Blocks →" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:92 +#: lib/block_scout_web/templates/chain/show.html.eex:100 msgid "View All Transactions →" msgstr "" @@ -1076,7 +1076,7 @@ msgid "WEI" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:58 +#: lib/block_scout_web/templates/chain/show.html.eex:66 msgid "Wallet addresses" msgstr "" @@ -1160,8 +1160,8 @@ msgstr "" #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19 #: lib/block_scout_web/templates/address_validation/index.html.eex:63 #: lib/block_scout_web/templates/address_validation/index.html.eex:82 -#: lib/block_scout_web/templates/chain/show.html.eex:84 -#: lib/block_scout_web/templates/chain/show.html.eex:110 +#: lib/block_scout_web/templates/chain/show.html.eex:92 +#: lib/block_scout_web/templates/chain/show.html.eex:118 #: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:24 msgid "Loading..." msgstr "" @@ -1371,7 +1371,7 @@ msgstr "" #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:26 #: lib/block_scout_web/templates/address_transaction/index.html.eex:55 #: lib/block_scout_web/templates/address_validation/index.html.eex:70 -#: lib/block_scout_web/templates/chain/show.html.eex:76 +#: lib/block_scout_web/templates/chain/show.html.eex:84 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:23 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:22 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:20 @@ -1514,7 +1514,7 @@ msgid "Emission Contract" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:102 +#: lib/block_scout_web/templates/chain/show.html.eex:110 msgid "Something went wrong, click to retry." msgstr "" @@ -1744,3 +1744,8 @@ msgstr "" #: lib/block_scout_web/templates/transaction/overview.html.eex:165 msgid "ERC-721" msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/chain/show.html.eex:58 +msgid "Total blocks" +msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index 26503607c4..b894c828fd 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -175,7 +175,7 @@ msgid "BlockScout provides analytics data, API, and Smart Contract tools for the msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:72 +#: lib/block_scout_web/templates/chain/show.html.eex:80 #: lib/block_scout_web/templates/layout/_topnav.html.eex:16 #: lib/block_scout_web/templates/layout/_topnav.html.eex:20 msgid "Blocks" @@ -560,7 +560,7 @@ msgid "More internal transactions have come in" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:96 +#: lib/block_scout_web/templates/chain/show.html.eex:104 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:14 #: lib/block_scout_web/templates/transaction/index.html.eex:14 msgid "More transactions have come in" @@ -957,7 +957,7 @@ msgstr "" #: lib/block_scout_web/templates/block_transaction/index.html.eex:23 #: lib/block_scout_web/templates/block_transaction/index.html.eex:26 #: lib/block_scout_web/templates/block_transaction/index.html.eex:35 -#: lib/block_scout_web/templates/chain/show.html.eex:93 +#: lib/block_scout_web/templates/chain/show.html.eex:101 #: lib/block_scout_web/templates/layout/_topnav.html.eex:35 #: lib/block_scout_web/views/address_view.ex:294 msgid "Transactions" @@ -1031,12 +1031,12 @@ msgid "Verify & publish" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:71 +#: lib/block_scout_web/templates/chain/show.html.eex:79 msgid "View All Blocks →" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:92 +#: lib/block_scout_web/templates/chain/show.html.eex:100 msgid "View All Transactions →" msgstr "" @@ -1076,7 +1076,7 @@ msgid "WEI" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:58 +#: lib/block_scout_web/templates/chain/show.html.eex:66 msgid "Wallet addresses" msgstr "" @@ -1160,8 +1160,8 @@ msgstr "" #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19 #: lib/block_scout_web/templates/address_validation/index.html.eex:63 #: lib/block_scout_web/templates/address_validation/index.html.eex:82 -#: lib/block_scout_web/templates/chain/show.html.eex:84 -#: lib/block_scout_web/templates/chain/show.html.eex:110 +#: lib/block_scout_web/templates/chain/show.html.eex:92 +#: lib/block_scout_web/templates/chain/show.html.eex:118 #: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:24 msgid "Loading..." msgstr "" @@ -1371,7 +1371,7 @@ msgstr "" #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:26 #: lib/block_scout_web/templates/address_transaction/index.html.eex:55 #: lib/block_scout_web/templates/address_validation/index.html.eex:70 -#: lib/block_scout_web/templates/chain/show.html.eex:76 +#: lib/block_scout_web/templates/chain/show.html.eex:84 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:23 #: lib/block_scout_web/templates/tokens/holder/index.html.eex:22 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:20 @@ -1514,7 +1514,7 @@ msgid "Emission Contract" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/chain/show.html.eex:102 +#: lib/block_scout_web/templates/chain/show.html.eex:110 msgid "Something went wrong, click to retry." msgstr "" @@ -1744,3 +1744,8 @@ msgstr "" #: lib/block_scout_web/templates/transaction/overview.html.eex:165 msgid "ERC-721" msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/chain/show.html.eex:58 +msgid "Total blocks" +msgstr ""