fix(manager): update templates and make everything works

This commit is contained in:
Colin Darie 2024-02-06 17:43:20 +01:00
parent 460778b617
commit 1e2a6d0461
25 changed files with 381 additions and 374 deletions

View file

@ -18,14 +18,15 @@ to display a collection of resources in an HTML table.
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
%>
<div class="bt-3">
<div style="padding: 1em">
<%= 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>
<%= f.select :records_per_page, options_for_select([["10", "10"], ["100", "100"], ["1000", "1000"]], @records_per_page) %>
<%= f.select :records_per_page, options_for_select([["10", "10"], ["100", "100"], ["1000", "1000"]], @records_per_page), {}, style: "width: auto" %>
<%= f.submit "Mettre a jour le nombre de démarche a archiver", class: 'button button--nav' %>
<% end %>
</div>
<%= form_with(url: bulk_update_manager_outdated_procedures_path, method: :patch) do |f| %>
<table aria-labelledby="<%= table_title %>">
<thead data-controller="outdated" >
@ -34,17 +35,17 @@ to display a collection of resources in an HTML table.
<% 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) %>"
cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>
cell-label--<%= "#{collection_presenter.resource_name}_#{attr_name}" %>"
scope="col"
role="columnheader"
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}",
default: resource_class.human_attribute_name(attr_name),
).titleize %>
default: resource_class.human_attribute_name(attr_name).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">
@ -55,23 +56,28 @@ to display a collection of resources in an HTML table.
<% 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 %>
<%= render(
"collection_header_actions",
collection_presenter: collection_presenter,
page: page,
resources: resources,
table_title: "page-title"
) %>
</tr>
</thead>
<tbody>
<% resources.each do |resource| %>
<tr class=""
<% if show_action? :show, resource %>
<tr
<% if accessible_action?(resource, :show) %>
<%= %(tabindex=0 role=link data-url=#{polymorphic_path([namespace, resource])}) %>
<% end %>
>
<td><%= f.check_box "procedure[ids][#{resource.id}]", checked: false %></td>
<td><%= f.check_box "procedure[ids][#{resource.id}]", checked: false %></td>
<% collection_presenter.attributes_for(resource).each do |attribute| %>
<td class="js-table-row cell-data cell-data--<%= attribute.html_class %>">
<td class="cell-data cell-data--<%= attribute.html_class %>">
<% if show_action? :show, resource -%>
<a href="<%= polymorphic_path([namespace, resource]) -%>"
tabindex="-1"
@ -85,26 +91,18 @@ to display a collection of resources in an HTML table.
</td>
<% end %>
<% if valid_action? :edit, collection_presenter.resource_name %>
<td><%= link_to(
t("administrate.actions.edit"),
[:edit, namespace, resource],
class: "action-edit",
) if show_action? :edit, resource%></td>
<% end %>
<% if valid_action? :destroy, collection_presenter.resource_name %>
<td><%= link_to(
t("administrate.actions.destroy"),
[namespace, resource],
class: "text-color-red",
method: :delete,
data: { confirm: t("administrate.actions.confirm") }
) if show_action? :destroy, resource %></td>
<% end %>
<%= render(
"collection_item_actions",
collection_presenter: collection_presenter,
collection_field_name: collection_field_name,
page: page,
namespace: namespace,
resource: resource,
table_title: "page-title"
) %>
</tr>
<% end %>
</tbody>
</table>
<%= f.submit "Activer l'archivage automatique des démarches sélectionnée" %>
<%= f.submit "Activer l'archivage automatique des démarches sélectionnée", style: "margin: 1em"%>
<% end %>