review(pull/10591#discussion_r1818744664): extract some column builder

This commit is contained in:
mfo 2024-10-28 17:01:27 +01:00 committed by simon lehericey
parent df71c6a689
commit 8afe4374c7
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5

View file

@ -42,8 +42,8 @@ module ColumnsConcern
def all_usager_columns_for_export
common = [
dossier_id_column,
Column.new(procedure_id: id, table: 'self', column: 'user_email_for_display', filterable: false, displayable: false),
Column.new(procedure_id: id, table: 'self', column: 'user_from_france_connect?', filterable: false, displayable: false)
email_for_display_column,
france_connected_column
]
individual_or_moral_columns = for_individual? ? individual_columns : moral_columns
@ -78,6 +78,10 @@ module ColumnsConcern
Column.new(procedure_id: id, table: 'self', column: 'state', label: I18n.t('activerecord.attributes.procedure_presentation.fields.self.state'), type: :enum, scope: 'instructeurs.dossiers.filterable_state', displayable: false)
end
def email_for_display_column = Column.new(procedure_id: id, table: 'self', column: 'user_email_for_display', filterable: false, displayable: false)
def france_connected_column = Column.new(procedure_id: id, table: 'self', column: 'user_from_france_connect?', filterable: false, displayable: false)
def notifications_column
Column.new(procedure_id: id, table: 'notifications', column: 'notifications', label: "notifications", filterable: false)
end
@ -134,12 +138,12 @@ module ColumnsConcern
def standard_columns
[
email_column,
Column.new(procedure_id: id, table: 'self', column: 'user_email_for_display', filterable: false, displayable: false),
email_for_display_column,
Column.new(procedure_id: id, table: 'followers_instructeurs', column: 'email'),
Column.new(procedure_id: id, table: 'groupe_instructeur', column: 'id', type: :enum),
Column.new(procedure_id: id, table: 'avis', column: 'question_answer', filterable: false),
Column.new(procedure_id: id, table: 'user', column: 'id', filterable: false, displayable: false),
Column.new(procedure_id: id, table: 'self', column: 'user_from_france_connect?', filterable: false, displayable: false)
france_connected_column
]
end