Merge branch 'master' into ab-erc721-token-balances-fix

pull/1540/head
Victor Baranov 6 years ago committed by GitHub
commit cc66058098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      apps/block_scout_web/config/config.exs
  2. 3
      apps/block_scout_web/lib/block_scout_web/templates/layout/_footer.html.eex
  3. 10
      apps/block_scout_web/lib/block_scout_web/views/layout_view.ex
  4. 2
      apps/block_scout_web/priv/gettext/default.pot
  5. 4
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po
  6. 26
      apps/block_scout_web/test/block_scout_web/views/layout_view_test.exs

@ -9,7 +9,8 @@ use Mix.Config
config :block_scout_web,
namespace: BlockScoutWeb,
ecto_repos: [Explorer.Repo],
version: System.get_env("BLOCKSCOUT_VERSION")
version: System.get_env("BLOCKSCOUT_VERSION"),
release_link: System.get_env("RELEASE_LINK")
config :block_scout_web, BlockScoutWeb.Chain,
network: System.get_env("NETWORK"),

@ -90,8 +90,9 @@
<% version = version() %>
<%= unless ignore_version?(version) do %>
<% release_link = release_link(version) %>
<div>
<%= gettext("Version") %>: <%= version %>
<%= gettext("Version") %>: <%= release_link %>
</div>
<% end %>
</div>

@ -76,6 +76,16 @@ defmodule BlockScoutWeb.LayoutView do
BlockScoutWeb.version()
end
def release_link(version) do
release_link = Application.get_env(:block_scout_web, :release_link)
if release_link == "" || release_link == nil do
version
else
html_escape({:safe, "<a href=\"#{release_link}\" target=\"_blank\">#{version}</a>"})
end
end
def ignore_version?("unknown"), do: true
def ignore_version?(_), do: false

@ -1557,7 +1557,7 @@ msgid "Test Networks"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_footer.html.eex:94
#: lib/block_scout_web/templates/layout/_footer.html.eex:95
msgid "Version"
msgstr ""

@ -1557,7 +1557,7 @@ msgid "Test Networks"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_footer.html.eex:94
#: lib/block_scout_web/templates/layout/_footer.html.eex:95
msgid "Version"
msgstr ""
@ -1682,7 +1682,7 @@ msgstr ""
msgid "Run"
msgstr ""
#, elixir-format, fuzzy
#, elixir-format
#: lib/block_scout_web/templates/address_contract_verification/new.html.eex:31
msgid "EVM Vesion"
msgstr ""

@ -60,4 +60,30 @@ defmodule BlockScoutWeb.LayoutViewTest do
assert LayoutView.network_title() == "POA"
end
end
describe "release_link/1" do
test "use the version when there is no release_link env configured for it" do
Application.put_env(:block_scout_web, :release_link, nil)
assert LayoutView.release_link("1.3.4") == "1.3.4"
end
test "use the version when empty release_link env configured for it" do
Application.put_env(:block_scout_web, :release_link, "")
assert LayoutView.release_link("1.3.4") == "1.3.4"
end
test "use the enviroment release link when it's configured" do
Application.put_env(
:block_scout_web,
:release_link,
"https://github.com/poanetwork/blockscout/releases/tag/v1.3.4-beta"
)
assert LayoutView.release_link("1.3.4") ==
{:safe,
~s(<a href="https://github.com/poanetwork/blockscout/releases/tag/v1.3.4-beta" target="_blank">1.3.4</a>)}
end
end
end

Loading…
Cancel
Save