Merge pull request #10735 from demarches-simplifiees/go_bye_bye_virtual
Tech: retire l'attribut virtual des colonnes
This commit is contained in:
commit
44d5704af2
3 changed files with 8 additions and 8 deletions
|
@ -3,7 +3,7 @@
|
|||
class Column
|
||||
attr_reader :table, :column, :label, :classname, :type, :scope, :value_column, :filterable, :displayable
|
||||
|
||||
def initialize(table:, column:, label: nil, type: :text, value_column: :value, filterable: true, displayable: true, classname: '', scope: '', virtual: nil)
|
||||
def initialize(table:, column:, label: nil, type: :text, value_column: :value, filterable: true, displayable: true, classname: '', scope: '')
|
||||
@table = table
|
||||
@column = column
|
||||
@label = label || I18n.t(column, scope: [:activerecord, :attributes, :procedure_presentation, :fields, table])
|
||||
|
@ -13,7 +13,7 @@ class Column
|
|||
@value_column = value_column
|
||||
@filterable = filterable
|
||||
# We need this for backward compatibility
|
||||
@displayable = virtual ? false : displayable
|
||||
@displayable = displayable
|
||||
end
|
||||
|
||||
def id
|
||||
|
|
|
@ -8,7 +8,7 @@ module AddressableColumnConcern
|
|||
super.concat([
|
||||
Columns::JSONPathColumn.new(
|
||||
table:,
|
||||
virtual: true,
|
||||
displayable: false,
|
||||
column: stable_id,
|
||||
label: "#{libelle} – code postal (5 chiffres)",
|
||||
type: :text,
|
||||
|
@ -16,7 +16,7 @@ module AddressableColumnConcern
|
|||
),
|
||||
Columns::JSONPathColumn.new(
|
||||
table:,
|
||||
virtual: true,
|
||||
displayable: false,
|
||||
column: stable_id,
|
||||
label: "#{libelle} – commune",
|
||||
type: :text,
|
||||
|
@ -24,7 +24,7 @@ module AddressableColumnConcern
|
|||
),
|
||||
Columns::JSONPathColumn.new(
|
||||
table:,
|
||||
virtual: true,
|
||||
displayable: false,
|
||||
column: stable_id,
|
||||
label: "#{libelle} – département",
|
||||
type: :enum,
|
||||
|
@ -32,7 +32,7 @@ module AddressableColumnConcern
|
|||
),
|
||||
Columns::JSONPathColumn.new(
|
||||
table:,
|
||||
virtual: true,
|
||||
displayable: false,
|
||||
column: stable_id,
|
||||
label: "#{libelle} – region",
|
||||
type: :enum,
|
||||
|
|
|
@ -22,12 +22,12 @@ module ColumnsConcern
|
|||
dates = ['created_at', 'updated_at', 'depose_at', 'en_construction_at', 'en_instruction_at', 'processed_at']
|
||||
.map { |column| Column.new(table: 'self', column:, type: :date) }
|
||||
|
||||
virtual_dates = ['updated_since', 'depose_since', 'en_construction_since', 'en_instruction_since', 'processed_since']
|
||||
non_displayable_dates = ['updated_since', 'depose_since', 'en_construction_since', 'en_instruction_since', 'processed_since']
|
||||
.map { |column| Column.new(table: 'self', column:, type: :date, displayable: false) }
|
||||
|
||||
states = [Column.new(table: 'self', column: 'state', type: :enum, scope: 'instructeurs.dossiers.filterable_state', displayable: false)]
|
||||
|
||||
[common, dates, sva_svr_columns(for_filters: true), virtual_dates, states].flatten.compact
|
||||
[common, dates, sva_svr_columns(for_filters: true), non_displayable_dates, states].flatten.compact
|
||||
end
|
||||
|
||||
def sva_svr_columns(for_filters: false)
|
||||
|
|
Loading…
Reference in a new issue