<commit_before><%#
# Collection

This partial is used on the `index` and `show` pages
to display a collection of resources in an HTML table.

## Local variables:

- `collection_presenter`:
  An instance of [Administrate::Page::Collection][1].
  The table presenter uses `ResourceDashboard::COLLECTION_ATTRIBUTES` to determine
  the columns displayed in the table
- `resources`:
  An ActiveModel::Relation collection of resources to be displayed in the table.
  By default, the number of resources is limited by pagination
  or by a hard limit to prevent excessive page load times

[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
%>

<table style="text-align:left" aria-labelledby="<%= table_title %>">
  <thead>
    <tr>
      <% collection_presenter.attribute_types.each do |attr_name, attr_type| %>
        <th class="cell-label
        cell-label--<%= attr_type.html_class %>
        cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>"
        scope="col"
        role="columnheader"
        aria-sort="<%= sort_order(collection_presenter.ordered_html_class(attr_name)) %>"
        style="text-align:left">
        <%= link_to(sanitized_order_params.merge(
          collection_presenter.order_params_for(attr_name)
        )) do %>
        <%= t(
          "helpers.label.#{collection_presenter.resource_name}.#{attr_name}",
          default: attr_name.to_s,
        ).titleize %>

            <% if collection_presenter.ordered_by?(attr_name) %>
              <span class="cell-label__sort-indicator cell-label__sort-indicator--<%= collection_presenter.ordered_html_class(attr_name) %>">
                <svg aria-hidden="true">
                  <use xlink:href="#icon-up-caret" />
                </svg>
              </span>
            <% end %>
          <% end %>
        </th>
      <% end %>
      <% [valid_action?(:edit, collection_presenter.resource_name),
          valid_action?(:destroy, collection_presenter.resource_name)].count(true).times do %>
        <th scope="col"></th>
      <% end %>
    </tr>
  </thead>

  <tbody>
    <% resources.each do |resource| %>
      <tr class="js-table-row"
          tabindex="0"
          <% if valid_action? :show, collection_presenter.resource_name %>
            <%= %(role=link data-url=#{polymorphic_path([namespace, resource])}) %>
          <% end %>
          >
        <% collection_presenter.attributes_for(resource).each do |attribute| %>
          <td style="text-align:left" class="cell-data cell-data--<%= attribute.html_class %>">
            <% if show_action? :show, resource -%>
              <!-- <a href="<%= polymorphic_path([namespace, resource]) -%>"
                 class="action-show"
                 > -->
                <%= render_field attribute %>
              </a>
            <% end -%>
          </td>
        <% end %>

        <% if valid_action? :destroy, collection_presenter.resource_name %>
          <td><%= link_to(
            'Delete',
            [namespace, resource],
            class: "text-color-red",
            method: :delete,
            data: { confirm: t("administrate.actions.confirm") }
          ) if show_action? :destroy, resource %></td>
        <% end %>
      </tr>
    <% end %>
  </tbody>
</table>
<commit_msg>Add confirmation before deleting category<commit_after><%#
# Collection

This partial is used on the `index` and `show` pages
to display a collection of resources in an HTML table.

## Local variables:

- `collection_presenter`:
  An instance of [Administrate::Page::Collection][1].
  The table presenter uses `ResourceDashboard::COLLECTION_ATTRIBUTES` to determine
  the columns displayed in the table
- `resources`:
  An ActiveModel::Relation collection of resources to be displayed in the table.
  By default, the number of resources is limited by pagination
  or by a hard limit to prevent excessive page load times

[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
%>

<table style="text-align:left" aria-labelledby="<%= table_title %>">
  <thead>
    <tr>
      <% collection_presenter.attribute_types.each do |attr_name, attr_type| %>
        <th class="cell-label
        cell-label--<%= attr_type.html_class %>
        cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>"
        scope="col"
        role="columnheader"
        aria-sort="<%= sort_order(collection_presenter.ordered_html_class(attr_name)) %>"
        style="text-align:left">
        <%= link_to(sanitized_order_params.merge(
          collection_presenter.order_params_for(attr_name)
        )) do %>
        <%= t(
          "helpers.label.#{collection_presenter.resource_name}.#{attr_name}",
          default: attr_name.to_s,
        ).titleize %>

            <% if collection_presenter.ordered_by?(attr_name) %>
              <span class="cell-label__sort-indicator cell-label__sort-indicator--<%= collection_presenter.ordered_html_class(attr_name) %>">
                <svg aria-hidden="true">
                  <use xlink:href="#icon-up-caret" />
                </svg>
              </span>
            <% end %>
          <% end %>
        </th>
      <% end %>
      <% [valid_action?(:edit, collection_presenter.resource_name),
          valid_action?(:destroy, collection_presenter.resource_name)].count(true).times do %>
        <th scope="col"></th>
      <% end %>
    </tr>
  </thead>

  <tbody>
    <% resources.each do |resource| %>
      <tr class="js-table-row"
          tabindex="0"
          <% if valid_action? :show, collection_presenter.resource_name %>
            <%= %(role=link data-url=#{polymorphic_path([namespace, resource])}) %>
          <% end %>
          >
        <% collection_presenter.attributes_for(resource).each do |attribute| %>
          <td style="text-align:left" class="cell-data cell-data--<%= attribute.html_class %>">
            <% if show_action? :show, resource -%>
              <!-- <a href="<%= polymorphic_path([namespace, resource]) -%>"
                 class="action-show"
                 > -->
                <%= render_field attribute %>
              </a>
            <% end -%>
          </td>
        <% end %>

        <% if valid_action? :destroy, collection_presenter.resource_name %>
          <td><%= link_to(
            'Delete',
            [namespace, resource],
            class: "text-color-red",
            method: :delete,
            data: { confirm: "Deleting this category will delete all posts
              associated with the category. Are you sure?" }
          ) if show_action? :destroy, resource %></td>
        <% end %>
      </tr>
    <% end %>
  </tbody>
</table>

{'fraction_non_alphanumeric': 0.14296418402517608, 'fraction_numerical': 0.0008991458114790948, 'mean_word_length': 2.375821952453212, 'pattern_counts': {'":': 0, '<': 115, '<?xml version=': 0, '>': 115, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1781759', 'n_tokens_mistral': 2058, 'n_tokens_neox': 1920, 'n_words': 409}