diff --git a/app/models/concerns/columns_concern.rb b/app/models/concerns/columns_concern.rb index c98a621df..2757e7e49 100644 --- a/app/models/concerns/columns_concern.rb +++ b/app/models/concerns/columns_concern.rb @@ -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 ? diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 05c7c20dc..fcb42957d 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -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