AlchemyCMS/alchemy_cms

View on GitHub
app/views/alchemy/admin/resources/_resource.html.erb

Summary

Maintainability
Test Coverage
<tr class="<%= cycle('even', 'odd') %>">
  <% if local_assigns[:icon] %>
    <td class="icon"><%= render_icon(local_assigns[:icon], size: "xl") %></td>
  <% end %>
<% resource_handler.sorted_attributes.each do |attribute| %>
  <td class="<%= attribute[:type] %> <%= attribute[:name] %>">
  <% if attribute[:type] == :boolean %>
    <%= resource.public_send(attribute[:name]) ? render_icon(:check) : nil %>
  <% else %>
    <%= render_attribute(resource, attribute) %>
  <% end %>
  </td>
<% end %>
  <td class="tools">
  <% if can?(:destroy, resource) %>
    <sl-tooltip content="<%= Alchemy.t("Delete") %>">
      <%= delete_button resource_path(resource, search_filter_params) %>
    </sl-tooltip>
  <% end %>
  <% if can?(:edit, resource) %>
    <sl-tooltip content="<%= Alchemy.t("Edit") %>">
      <%= link_to_dialog render_icon(:edit),
        edit_resource_path(resource, search_filter_params),
        {
          title: Alchemy.t('Edit'),
          size: resource_window_size
        },
        class: "icon_button" %>
      <% end %>
    </sl-tooltip>
  </td>
</tr>