noesya/osuny

View on GitHub
app/views/admin/application/_dependencies.html.erb

Summary

Maintainability
Test Coverage
<%
about ||= nil
expanded ||= false
dependencies ||= about&.dependencies
active_storage_blobs ||= about.respond_to?(:active_storage_blobs) ? about&.active_storage_blobs : []
%>
<% if current_user.server_admin? %>
<i  class="<%= Icon::SETTINGS %>"
    style="opacity: 0.1"
    data-bs-toggle="collapse"
    data-bs-target="#dependencies"
    aria-expanded="<%= expanded %>"
    aria-controls="dependencies"></i>
<div id="dependencies" class="collapse">
  <%= osuny_panel 'Dependencies', subtitle: 'Only for server admins' do %>
    <h2 class="h5">dependencies</h2>
    <div class="table-responsive">
      <table class="<%= table_classes %>">
          <thead>
              <tr>
                  <th>Name</th>
                  <th>Class</th>
              </tr>
          </thead>
          <tbody>
              <% dependencies.each do |dependency| %>
                  <tr>
                      <td><%= dependency.to_s %></td>
                      <td><%= dependency.class %></td>
                  </tr>
              <% end %>
          </tbody>
      </table>
    </div>

    <h2 class="h5 mt-5">active_storage_blobs</h2>
    <div class="table-responsive">
      <table class="<%= table_classes %>">
          <thead>
              <tr>
                  <th>Id</th>
                  <th>Filename</th>
              </tr>
          </thead>
          <tbody>
              <% active_storage_blobs.each do |blob| %>
                  <tr>
                      <td><%= blob.id %></td>
                      <td><%= blob.filename %></td>
                  </tr>
              <% end %>
          </tbody>
      </table>
    </div>
  <% end %>
</div>
<% end %>