Merge pull request #6397 from blockscout/vb-apps-internal-link

Apps embedded links
pull/6407/head
Victor Baranov 2 years ago committed by GitHub
commit 36be1681d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      apps/block_scout_web/lib/block_scout_web/templates/layout/_topnav.html.eex
  2. 9
      apps/block_scout_web/lib/block_scout_web/views/layout_view.ex
  3. 2
      config/runtime.exs

@ -132,12 +132,16 @@
</a> </a>
<div class="dropdown-menu" aria-labeledby="navbarAppsDropdown"> <div class="dropdown-menu" aria-labeledby="navbarAppsDropdown">
<%= if apps_menu == true do %> <%= if apps_menu == true do %>
<%= for %{url: url, title: title} <- external_apps_list() do %> <%= for %{url: url, title: title} = app <- apps_list() do %>
<a href="<%= url %>" class="dropdown-item" target="_blank"><%= title %> <%= if Map.has_key?(app, :embedded?) && app.embedded? do %>
<span class="external-link-icon"> <a href="<%= url %>" class="dropdown-item" target="_self"><%= title %></a>
<%= render BlockScoutWeb.IconsView, "_external_link.html" %> <% else %>
</span> <a href="<%= url %>" class="dropdown-item" target="_blank"><%= title %>
</a> <span class="external-link-icon">
<%= render BlockScoutWeb.IconsView, "_external_link.html" %>
</span>
</a>
<% end %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

@ -229,11 +229,12 @@ defmodule BlockScoutWeb.LayoutView do
end end
end end
def external_apps_list do def apps_list do
if Application.get_env(:block_scout_web, :external_apps) do apps = Application.get_env(:block_scout_web, :apps)
if apps do
try do try do
:block_scout_web apps
|> Application.get_env(:external_apps)
|> Parser.parse!(%{keys: :atoms!}) |> Parser.parse!(%{keys: :atoms!})
rescue rescue
_ -> _ ->

@ -87,7 +87,7 @@ config :block_scout_web,
webapp_url: System.get_env("WEBAPP_URL"), webapp_url: System.get_env("WEBAPP_URL"),
api_url: System.get_env("API_URL"), api_url: System.get_env("API_URL"),
apps_menu: if(System.get_env("APPS_MENU", "false") == "true", do: true, else: false), apps_menu: if(System.get_env("APPS_MENU", "false") == "true", do: true, else: false),
external_apps: System.get_env("EXTERNAL_APPS"), apps: System.get_env("APPS") || System.get_env("EXTERNAL_APPS"),
gas_price: System.get_env("GAS_PRICE", nil), gas_price: System.get_env("GAS_PRICE", nil),
restricted_list: System.get_env("RESTRICTED_LIST", nil), restricted_list: System.get_env("RESTRICTED_LIST", nil),
restricted_list_key: System.get_env("RESTRICTED_LIST_KEY", nil), restricted_list_key: System.get_env("RESTRICTED_LIST_KEY", nil),

Loading…
Cancel
Save