<%
  # Redmine plugin for Document Management System "Features"
  #
  # Karel Pičman <karel.picman@kontron.com>
  #
  # This file is part of Redmine DMSF plugin.
  #
  # Redmine DMSF plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General
  # Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
  # later version.
  #
  # Redmine DMSF plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  # more details.
  #
  # You should have received a copy of the GNU General Public License along with Redmine DMSF plugin. If not, see
  # <https://www.gnu.org/licenses/>.
%>

<% query_options = nil unless defined?(query_options) %>
<% query_options ||= {} %>

<%= form_tag({}, data: { cm_url: query.deleted ? dmsf_trash_context_menu_path : dmsf_context_menu_path(folder_id: folder) }) do %>
  <%= hidden_field_tag 'back_url', url_for(params: request.query_parameters), id: nil %>
  <%= query_columns_hidden_tags(query) %>
  <div class="autoscroll">
    <table class="list dmsf odd-even <%= query.css_classes %> context-menu-container" data-hascontextmenu="true">
      <thead>
      <tr>
        <th class="checkbox hide-when-print">
          <%= check_box_tag 'check_all', '', false, class: 'toggle-selection', title: "#{l(:button_check_all)}/#{l(:button_uncheck_all)}" %>
        </th>
        <% query.inline_columns.each do |column| %>
          <%= column_header(query, column, query_options) %>
        <% end %>
        <th class="buttons"></th>
      </tr>
      </thead>
      <tbody>
      <%= render partial: 'query_rows', locals: { query: query, dmsf_pages: dmsf_pages } %>
      </tbody>
    </table>
  </div>
<% end %>
