From e2bc45dc4a92ae3ed805ecfded2eff0f101b3f72 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 6 Nov 2024 16:24:29 +0100 Subject: [PATCH] inject dossier_state at build time --- .../instructeurs/column_filter_value_component.rb | 4 +--- app/models/concerns/columns_concern.rb | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/components/instructeurs/column_filter_value_component.rb b/app/components/instructeurs/column_filter_value_component.rb index cc1d15485..3a313b087 100644 --- a/app/components/instructeurs/column_filter_value_component.rb +++ b/app/components/instructeurs/column_filter_value_component.rb @@ -46,9 +46,7 @@ class Instructeurs::ColumnFilterValueComponent < ApplicationComponent end def options_for_select_of_column - if column.scope.present? - I18n.t(column.scope).map(&:to_a).map(&:reverse) - elsif column.groupe_instructeur? + if column.groupe_instructeur? current_instructeur.groupe_instructeurs.filter_map do if _1.procedure_id == procedure_id [_1.label, _1.id] diff --git a/app/models/concerns/columns_concern.rb b/app/models/concerns/columns_concern.rb index 6a269c21e..8ce24202f 100644 --- a/app/models/concerns/columns_concern.rb +++ b/app/models/concerns/columns_concern.rb @@ -53,7 +53,11 @@ module ColumnsConcern def dossier_id_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'id', type: :number) - def dossier_state_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'state', type: :enum, scope: 'instructeurs.dossiers.filterable_state', displayable: false) + def dossier_state_column + options_for_select = I18n.t('instructeurs.dossiers.filterable_state').map(&:to_a).map(&:reverse) + + Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'state', type: :enum, options_for_select:, displayable: false) + end def notifications_column = Columns::DossierColumn.new(procedure_id: id, table: 'notifications', column: 'notifications', label: "notifications", filterable: false)