Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5799 - Fix(form /contact-admin): use APPLICATION_NAME #5800

Conversation

dzc34
Copy link
Collaborator

@dzc34 dzc34 commented Dec 14, 2020

Fixed #5799 "Formulaire /contact-admin - Les options ne sont pas personnalisées par APPLICATION_NAME " / @adullact

Description du bug

Dans le formulaire /contact-admin, les options du champ "Votre question" ne sont pas personnalisées par la variable d'environnement optionnelle APPLICATION_NAME ajouté dans le fichier .env.

Reproduction

Comment reproduire le problème :

  1. ajouter dans le fichier .env la variable d'environnement optionnelle APPLICATION_NAME
  2. démarrer le serveur PUMA
  3. consulter la page /contact-admin
<label for="type">Votre question<span class="mandatory">*</span></label>
<select name="type" id="type">
   <option value="admin question">J’ai une question sur demarches-simplifiees.fr</option>
   <option value="admin demande rdv">Demande de RDV pour une présentation à distance de demarches-simplifiees.fr</option>
   <option value="admin soucis">J’ai un problème technique avec demarches-simplifiees.fr</option>
   ...
</select>

Sélection_010

Comportement attendu

Dans le formulaire /contact-admin, les options du champ "Votre question" sont personnalisées par la variable d'environnement optionnelle APPLICATION_NAME ajouté dans le fichier .env.

<label for="type">Votre question<span class="mandatory">*</span></label>
<select name="type" id="type">
   <option value="admin question">J’ai une question sur ds.local</option>
   <option value="admin demande rdv">Demande de RDV pour une présentation à distance de ds.local</option>
   <option value="admin soucis">J’ai un problème technique avec ds.local</option>
   ...
</select>

Sélection_011

Correctif proposé

Fichier config/locales/views/support/index.fr.yml

-    admin demande rdv: Demande de RDV pour une présentation à distance de demarches-simplifiees.fr
-    admin question: J’ai une question sur demarches-simplifiees.fr
-    admin soucis: J’ai un problème technique avec demarches-simplifiees.fr
+    admin demande rdv: Demande de RDV pour une présentation à distance de %{app_name}
+    admin question: J’ai une question sur %{app_name}
+    admin soucis: J’ai un problème technique avec %{app_name}
     admin suggestion produit: J’ai une proposition d’évolution

Fichier app/lib/helpscout/form_adapter.rb

   def self.admin_options
     [
-      [I18n.t(ADMIN_TYPE_QUESTION, scope: [:supportadmin]), ADMIN_TYPE_QUESTION],
-      [I18n.t(ADMIN_TYPE_RDV, scope: [:supportadmin]), ADMIN_TYPE_RDV],
-      [I18n.t(ADMIN_TYPE_SOUCIS, scope: [:supportadmin]), ADMIN_TYPE_SOUCIS],
+      [I18n.t(ADMIN_TYPE_QUESTION, scope: [:supportadmin], app_name: APPLICATION_NAME), ADMIN_TYPE_QUESTION],
+      [I18n.t(ADMIN_TYPE_RDV, scope: [:supportadmin], app_name: APPLICATION_NAME), ADMIN_TYPE_RDV],
+      [I18n.t(ADMIN_TYPE_SOUCIS, scope: [:supportadmin], app_name: APPLICATION_NAME), ADMIN_TYPE_SOUCIS],
       [I18n.t(ADMIN_TYPE_PRODUIT, scope: [:supportadmin]), ADMIN_TYPE_PRODUIT],
       [I18n.t(ADMIN_TYPE_DEMANDE_COMPTE, scope: [:supportadmin]), ADMIN_TYPE_DEMANDE_COMPTE],
       [I18n.t(ADMIN_TYPE_AUTRE, scope: [:supportadmin]), ADMIN_TYPE_AUTRE]
     ]
   end

Rebase du code (si nécessaire)

Si besoin nous pouvons faire les rebases et/ou ajouter un utilisateur BetaGouv pour faire le rebase directement sur notre dépôt.


trackingAdullactContrib

@LeSim LeSim force-pushed the 5799_Form-contact-admin_use_APPLICATION_NAME branch from 3f5a2c6 to 3a9f82b Compare December 15, 2020 15:14
@LeSim LeSim merged commit 90d7ee8 into demarches-simplifiees:dev Dec 15, 2020
@dzc34 dzc34 deleted the 5799_Form-contact-admin_use_APPLICATION_NAME branch December 15, 2020 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants