perf: remove one query on invite dropdown
This commit is contained in:
parent
95430b2ee8
commit
9aeaddcb40
2 changed files with 6 additions and 5 deletions
|
@ -1,9 +1,10 @@
|
||||||
|
- invites = dossier.invites.load
|
||||||
.dropdown.invite-user-action{ data: { controller: 'menu-button', popover: 'true' } }
|
.dropdown.invite-user-action{ data: { controller: 'menu-button', popover: 'true' } }
|
||||||
%button.button.dropdown-button{ data: { menu_button_target: 'button' } }
|
%button.button.dropdown-button{ data: { menu_button_target: 'button' } }
|
||||||
%span.icon.person
|
%span.icon.person
|
||||||
- if dossier.invites.count > 0
|
- if invites.size > 0
|
||||||
= t('views.invites.dropdown.view_invited_people')
|
= t('views.invites.dropdown.view_invited_people')
|
||||||
%span.badge= dossier.invites.count
|
%span.badge= invites.size
|
||||||
- else
|
- else
|
||||||
- if dossier.read_only?
|
- if dossier.read_only?
|
||||||
= t('views.invites.dropdown.invite_to_view')
|
= t('views.invites.dropdown.invite_to_view')
|
||||||
|
@ -11,4 +12,4 @@
|
||||||
= t('views.invites.dropdown.invite_to_edit')
|
= t('views.invites.dropdown.invite_to_edit')
|
||||||
|
|
||||||
#invite-content.dropdown-content.fade-in-down{ data: { menu_button_target: 'menu' } }
|
#invite-content.dropdown-content.fade-in-down{ data: { menu_button_target: 'menu' } }
|
||||||
= render partial: "invites/form", locals: { dossier: dossier }
|
= render partial: "invites/form", locals: { dossier: dossier, invites: invites }
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#invites-form
|
#invites-form
|
||||||
- if dossier.invites.present?
|
- if invites.present?
|
||||||
%h4= t('views.invites.form.invite_to_participate')
|
%h4= t('views.invites.form.invite_to_participate')
|
||||||
%ul
|
%ul
|
||||||
- dossier.invites.each do |invite|
|
- invites.each do |invite|
|
||||||
%li
|
%li
|
||||||
= invite.email
|
= invite.email
|
||||||
%small{ 'data-turbo': 'true' }
|
%small{ 'data-turbo': 'true' }
|
||||||
|
|
Loading…
Reference in a new issue