Use render collection to speed up render

This commit is contained in:
simon lehericey 2020-09-10 21:05:34 +02:00 committed by LeSim (Rebase PR Action)
parent b124579681
commit 9bd4c11d52
2 changed files with 69 additions and 68 deletions

View file

@ -1,63 +1,61 @@
%ul.procedure-list
- procedures.each do |p|
%li.procedure-item.flex.align-start
= link_to(instructeur_procedure_path(p)) do
.flex
%li.procedure-item.flex.align-start
= link_to(instructeur_procedure_path(p)) do
.flex
.procedure-logo{ style: "background-image: url(#{p.logo_url})" }
.procedure-logo{ style: "background-image: url(#{p.logo_url})" }
.procedure-details
%p.procedure-title
= procedure_libelle p
%ul.procedure-stats.flex
%li
%object
= link_to(instructeur_procedure_path(p, statut: 'a-suivre')) do
- a_suivre_count = dossiers_a_suivre_count_per_procedure[p.id] || 0
.stats-number
= number_with_html_delimiter(a_suivre_count)
.stats-legend
à suivre
%li
%object
= link_to(instructeur_procedure_path(p, statut: 'suivis')) do
- if procedure_ids_en_cours_with_notifications.include?(p.id)
%span.notifications{ 'aria-label': "notifications" }
- followed_count = followed_dossiers_count_per_procedure[p.id] || 0
.stats-number
= number_with_html_delimiter(followed_count)
.stats-legend
= t('pluralize.followed', count: followed_count)
%li
%object
= link_to(instructeur_procedure_path(p, statut: 'traites')) do
- if procedure_ids_termines_with_notifications.include?(p.id)
%span.notifications{ 'aria-label': "notifications" }
- termines_count = dossiers_termines_count_per_procedure[p.id] || 0
.stats-number
= number_with_html_delimiter(termines_count)
.stats-legend
= t('pluralize.processed', count: termines_count)
%li
%object
= link_to(instructeur_procedure_path(p, statut: 'tous')) do
- dossier_count = dossiers_count_per_procedure[p.id] || 0
.stats-number
= number_with_html_delimiter(dossier_count)
.stats-legend
= t('pluralize.case', count: dossier_count)
%li
%object
= link_to(instructeur_procedure_path(p, statut: 'archives')) do
- archived_count = dossiers_archived_count_per_procedure[p.id] || 0
.stats-number
= number_with_html_delimiter(archived_count)
.stats-legend
= t('pluralize.archived', count: archived_count)
.procedure-details
%p.procedure-title
= procedure_libelle p
%ul.procedure-stats.flex
%li
%object
= link_to(instructeur_procedure_path(p, statut: 'a-suivre')) do
- a_suivre_count = dossiers_a_suivre_count_per_procedure[p.id] || 0
.stats-number
= number_with_html_delimiter(a_suivre_count)
.stats-legend
à suivre
%li
%object
= link_to(instructeur_procedure_path(p, statut: 'suivis')) do
- if procedure_ids_en_cours_with_notifications.include?(p.id)
%span.notifications{ 'aria-label': "notifications" }
- followed_count = followed_dossiers_count_per_procedure[p.id] || 0
.stats-number
= number_with_html_delimiter(followed_count)
.stats-legend
= t('pluralize.followed', count: followed_count)
%li
%object
= link_to(instructeur_procedure_path(p, statut: 'traites')) do
- if procedure_ids_termines_with_notifications.include?(p.id)
%span.notifications{ 'aria-label': "notifications" }
- termines_count = dossiers_termines_count_per_procedure[p.id] || 0
.stats-number
= number_with_html_delimiter(termines_count)
.stats-legend
= t('pluralize.processed', count: termines_count)
%li
%object
= link_to(instructeur_procedure_path(p, statut: 'tous')) do
- dossier_count = dossiers_count_per_procedure[p.id] || 0
.stats-number
= number_with_html_delimiter(dossier_count)
.stats-legend
= t('pluralize.case', count: dossier_count)
%li
%object
= link_to(instructeur_procedure_path(p, statut: 'archives')) do
- archived_count = dossiers_archived_count_per_procedure[p.id] || 0
.stats-number
= number_with_html_delimiter(archived_count)
.stats-legend
= t('pluralize.archived', count: archived_count)
- if p.close?
.procedure-status
%span.label Close
- elsif p.depubliee?
.procedure-status
%span.label Dépubliée
- if p.close?
.procedure-status
%span.label Close
- elsif p.depubliee?
.procedure-status
%span.label Dépubliée

View file

@ -4,11 +4,14 @@
%h1.page-title Démarches
= render partial: 'instructeurs/procedures/synthese', locals: { procedures: @procedures, all_dossiers_counts: @all_dossiers_counts }
= render partial: 'instructeurs/procedures/list', locals: { procedures: @procedures,
dossiers_count_per_procedure: @dossiers_count_per_procedure,
dossiers_a_suivre_count_per_procedure: @dossiers_a_suivre_count_per_procedure,
dossiers_archived_count_per_procedure: @dossiers_archived_count_per_procedure,
dossiers_termines_count_per_procedure: @dossiers_termines_count_per_procedure,
followed_dossiers_count_per_procedure: @followed_dossiers_count_per_procedure,
procedure_ids_en_cours_with_notifications: @procedure_ids_en_cours_with_notifications,
procedure_ids_termines_with_notifications: @procedure_ids_termines_with_notifications }
%ul.procedure-list
= render partial: 'instructeurs/procedures/list',
collection: @procedures,
as: :p,
locals: { dossiers_count_per_procedure: @dossiers_count_per_procedure,
dossiers_a_suivre_count_per_procedure: @dossiers_a_suivre_count_per_procedure,
dossiers_archived_count_per_procedure: @dossiers_archived_count_per_procedure,
dossiers_termines_count_per_procedure: @dossiers_termines_count_per_procedure,
followed_dossiers_count_per_procedure: @followed_dossiers_count_per_procedure,
procedure_ids_en_cours_with_notifications: @procedure_ids_en_cours_with_notifications,
procedure_ids_termines_with_notifications: @procedure_ids_termines_with_notifications }