<% if objects.length > 0 %>
<section class="searchResult">
<header><%=h t("search.search_result.title_#{model}") %></header>
<table class="list">
  <tr class="stickyInline">
    <% attributes.each do |attribute| %>
    <th><%= t("activeldap.attributes.#{model}.#{attribute}") %></th>
    <% end %>
    <% if schools %>
    <th><%= t('activeldap.attributes.school.displayName') %></th>
    <% end %>
  </tr>

  <% objects.each do |o| %>
  <tr>
    <td data-title="<%= t('activeldap.attributes.user.displayName') %>">
      <% if current_user.organisation_owner? || (Array(current_user.puavoAdminOfSchool).map &:to_s).include?(o['puavoSchool']) %>
      <%= link_to o["name"], path.call(o['school_id'], o['id']) %>
      <% else %>
      <%= h o["name"] %>
      <% end %>
    </td>
    <% attributes[1..attributes.length].each do |attribute| %>
    <td data-title="<%= t("activeldap.attributes.#{model}.#{attribute}") %>">
      <%=h o[attribute].first %>
    </td>
    <% end %>
    <% if schools %>
    <td data-title="<%= t('activeldap.attributes.school.displayName') %>">
      <%=h @schools[o["school_id"]] %>
    </td>
    <% end %>
  </tr>
  <% end %>
</table>
</section>
<% end %>
