NFT instance: external link to the NFT in the app

pull/3279/head
Victor Baranov 4 years ago
parent 3685e95cc0
commit c305290e81
  1. 1
      CHANGELOG.md
  2. 7
      apps/block_scout_web/lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex
  3. 13
      apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex
  4. 14
      apps/block_scout_web/priv/gettext/default.pot
  5. 14
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po

@ -1,6 +1,7 @@
## Current ## Current
### Features ### Features
- [#3279](https://github.com/poanetwork/blockscout/pull/3279) - NFT instance: link to the app
- [#3273](https://github.com/poanetwork/blockscout/pull/3273) - Update token metadata at burn/mint events - [#3273](https://github.com/poanetwork/blockscout/pull/3273) - Update token metadata at burn/mint events
- [#3268](https://github.com/poanetwork/blockscout/pull/3268) - Token total supply on-demand fetcher - [#3268](https://github.com/poanetwork/blockscout/pull/3268) - Token total supply on-demand fetcher
- [#3261](https://github.com/poanetwork/blockscout/pull/3261) - Bridged tokens table - [#3261](https://github.com/poanetwork/blockscout/pull/3261) - Bridged tokens table

@ -63,6 +63,13 @@
<div class="d-flex flex-column flex-md-row justify-content-start text-muted"> <div class="d-flex flex-column flex-md-row justify-content-start text-muted">
<div class="d-flex flex-row justify-content-start text-muted"> <div class="d-flex flex-row justify-content-start text-muted">
<%= if external_url(@token_instance.instance) do %>
<span class="mr-4">
<a data-test="external_url" href=<%=external_url(@token_instance.instance) %> target="_blank">
View In App <span class="external-token-icon"><%= render BlockScoutWeb.IconsView, "_external_link.html" %></span>
</a>
</span>
<% end %>
<span class="mr-4"> <%= @token.type %> </span> <span class="mr-4"> <%= @token.type %> </span>
<span class="mr-4"><%= @total_token_transfers %> <%= gettext "Transfers" %></span> <span class="mr-4"><%= @total_token_transfers %> <%= gettext "Transfers" %></span>
<%= if decimals?(@token) do %> <%= if decimals?(@token) do %>

@ -38,6 +38,19 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do
if String.trim(result) == "", do: image_src(nil), else: result if String.trim(result) == "", do: image_src(nil), else: result
end end
def external_url(nil), do: nil
def external_url(instance) do
result =
if instance.metadata && instance.metadata["external_url"] do
instance.metadata["external_url"]
else
external_url(nil)
end
if String.trim(result) == "", do: external_url(nil), else: result
end
def total_supply_usd(token) do def total_supply_usd(token) do
tokens = CurrencyHelpers.divide_decimals(token.total_supply, token.decimals) tokens = CurrencyHelpers.divide_decimals(token.total_supply, token.decimals)
price = token.usd_value price = token.usd_value

@ -901,7 +901,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7
#: lib/block_scout_web/views/address_view.ex:346 #: lib/block_scout_web/views/address_view.ex:346
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:98 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:113
#: lib/block_scout_web/views/tokens/overview_view.ex:37 #: lib/block_scout_web/views/tokens/overview_view.ex:37
#: lib/block_scout_web/views/transaction_view.ex:394 #: lib/block_scout_web/views/transaction_view.ex:394
msgid "Token Transfers" msgid "Token Transfers"
@ -1175,7 +1175,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/overview.html.eex:33 #: lib/block_scout_web/templates/address/overview.html.eex:33
#: lib/block_scout_web/templates/address/overview.html.eex:133 #: lib/block_scout_web/templates/address/overview.html.eex:133
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:51 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:51
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:94 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:101
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:116 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:116
msgid "QR Code" msgid "QR Code"
@ -1716,8 +1716,8 @@ msgstr ""
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37
#: lib/block_scout_web/templates/address/overview.html.eex:134 #: lib/block_scout_web/templates/address/overview.html.eex:134
#: lib/block_scout_web/templates/address/overview.html.eex:142 #: lib/block_scout_web/templates/address/overview.html.eex:142
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:95 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:102
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:103 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:110
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:117 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:117
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:125 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:125
msgid "Close" msgid "Close"
@ -1735,7 +1735,7 @@ msgid "Copy Token ID"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:69 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:76
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:74 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:74
msgid "Decimals" msgid "Decimals"
msgstr "" msgstr ""
@ -1768,7 +1768,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18 #: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18
#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:99 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:114
msgid "Metadata" msgid "Metadata"
msgstr "" msgstr ""
@ -1783,7 +1783,7 @@ msgid "Total transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:67 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:74
msgid "Transfers" msgid "Transfers"
msgstr "" msgstr ""

@ -901,7 +901,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:4 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7 #: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:7
#: lib/block_scout_web/views/address_view.ex:346 #: lib/block_scout_web/views/address_view.ex:346
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:98 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:113
#: lib/block_scout_web/views/tokens/overview_view.ex:37 #: lib/block_scout_web/views/tokens/overview_view.ex:37
#: lib/block_scout_web/views/transaction_view.ex:394 #: lib/block_scout_web/views/transaction_view.ex:394
msgid "Token Transfers" msgid "Token Transfers"
@ -1175,7 +1175,7 @@ msgstr ""
#: lib/block_scout_web/templates/address/overview.html.eex:33 #: lib/block_scout_web/templates/address/overview.html.eex:33
#: lib/block_scout_web/templates/address/overview.html.eex:133 #: lib/block_scout_web/templates/address/overview.html.eex:133
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:51 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:51
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:94 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:101
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:36
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:116 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:116
msgid "QR Code" msgid "QR Code"
@ -1716,8 +1716,8 @@ msgstr ""
#: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37 #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:37
#: lib/block_scout_web/templates/address/overview.html.eex:134 #: lib/block_scout_web/templates/address/overview.html.eex:134
#: lib/block_scout_web/templates/address/overview.html.eex:142 #: lib/block_scout_web/templates/address/overview.html.eex:142
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:95 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:102
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:103 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:110
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:117 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:117
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:125 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:125
msgid "Close" msgid "Close"
@ -1735,7 +1735,7 @@ msgid "Copy Token ID"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:69 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:76
#: lib/block_scout_web/templates/tokens/overview/_details.html.eex:74 #: lib/block_scout_web/templates/tokens/overview/_details.html.eex:74
msgid "Decimals" msgid "Decimals"
msgstr "" msgstr ""
@ -1768,7 +1768,7 @@ msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18 #: lib/block_scout_web/templates/tokens/instance/metadata/index.html.eex:18
#: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10 #: lib/block_scout_web/templates/tokens/instance/overview/_tabs.html.eex:10
#: lib/block_scout_web/views/tokens/instance/overview_view.ex:99 #: lib/block_scout_web/views/tokens/instance/overview_view.ex:114
msgid "Metadata" msgid "Metadata"
msgstr "" msgstr ""
@ -1783,7 +1783,7 @@ msgid "Total transactions"
msgstr "" msgstr ""
#, elixir-format #, elixir-format
#: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:67 #: lib/block_scout_web/templates/tokens/instance/overview/_details.html.eex:74
msgid "Transfers" msgid "Transfers"
msgstr "" msgstr ""

Loading…
Cancel
Save