From 23ae528c6bdfa41a896c49a5a1b984231d9f4751 Mon Sep 17 00:00:00 2001 From: Christophe Robillard Date: Tue, 8 Dec 2020 21:30:54 +0100 Subject: [PATCH] affiche Madame ou Monsieur MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mais continue à enregistrer en base Mme ou M. --- app/models/individual.rb | 4 ++-- app/views/shared/dossiers/editable_champs/_civilite.html.haml | 4 ++-- app/views/users/dossiers/identite.html.haml | 4 ++-- config/locales/models/individual/fr.yml | 3 +++ spec/factories/individual.rb | 2 +- spec/features/users/brouillon_spec.rb | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/models/individual.rb b/app/models/individual.rb index a5376427f..f58f83639 100644 --- a/app/models/individual.rb +++ b/app/models/individual.rb @@ -19,8 +19,8 @@ class Individual < ApplicationRecord validates :nom, presence: true, allow_blank: false, allow_nil: false, on: :update validates :prenom, presence: true, allow_blank: false, allow_nil: false, on: :update - GENDER_MALE = 'Monsieur' - GENDER_FEMALE = 'Madame' + GENDER_MALE = "M." + GENDER_FEMALE = 'Mme' def self.from_france_connect(fc_information) new( diff --git a/app/views/shared/dossiers/editable_champs/_civilite.html.haml b/app/views/shared/dossiers/editable_champs/_civilite.html.haml index 3c0e5718c..2aaf16e20 100644 --- a/app/views/shared/dossiers/editable_champs/_civilite.html.haml +++ b/app/views/shared/dossiers/editable_champs/_civilite.html.haml @@ -3,8 +3,8 @@ Sélectionnez une des valeurs %label = form.radio_button :value, Individual::GENDER_FEMALE - = Individual::GENDER_FEMALE + = t(Individual::GENDER_FEMALE, scope: 'activerecord.attributes.individual.gender_options') %label = form.radio_button :value, Individual::GENDER_MALE - = Individual::GENDER_MALE + = t('activerecord.attributes.individual.gender_options')[Individual::GENDER_MALE.to_sym] # GENDER_MALE contains a point letter diff --git a/app/views/users/dossiers/identite.html.haml b/app/views/users/dossiers/identite.html.haml index 8b3061a92..8199e5eeb 100644 --- a/app/views/users/dossiers/identite.html.haml +++ b/app/views/users/dossiers/identite.html.haml @@ -14,10 +14,10 @@ .radios %label = f.radio_button :gender, Individual::GENDER_FEMALE, required: true - = Individual::GENDER_FEMALE + = t(Individual::GENDER_FEMALE, scope: 'activerecord.attributes.individual.gender_options') %label = f.radio_button :gender, Individual::GENDER_MALE, required: true - = Individual::GENDER_MALE + = t('activerecord.attributes.individual.gender_options')[Individual::GENDER_MALE.to_sym] # GENDER_MALE contains a point letter .flex .inline-champ diff --git a/config/locales/models/individual/fr.yml b/config/locales/models/individual/fr.yml index 19ccb4308..83a91ce17 100644 --- a/config/locales/models/individual/fr.yml +++ b/config/locales/models/individual/fr.yml @@ -6,3 +6,6 @@ fr: nom: Nom prenom: Prénom birthdate: Date de naissance + gender_options: + "Mme": "Madame" + "M." : "Monsieur" diff --git a/spec/factories/individual.rb b/spec/factories/individual.rb index d4d77bcd1..e93b3f6c0 100644 --- a/spec/factories/individual.rb +++ b/spec/factories/individual.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :individual do - gender { 'Monsieur' } + gender { 'M.' } nom { 'Julien' } prenom { 'Xavier' } birthdate { Date.new(1991, 11, 01) } diff --git a/spec/features/users/brouillon_spec.rb b/spec/features/users/brouillon_spec.rb index 94e89dc0a..cb02a6d55 100644 --- a/spec/features/users/brouillon_spec.rb +++ b/spec/features/users/brouillon_spec.rb @@ -51,7 +51,7 @@ feature 'The user' do expect(champ_value_for('datetime')).to eq('06/01/2030 07:05') expect(champ_value_for('number')).to eq('42') expect(champ_value_for('checkbox')).to eq('on') - expect(champ_value_for('civilite')).to eq('Madame') + expect(champ_value_for('civilite')).to eq('Mme') expect(champ_value_for('email')).to eq('loulou@yopmail.com') expect(champ_value_for('phone')).to eq('0123456789') expect(champ_value_for('yes_no')).to eq('false')