chore: privatize function and fix indentation

pull/1119/head
zachdaniel 6 years ago
parent 743f446e48
commit f82d40c866
  1. 8
      apps/block_scout_web/lib/block_scout_web/templates/transaction/_decoded_input.html.eex
  2. 8
      apps/block_scout_web/lib/block_scout_web/views/abi_encoded_value_view.ex

@ -7,10 +7,10 @@
<div class="alert alert-danger"> <div class="alert alert-danger">
<%= gettext "To see decoded input data, the contract must be verified." %> <%= gettext "To see decoded input data, the contract must be verified." %>
<%= case @transaction do %> <%= case @transaction do %>
<% %{to_address: %{hash: hash}} -> %> <% %{to_address: %{hash: hash}} -> %>
<%= gettext "Verify the contract " %><a href="<%= address_verify_contract_path(@conn, :new, hash)%>"><%= gettext "here" %></a> <%= gettext "Verify the contract " %><a href="<%= address_verify_contract_path(@conn, :new, hash)%>"><%= gettext "here" %></a>
<% _ -> %> <% _ -> %>
<%= nil %> <%= nil %>
<% end %> <% end %>
</div> </div>
<% {:ok, method_id, text, mapping} -> %> <% {:ok, method_id, text, mapping} -> %>

@ -95,21 +95,21 @@ defmodule BlockScoutWeb.ABIEncodedValueView do
[spacing, base_value_html(type, value)] [spacing, base_value_html(type, value)]
end end
def base_value_html(_, {:dynamic, value}) do defp base_value_html(_, {:dynamic, value}) do
hex(value) hex(value)
end end
def base_value_html(:address, value) do defp base_value_html(:address, value) do
address = hex(value) address = hex(value)
~E|<a href="<%= address_path(BlockScoutWeb.Endpoint, :show, address) %>" target="_blank"><%= address %></a>| ~E|<a href="<%= address_path(BlockScoutWeb.Endpoint, :show, address) %>" target="_blank"><%= address %></a>|
end end
def base_value_html(:bytes, value) do defp base_value_html(:bytes, value) do
hex(value) hex(value)
end end
def base_value_html(_, value), do: HTML.html_escape(value) defp base_value_html(_, value), do: HTML.html_escape(value)
defp hex(value), do: "0x" <> Base.encode16(value, case: :lower) defp hex(value), do: "0x" <> Base.encode16(value, case: :lower)
end end

Loading…
Cancel
Save