Apps embedded links

pull/6397/head
Viktor Baranov 2 years ago
parent f9dd208b15
commit 590ce86c71
  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>
<div class="dropdown-menu" aria-labeledby="navbarAppsDropdown">
<%= if apps_menu == true do %>
<%= for %{url: url, title: title} <- external_apps_list() do %>
<a href="<%= url %>" class="dropdown-item" target="_blank"><%= title %>
<span class="external-link-icon">
<%= render BlockScoutWeb.IconsView, "_external_link.html" %>
</span>
</a>
<%= for %{url: url, title: title} = app <- apps_list() do %>
<%= if Map.has_key?(app, :embedded?) && app.embedded? do %>
<a href="<%= url %>" class="dropdown-item" target="_self"><%= title %></a>
<% else %>
<a href="<%= url %>" class="dropdown-item" target="_blank"><%= title %>
<span class="external-link-icon">
<%= render BlockScoutWeb.IconsView, "_external_link.html" %>
</span>
</a>
<% end %>
<% end %>
<% end %>
</div>

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

@ -87,7 +87,7 @@ config :block_scout_web,
webapp_url: System.get_env("WEBAPP_URL"),
api_url: System.get_env("API_URL"),
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),
restricted_list: System.get_env("RESTRICTED_LIST", nil),
restricted_list_key: System.get_env("RESTRICTED_LIST_KEY", nil),

Loading…
Cancel
Save