From 082d921510fa24439a8091ed8478e51b943ffb86 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 26 May 2020 22:26:58 +0300 Subject: [PATCH] Token image from image as an object --- .../views/tokens/instance/overview_view.ex | 10 +++++++++- apps/block_scout_web/priv/gettext/default.pot | 4 ++-- .../priv/gettext/en/LC_MESSAGES/default.po | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex b/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex index 02937fec9f..ab0058f4a8 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/tokens/instance/overview_view.ex @@ -26,7 +26,7 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do instance.metadata["image_url"] instance.metadata && instance.metadata["image"] -> - instance.metadata["image"] + retrieve_image(instance.metadata["image"]) instance.metadata && instance.metadata["properties"]["image"]["description"] -> instance.metadata["properties"]["image"]["description"] @@ -87,6 +87,14 @@ defmodule BlockScoutWeb.Tokens.Instance.OverviewView do |> tab_name() end + defp retrieve_image(image) when is_map(image) do + image["description"] + end + + defp retrieve_image(image) do + image + end + defp tab_name(["token_transfers"]), do: gettext("Token Transfers") defp tab_name(["metadata"]), do: gettext("Metadata") end diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index 6aa0491090..b4edc9e73c 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -904,7 +904,7 @@ msgstr "" #: 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/views/address_view.ex:325 -#: lib/block_scout_web/views/tokens/instance/overview_view.ex:90 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:98 #: lib/block_scout_web/views/tokens/overview_view.ex:35 #: lib/block_scout_web/views/transaction_view.ex:390 msgid "Token Transfers" @@ -1779,7 +1779,7 @@ msgstr "" #, elixir-format #: 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/views/tokens/instance/overview_view.ex:91 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:99 msgid "Metadata" 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 6aa0491090..b4edc9e73c 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 @@ -904,7 +904,7 @@ msgstr "" #: 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/views/address_view.ex:325 -#: lib/block_scout_web/views/tokens/instance/overview_view.ex:90 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:98 #: lib/block_scout_web/views/tokens/overview_view.ex:35 #: lib/block_scout_web/views/transaction_view.ex:390 msgid "Token Transfers" @@ -1779,7 +1779,7 @@ msgstr "" #, elixir-format #: 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/views/tokens/instance/overview_view.ex:91 +#: lib/block_scout_web/views/tokens/instance/overview_view.ex:99 msgid "Metadata" msgstr ""