From 2645ac85f71bc17918708312194a6896b9dd6bd7 Mon Sep 17 00:00:00 2001 From: Eric Leroy-Terquem Date: Mon, 28 Nov 2022 17:41:46 +0100 Subject: [PATCH] update wording and order in types de champ select --- app/graphql/schema.graphql | 16 +-- app/models/type_de_champ.rb | 99 ++++++++++--------- config/locales/models/type_de_champ/en.yml | 55 ++++++----- config/locales/models/type_de_champ/fr.yml | 64 ++++++------ .../api/v2/graphql_controller_spec.rb | 2 +- .../manager/dossiers_controller_spec.rb | 2 +- .../services/procedure_export_service_spec.rb | 10 +- .../procedure_creation_spec.rb | 2 +- .../administrateurs/types_de_champ_spec.rb | 2 +- 9 files changed, 131 insertions(+), 121 deletions(-) diff --git a/app/graphql/schema.graphql b/app/graphql/schema.graphql index b2c3b7b52..35030aaf0 100644 --- a/app/graphql/schema.graphql +++ b/app/graphql/schema.graphql @@ -2222,7 +2222,7 @@ enum TypeDeChamp { carte """ - Case à cocher + Case à cocher seule """ checkbox @@ -2272,12 +2272,12 @@ enum TypeDeChamp { dossier_link """ - Choix unique + Choix simple """ drop_down_list """ - Email + Adresse électronique """ email @@ -2292,7 +2292,7 @@ enum TypeDeChamp { header_section """ - Iban + Numéro Iban """ iban @@ -2312,7 +2312,7 @@ enum TypeDeChamp { mesri """ - Choix multiples + Choix multiple """ multiple_drop_down_list @@ -2357,17 +2357,17 @@ enum TypeDeChamp { rna """ - SIRET + Numéro Siret """ siret """ - Texte + Texte court """ text """ - Zone de texte + Texte long """ textarea diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb index 0573f6d2a..6285bd971 100644 --- a/app/models/type_de_champ.rb +++ b/app/models/type_de_champ.rb @@ -20,48 +20,49 @@ class TypeDeChamp < ApplicationRecord FILE_MAX_SIZE = 200.megabytes FEATURE_FLAGS = {} - CADRE = :cadre - STANDARD = :standard - CHOICE = :choice + STRUCTURE = :structure ETAT_CIVIL = :etat_civil - PAIEMENT_IDENTIFICATION = :paiement_identification - REFERENTIEL_EXTERNE = :referentiel_externe LOCALISATION = :localisation + PAIEMENT_IDENTIFICATION = :paiement_identification + STANDARD = :standard + PIECES_JOINTES = :pieces_jointes + CHOICE = :choice + REFERENTIEL_EXTERNE = :referentiel_externe - CATEGORIES = [CADRE, ETAT_CIVIL, LOCALISATION, PAIEMENT_IDENTIFICATION, STANDARD, CHOICE, REFERENTIEL_EXTERNE] + CATEGORIES = [STRUCTURE, ETAT_CIVIL, LOCALISATION, PAIEMENT_IDENTIFICATION, STANDARD, PIECES_JOINTES, CHOICE, REFERENTIEL_EXTERNE] TYPE_DE_CHAMP_TO_CATEGORIE = { - text: STANDARD, - textarea: STANDARD, - date: STANDARD, - datetime: STANDARD, - number: STANDARD, - decimal_number: STANDARD, - integer_number: STANDARD, - checkbox: CHOICE, + header_section: STRUCTURE, + repetition: STRUCTURE, + dossier_link: STRUCTURE, + explication: STRUCTURE, civilite: ETAT_CIVIL, email: ETAT_CIVIL, phone: ETAT_CIVIL, address: LOCALISATION, - yes_no: CHOICE, + communes: LOCALISATION, + departements: LOCALISATION, + regions: LOCALISATION, + pays: LOCALISATION, + iban: PAIEMENT_IDENTIFICATION, + siret: PAIEMENT_IDENTIFICATION, + text: STANDARD, + textarea: STANDARD, + number: STANDARD, + decimal_number: STANDARD, + integer_number: STANDARD, + date: STANDARD, + datetime: STANDARD, + piece_justificative: PIECES_JOINTES, + titre_identite: PIECES_JOINTES, + checkbox: CHOICE, drop_down_list: CHOICE, multiple_drop_down_list: CHOICE, linked_drop_down_list: CHOICE, - pays: LOCALISATION, - regions: LOCALISATION, - departements: LOCALISATION, - communes: LOCALISATION, - header_section: CADRE, - explication: CADRE, - dossier_link: CADRE, - piece_justificative: STANDARD, - rna: REFERENTIEL_EXTERNE, - siret: PAIEMENT_IDENTIFICATION, - carte: REFERENTIEL_EXTERNE, - repetition: CADRE, - titre_identite: ETAT_CIVIL, - iban: PAIEMENT_IDENTIFICATION, + yes_no: CHOICE, annuaire_education: REFERENTIEL_EXTERNE, + rna: REFERENTIEL_EXTERNE, + carte: REFERENTIEL_EXTERNE, cnaf: REFERENTIEL_EXTERNE, dgfip: REFERENTIEL_EXTERNE, pole_emploi: REFERENTIEL_EXTERNE, @@ -69,37 +70,37 @@ class TypeDeChamp < ApplicationRecord } enum type_champs: { - text: 'text', - textarea: 'textarea', - date: 'date', - datetime: 'datetime', - number: 'number', - decimal_number: 'decimal_number', - integer_number: 'integer_number', - checkbox: 'checkbox', + header_section: 'header_section', + repetition: 'repetition', + dossier_link: 'dossier_link', + explication: 'explication', civilite: 'civilite', email: 'email', phone: 'phone', address: 'address', - yes_no: 'yes_no', - drop_down_list: 'drop_down_list', - multiple_drop_down_list: 'multiple_drop_down_list', - linked_drop_down_list: 'linked_drop_down_list', communes: 'communes', departements: 'departements', regions: 'regions', pays: 'pays', - header_section: 'header_section', - explication: 'explication', - dossier_link: 'dossier_link', - piece_justificative: 'piece_justificative', - rna: 'rna', - carte: 'carte', - repetition: 'repetition', - titre_identite: 'titre_identite', iban: 'iban', siret: 'siret', + text: 'text', + textarea: 'textarea', + number: 'number', + decimal_number: 'decimal_number', + integer_number: 'integer_number', + date: 'date', + datetime: 'datetime', + piece_justificative: 'piece_justificative', + titre_identite: 'titre_identite', + checkbox: 'checkbox', + drop_down_list: 'drop_down_list', + multiple_drop_down_list: 'multiple_drop_down_list', + linked_drop_down_list: 'linked_drop_down_list', + yes_no: 'yes_no', annuaire_education: 'annuaire_education', + rna: 'rna', + carte: 'carte', cnaf: 'cnaf', dgfip: 'dgfip', pole_emploi: 'pole_emploi', diff --git a/config/locales/models/type_de_champ/en.yml b/config/locales/models/type_de_champ/en.yml index a8a53392d..4dbf93cb8 100644 --- a/config/locales/models/type_de_champ/en.yml +++ b/config/locales/models/type_de_champ/en.yml @@ -4,39 +4,48 @@ fr: type_de_champ: 'Field type' attributes: type_de_champ: + categorie: + structure: 'Field structure' + etat_civil: 'Civil status' + localisation: 'Location' + paiement_identification: 'Payment and identification' + standard: 'Standard field' + pieces_jointes: 'Attachments' + choice: 'Choice' + referentiel_externe: 'External referential' type_champs: - text: 'Text' - textarea: 'Text area' - date: 'Date' - datetime: 'Datetime' - number: 'Number' - decimal_number: 'Decimal number' - integer_number: 'Integer number' - checkbox: 'Checkbox' + header_section: 'Header section' + repetition: 'Repetition' + dossier_link: 'File link' + explication: 'Explication' civilite: 'Civility' email: 'Email' phone: 'Phone' address: 'Adress' - yes_no: 'Yes/No' + communes: 'Municipality' + departements: 'County' + regions: 'Region' + pays: 'Country' + iban: 'Iban' + siret: 'Siret' + text: 'Text' + textarea: 'Text area' + number: 'Number' + decimal_number: 'Decimal number' + integer_number: 'Integer number' + date: 'Date' + datetime: 'Datetime' + piece_justificative: 'Supporting document' + titre_identite: 'Identity title' + checkbox: 'Checkbox' drop_down_list: 'Dropdown list' multiple_drop_down_list: 'Multiple dropdown list' linked_drop_down_list: 'Linked dropdown list' - pays: 'Country' - regions: 'Regions' - departements: 'County' - communes: 'Municipality' - engagement: 'Commitment' - header_section: 'Header section' - explication: 'Explication' - dossier_link: 'File link' - piece_justificative: 'Supporting document' - siret: 'SIRET' + yes_no: 'Yes/No' + annuaire_education: 'Schooling directory' rna: 'RNA' carte: 'Card' - repetition: 'Repetition' - titre_identite: 'Identity title' - iban: 'Iban' - annuaire_education: 'Schooling directory' + engagement: 'Commitment' cnaf: 'Data from Caisse nationale des allocations familiales' dgfip: 'Data from Direction générale des Finances publiques' pole_emploi: 'Pôle emploi status' diff --git a/config/locales/models/type_de_champ/fr.yml b/config/locales/models/type_de_champ/fr.yml index be3a5a8ba..7b7a92eb1 100644 --- a/config/locales/models/type_de_champ/fr.yml +++ b/config/locales/models/type_de_champ/fr.yml @@ -5,47 +5,47 @@ fr: attributes: type_de_champ: categorie: - standard: 'Standard' - choice: 'Choix' + structure: 'Structure des champs' etat_civil: 'État civil' - cadre: 'Cadre' - file: 'Fichier' - paiement_identification: 'Paiement - Identification' - referentiel_externe: 'Référentiel externe' localisation: 'Localisation' + paiement_identification: 'Paiement et Identification' + standard: 'Champ standard' + pieces_jointes: 'Pièces jointes' + choice: 'Choix' + referentiel_externe: 'Référentiel externe' type_champs: - text: 'Texte' - textarea: 'Zone de texte' - date: 'Date' - datetime: 'Date et Heure' + header_section: 'Titre de section' + repetition: 'Bloc répétable' + dossier_link: 'Lien vers un autre dossier' + explication: 'Explication' + civilite: 'Civilité' + email: 'Adresse électronique' + phone: 'Téléphone' + address: 'Adresse' + communes: 'Communes' + departements: 'Départements' + regions: 'Régions' + pays: 'Pays' + iban: 'Numéro Iban' + siret: 'Numéro Siret' + text: 'Texte court' + textarea: 'Texte long' number: 'Nombre' decimal_number: 'Nombre décimal' integer_number: 'Nombre entier' - checkbox: 'Case à cocher' - civilite: 'Civilité' - email: 'Email' - phone: 'Téléphone' - address: 'Adresse' - yes_no: 'Oui/Non' - drop_down_list: 'Choix unique' - multiple_drop_down_list: 'Choix multiples' - linked_drop_down_list: 'Deux menus déroulants liés' - pays: 'Pays' - regions: 'Régions' - departements: 'Départements' - communes: 'Communes' - header_section: 'Titre de section' - explication: 'Explication' - engagement: 'Engagement' - dossier_link: 'Lien vers un autre dossier' + date: 'Date' + datetime: 'Date et Heure' piece_justificative: 'Pièce justificative' - siret: 'SIRET' + titre_identite: 'Titre identité' + checkbox: 'Case à cocher seule' + drop_down_list: 'Choix simple' + multiple_drop_down_list: 'Choix multiple' + linked_drop_down_list: 'Deux menus déroulants liés' + yes_no: 'Oui/Non' + annuaire_education: 'Annuaire de l’éducation' rna: 'RNA' carte: 'Carte' - repetition: 'Bloc répétable' - titre_identite: 'Titre identité' - iban: 'Iban' - annuaire_education: 'Annuaire de l’éducation' + engagement: 'Engagement' cnaf: 'Données de la Caisse nationale des allocations familiales' dgfip: 'Données de la Direction générale des Finances publiques' pole_emploi: 'Situation Pôle emploi' diff --git a/spec/controllers/api/v2/graphql_controller_spec.rb b/spec/controllers/api/v2/graphql_controller_spec.rb index 39c809b50..cd9e8a8ef 100644 --- a/spec/controllers/api/v2/graphql_controller_spec.rb +++ b/spec/controllers/api/v2/graphql_controller_spec.rb @@ -1482,7 +1482,7 @@ describe API::V2::GraphqlController do "mutation { dossierModifierAnnotationText(input: { dossierId: \"#{dossier.to_typed_id}\", - annotationId: \"#{dossier.champs_private.first.to_typed_id}\", + annotationId: \"#{dossier.champs_private.find { |c| c.type == 'Champs::TextChamp' }.to_typed_id}\", instructeurId: \"#{instructeur.to_typed_id}\", value: \"hello\" }) { diff --git a/spec/controllers/manager/dossiers_controller_spec.rb b/spec/controllers/manager/dossiers_controller_spec.rb index ac60823d2..3bff00e01 100644 --- a/spec/controllers/manager/dossiers_controller_spec.rb +++ b/spec/controllers/manager/dossiers_controller_spec.rb @@ -32,6 +32,6 @@ describe Manager::DossiersController, type: :controller do subject { strip_tags(response.body) } - it { expect(subject).to match(%r{Nom\s+\*\s+Texte\s+🟢\s+rempli}) } + it { expect(subject).to match(%r{Nom\s+\*\s+Texte court\s+🟢\s+rempli}) } end end diff --git a/spec/services/procedure_export_service_spec.rb b/spec/services/procedure_export_service_spec.rb index 43c9c517a..1d62e4d73 100644 --- a/spec/services/procedure_export_service_spec.rb +++ b/spec/services/procedure_export_service_spec.rb @@ -87,7 +87,7 @@ describe ProcedureExportService do end it 'should have headers' do - expect(dossiers_sheet.headers).to match(nominal_headers) + expect(dossiers_sheet.headers).to match_array(nominal_headers) end it 'should have data' do @@ -108,7 +108,7 @@ describe ProcedureExportService do let(:birthdate_headers) { nominal_headers.insert(nominal_headers.index('Archivé'), 'Date de naissance') } - it { expect(dossiers_sheet.headers).to match(birthdate_headers) } + it { expect(dossiers_sheet.headers).to match_array(birthdate_headers) } it { expect(dossiers_sheet.data[0][dossiers_sheet.headers.index('Date de naissance')]).to be_a(Date) } end @@ -117,7 +117,7 @@ describe ProcedureExportService do let(:routee_headers) { nominal_headers.insert(nominal_headers.index('textarea'), 'Groupe instructeur') } - it { expect(dossiers_sheet.headers).to match(routee_headers) } + it { expect(dossiers_sheet.headers).to match_array(routee_headers) } it { expect(dossiers_sheet.data[0][dossiers_sheet.headers.index('Groupe instructeur')]).to eq('défaut') } end @@ -280,12 +280,12 @@ describe ProcedureExportService do let(:dossiers_sheet_headers) { subject.first } it 'should have headers' do - expect(dossiers_sheet_headers).to match(nominal_headers) + expect(dossiers_sheet_headers).to match_array(nominal_headers) end end it 'should have headers' do - expect(dossiers_sheet.headers).to match(nominal_headers) + expect(dossiers_sheet.headers).to match_array(nominal_headers) expect(etablissements_sheet.headers).to eq([ "Dossier ID", diff --git a/spec/system/administrateurs/procedure_creation_spec.rb b/spec/system/administrateurs/procedure_creation_spec.rb index 6d0eb55ce..3a64f3cc5 100644 --- a/spec/system/administrateurs/procedure_creation_spec.rb +++ b/spec/system/administrateurs/procedure_creation_spec.rb @@ -38,7 +38,7 @@ describe 'Creating a new procedure', js: true do fill_in 'Libellé du champ', with: 'libelle de champ' blur expect(page).to have_content('Formulaire enregistré') - expect(page).to have_selector('select > optgroup', count: 7) + expect(page).to have_selector('select > optgroup', count: 8) add_champ expect(page).to have_selector('.type-de-champ', count: 1) diff --git a/spec/system/administrateurs/types_de_champ_spec.rb b/spec/system/administrateurs/types_de_champ_spec.rb index 4adfc0c29..22ca1ea3a 100644 --- a/spec/system/administrateurs/types_de_champ_spec.rb +++ b/spec/system/administrateurs/types_de_champ_spec.rb @@ -142,7 +142,7 @@ describe 'As an administrateur I can edit types de champ', js: true do scenario "adding a dropdown champ" do add_champ(remove_flash_message: true) - select('Choix unique', from: 'Type de champ') + select('Choix simple', from: 'Type de champ') fill_in 'Libellé du champ', with: 'Libellé de champ menu déroulant', fill_options: { clear: :backspace } fill_in 'Options de la liste', with: 'Un menu', fill_options: { clear: :backspace } check "Proposer une option « autre » avec un texte libre"