This works similar to copieble content. We place an icon next to hidden content and when it is clicked, we reveal the content. As an option, revealed content can be make copieble if copieble parameter is passed as true,
29 lines
1.2 KiB
Text
29 lines
1.2 KiB
Text
<div class="overflow-hidden rounded-lg shadow ring-1 ring-black ring-opacity-5 bg-white divide-y divide-gray-200">
|
|
<div class="px-4 py-5 sm:p-0">
|
|
<dl class="sm:divide-y sm:divide-gray-200">
|
|
<% data.reject { !_1 }.each do |name, value, opts| %>
|
|
<div class="py-4 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 sm:py-5">
|
|
<dt class="text-sm font-medium text-gray-500"><%= name %></dt>
|
|
<dd class="mt-1 text-sm text-gray-900 sm:col-span-2 sm:mt-0">
|
|
<% if opts && opts[:copieble] && value %>
|
|
<%== render(
|
|
"components/copieble_content",
|
|
locals: {
|
|
content: value,
|
|
message: "Copied #{name}",
|
|
revealable: opts[:revealable]
|
|
}
|
|
) %>
|
|
<% elsif opts && opts[:revealable] && value %>
|
|
<%== render("components/revealable_content", locals: { content: value }) %>
|
|
<% elsif opts && opts[:escape] == false %>
|
|
<%== value %>
|
|
<% else %>
|
|
<%= value.nil? ? "-" : value %>
|
|
<% end %>
|
|
</dd>
|
|
</div>
|
|
<% end %>
|
|
</dl>
|
|
</div>
|
|
</div>
|