default default_displayed_column

This commit is contained in:
simon lehericey 2024-10-09 11:08:41 +02:00
parent 0a54db6db5
commit 14483270ba
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
2 changed files with 9 additions and 1 deletions

View file

@ -73,11 +73,17 @@ module ColumnsConcern
SortedColumn.new(column: notifications_column, order: 'desc')
end
def default_displayed_columns = [email_column]
private
def email_column
Column.new(procedure_id: id, table: 'user', column: 'email')
end
def standard_columns
[
Column.new(procedure_id: id, table: 'user', column: 'email'),
email_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) # not filterable ?

View file

@ -27,6 +27,8 @@ class ProcedurePresentation < ApplicationRecord
attribute :expirant_filters, :filtered_column, array: true
attribute :archives_filters, :filtered_column, array: true
before_create { self.displayed_columns = procedure.default_displayed_columns }
validates_associated :a_suivre_filters, :suivis_filters, :traites_filters,
:tous_filters, :supprimes_filters, :expirant_filters, :archives_filters