clean(InvitationWithTypoComponent): simplier interface

This commit is contained in:
mfo 2024-06-25 14:36:41 +02:00
parent 2bb7584246
commit 4771c45bce
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
3 changed files with 4 additions and 5 deletions

View file

@ -1,8 +1,7 @@
class Procedure::InvitationWithTypoComponent < ApplicationComponent
def initialize(maybe_typo:, url:, params:, title:)
def initialize(maybe_typo:, url:, title:)
@maybe_typo = maybe_typo
@url = url
@params = params
@title = title
end

View file

@ -5,6 +5,6 @@
- maybe_typos.each do |(actual_email, suggested_email)|
%li
= "Je confirme "
= button_to "#{actual_email}", @url, method: :POST, params: @params.call(actual_email), class: 'fr-btn fr-btn--tertiary fr-btn--sm', form: {class: 'inline'}
= button_to "#{actual_email}", @url, method: :POST, params: { maybe_typo: actual_email }, class: 'fr-btn fr-btn--tertiary fr-btn--sm', form: {class: 'inline'}
= " ou "
= button_to "#{suggested_email}", @url, method: :POST, params: @params.call(suggested_email), class: 'fr-btn fr-btn--tertiary fr-btn--sm', form: {class: 'inline'}
= button_to "#{suggested_email}", @url, method: :POST, params: { maybe_typo: suggested_email }, class: 'fr-btn fr-btn--tertiary fr-btn--sm', form: {class: 'inline'}

View file

@ -58,7 +58,7 @@
- if @procedure.experts_require_administrateur_invitation?
.card
= render Procedure::InvitationWithTypoComponent.new(maybe_typo: @maybe_typo, url: admin_procedure_experts_path(@procedure), params: ->(email) { { maybe_typo: email } }, title: "Avant d'ajouter l'email à la liste d'expert prédéfinie, veuillez confirmer" )
= render Procedure::InvitationWithTypoComponent.new(maybe_typo: @maybe_typo, url: admin_procedure_experts_path(@procedure), title: "Avant d'ajouter l'email à la liste d'expert prédéfinie, veuillez confirmer" )
= form_for :experts_procedure,
url: admin_procedure_experts_path(@procedure),
html: { class: 'form' } do |f|