Merge pull request #6180 from betagouv/fix-administrate-translation

SuperAdmin : correction de l'affichage de la page `/manager/dossiers`
This commit is contained in:
Pierre de La Morinerie 2021-05-06 15:18:52 +02:00 committed by GitHub
commit 9fd42a809f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 19 deletions

View file

@ -6,6 +6,7 @@ gem 'active_model_serializers'
gem 'activestorage-openstack' gem 'activestorage-openstack'
gem 'active_storage_validations' gem 'active_storage_validations'
gem 'administrate', git: 'https://github.com/thoughtbot/administrate.git', ref: 'refs/pull/1972/head' # Provides an administration UI (pull request #1972 has fixes for Rails 6.1.3.2) gem 'administrate', git: 'https://github.com/thoughtbot/administrate.git', ref: 'refs/pull/1972/head' # Provides an administration UI (pull request #1972 has fixes for Rails 6.1.3.2)
gem 'administrate-field-enum' # Allow using Field::Enum in administrate
gem 'after_party' gem 'after_party'
gem 'anchored' gem 'anchored'
gem 'bcrypt' gem 'bcrypt'

View file

@ -102,6 +102,8 @@ GEM
zeitwerk (~> 2.3) zeitwerk (~> 2.3)
addressable (2.7.0) addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
administrate-field-enum (0.0.9)
administrate (~> 0.12)
aes_key_wrap (1.1.0) aes_key_wrap (1.1.0)
after_party (1.11.2) after_party (1.11.2)
anchored (1.1.0) anchored (1.1.0)
@ -776,6 +778,7 @@ DEPENDENCIES
active_storage_validations active_storage_validations
activestorage-openstack activestorage-openstack
administrate! administrate!
administrate-field-enum
after_party after_party
anchored anchored
annotate annotate

View file

@ -10,7 +10,7 @@ class DossierDashboard < Administrate::BaseDashboard
ATTRIBUTE_TYPES = { ATTRIBUTE_TYPES = {
id: Field::Number.with_options(searchable: true), id: Field::Number.with_options(searchable: true),
procedure: Field::HasOne, procedure: Field::HasOne,
state: Field::String, state: Field::Enum,
user: Field::BelongsTo, user: Field::BelongsTo,
text_summary: Field::String.with_options(searchable: false), text_summary: Field::String.with_options(searchable: false),
created_at: Field::DateTime, created_at: Field::DateTime,

View file

@ -1088,7 +1088,7 @@ enum DossierState {
refuse refuse
""" """
Sans suite Classé sans suite
""" """
sans_suite sans_suite
} }

View file

@ -2,7 +2,7 @@ module Types
class DossierType < Types::BaseObject class DossierType < Types::BaseObject
class DossierState < Types::BaseEnum class DossierState < Types::BaseEnum
Dossier.aasm.states.reject { |state| state.name == :brouillon }.each do |state| Dossier.aasm.states.reject { |state| state.name == :brouillon }.each do |state|
value(state.name.to_s, state.display_name, value: state.name.to_s) value(state.name.to_s, Dossier.human_attribute_name("state.#{state.name}"), value: state.name.to_s)
end end
end end

View file

@ -51,7 +51,7 @@ module DossierHelper
def dossier_display_state(dossier_or_state, lower: false) def dossier_display_state(dossier_or_state, lower: false)
state = dossier_or_state.is_a?(Dossier) ? dossier_or_state.state : dossier_or_state state = dossier_or_state.is_a?(Dossier) ? dossier_or_state.state : dossier_or_state
display_state = I18n.t(state, scope: [:activerecord, :attributes, :dossier, :state]) display_state = Dossier.human_attribute_name("state.#{state}")
lower ? display_state.downcase : display_state lower ? display_state.downcase : display_state
end end

View file

@ -9,20 +9,16 @@ fr:
montant_projet: 'Le montant du projet' montant_projet: 'Le montant du projet'
montant_aide_demande: "Le montant daide demandée" montant_aide_demande: "Le montant daide demandée"
date_previsionnelle: "La date de début prévisionnelle" date_previsionnelle: "La date de début prévisionnelle"
state: &state state: "État"
brouillon: "Brouillon"
en_construction: "En construction"
en_instruction: "En instruction"
accepte: "Accepté"
refuse: "Refusé"
sans_suite: "Classé sans suite"
autorisation_donnees: Acceptation des CGU autorisation_donnees: Acceptation des CGU
state/brouillon: Brouillon dossier/state: &state
state/en_construction: En construction brouillon: "Brouillon"
state/en_instruction: En instruction en_construction: "En construction"
state/accepte: Accepté en_instruction: "En instruction"
state/refuse: Refusé accepte: "Accepté"
state/sans_suite: Sans suite refuse: "Refusé"
sans_suite: "Classé sans suite"
traitement: traitement:
state: state: "État"
<<: *state traitement/state:
<<: *state