2022-08-16 16:53:41 +02:00
|
|
|
<%#
|
|
|
|
# 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
|
|
|
|
%>
|
|
|
|
|
2024-02-06 17:43:20 +01:00
|
|
|
<div style="padding: 1em">
|
2022-08-16 16:53:41 +02:00
|
|
|
<%= form_with(url: manager_outdated_procedures_path, method: :get) do |f| %>
|
|
|
|
<h2>Nombre de démarches sans auto archivage des dossiers: <%= @records_per_page %></h2>
|
|
|
|
<h2>Nombre de dossiers archivable parmis ces démarches: <%= resources.sum(&:dossiers_close_to_expiration) %> </h2>
|
2024-02-06 17:43:20 +01:00
|
|
|
<%= f.select :records_per_page, options_for_select([["10", "10"], ["100", "100"], ["1000", "1000"]], @records_per_page), {}, style: "width: auto" %>
|
2022-08-16 16:53:41 +02:00
|
|
|
<%= f.submit "Mettre a jour le nombre de démarche a archiver", class: 'button button--nav' %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2024-02-06 17:43:20 +01:00
|
|
|
|
2022-08-16 16:53:41 +02:00
|
|
|
<%= form_with(url: bulk_update_manager_outdated_procedures_path, method: :patch) do |f| %>
|
|
|
|
<table aria-labelledby="<%= table_title %>">
|
|
|
|
<thead data-controller="outdated" >
|
|
|
|
<tr>
|
|
|
|
<th></th>
|
|
|
|
<% collection_presenter.attribute_types.each do |attr_name, attr_type| %>
|
|
|
|
<th class="cell-label
|
|
|
|
cell-label--<%= attr_type.html_class %>
|
2024-02-06 17:43:20 +01:00
|
|
|
cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>
|
|
|
|
cell-label--<%= "#{collection_presenter.resource_name}_#{attr_name}" %>"
|
2022-08-16 16:53:41 +02:00
|
|
|
scope="col"
|
|
|
|
aria-sort="<%= sort_order(collection_presenter.ordered_html_class(attr_name)) %>">
|
|
|
|
<%= link_to(sanitized_order_params(page, collection_field_name).merge(
|
|
|
|
collection_presenter.order_params_for(attr_name, key: collection_field_name)
|
|
|
|
)) do %>
|
|
|
|
<%= t(
|
|
|
|
"helpers.label.#{collection_presenter.resource_name}.#{attr_name}",
|
2024-02-06 17:43:20 +01:00
|
|
|
default: resource_class.human_attribute_name(attr_name).titleize,
|
|
|
|
) %>
|
2022-08-16 16:53:41 +02:00
|
|
|
<% 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 %>
|
2024-02-06 17:43:20 +01:00
|
|
|
<%= render(
|
|
|
|
"collection_header_actions",
|
|
|
|
collection_presenter: collection_presenter,
|
|
|
|
page: page,
|
|
|
|
resources: resources,
|
|
|
|
table_title: "page-title"
|
|
|
|
) %>
|
2022-08-16 16:53:41 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
<% resources.each do |resource| %>
|
2024-02-06 17:43:20 +01:00
|
|
|
<tr
|
|
|
|
<% if accessible_action?(resource, :show) %>
|
2022-08-16 16:53:41 +02:00
|
|
|
<%= %(tabindex=0 role=link data-url=#{polymorphic_path([namespace, resource])}) %>
|
|
|
|
<% end %>
|
|
|
|
>
|
2024-02-06 17:43:20 +01:00
|
|
|
|
|
|
|
<td><%= f.check_box "procedure[ids][#{resource.id}]", checked: false %></td>
|
|
|
|
|
2022-08-16 16:53:41 +02:00
|
|
|
<% collection_presenter.attributes_for(resource).each do |attribute| %>
|
2024-02-06 17:43:20 +01:00
|
|
|
<td class="cell-data cell-data--<%= attribute.html_class %>">
|
2024-10-02 22:50:14 +02:00
|
|
|
<% if accessible_action?(resource, :show) -%>
|
2022-08-16 16:53:41 +02:00
|
|
|
<a href="<%= polymorphic_path([namespace, resource]) -%>"
|
|
|
|
tabindex="-1"
|
|
|
|
class="action-show"
|
|
|
|
>
|
|
|
|
<%= render_field attribute %>
|
|
|
|
</a>
|
|
|
|
<% else %>
|
|
|
|
<%= render_field attribute %>
|
|
|
|
<% end -%>
|
|
|
|
</td>
|
|
|
|
<% end %>
|
|
|
|
|
2024-02-06 17:43:20 +01:00
|
|
|
<%= render(
|
|
|
|
"collection_item_actions",
|
|
|
|
collection_presenter: collection_presenter,
|
|
|
|
collection_field_name: collection_field_name,
|
|
|
|
page: page,
|
|
|
|
namespace: namespace,
|
|
|
|
resource: resource,
|
|
|
|
table_title: "page-title"
|
|
|
|
) %>
|
2022-08-16 16:53:41 +02:00
|
|
|
</tr>
|
|
|
|
<% end %>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2024-02-06 17:43:20 +01:00
|
|
|
<%= f.submit "Activer l'archivage automatique des démarches sélectionnée", style: "margin: 1em"%>
|
2022-08-16 16:53:41 +02:00
|
|
|
<% end %>
|