<h1><%= t("scaffold.pagetitle_index", model: Link.model_name.human(count: 2)) %></h1>

<table class="table table-striped">
  <thead>
    <tr>
      <th></th>
      <th><%= LinkCategory.model_name.human %></th>
      <th><%= Link.human_attribute_name(:url) %></th>
      <th><%= Link.human_attribute_name(:text) %></th>
      <th><%= Link.human_attribute_name(:description) %></th>
      <th><%= Link.human_attribute_name(:last_check_at) %></th>
    </tr>
  </thead>
  <tbody>
    <% @links.each do |link| %>
      <tr>
        <td><%= link_to(tag.i(class: link.ok? ? "bi bi-check" : "bi bi-x-lg"), url_for(link)) %></td>
        <td><%= link_to(link.link_category.name, url_for(link)) %></td>
        <td><%= link_to(truncate(link.url), link.url, target: "_blank", rel: "nofollow") %></td>
        <td><%= link_to(link.text, url_for(link)) %></td>
        <td><%= link_to(truncate(link.description.to_plain_text), url_for(link)) %></td>
        <td><%= link.last_check_at && l(link.last_check_at, format: :short) %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<div class="action-row">
  <%= link_to t("scaffold.link_new", model: Link.model_name.human), new_link_path %>
</div>
