demarches-normaliennes/app/models/concerns/addressable_column_concern.rb
2024-09-02 17:25:22 +02:00

44 lines
1.1 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# frozen_string_literal: true
module AddressableColumnConcern
extend ActiveSupport::Concern
included do
def columns(table:)
super.concat([
Columns::JSONPathColumn.new(
table:,
displayable: false,
column: stable_id,
label: "#{libelle} code postal (5 chiffres)",
type: :text,
value_column: ['postal_code']
),
Columns::JSONPathColumn.new(
table:,
displayable: false,
column: stable_id,
label: "#{libelle} commune",
type: :text,
value_column: ['city_name']
),
Columns::JSONPathColumn.new(
table:,
displayable: false,
column: stable_id,
label: "#{libelle} département",
type: :enum,
value_column: ['departement_code']
),
Columns::JSONPathColumn.new(
table:,
displayable: false,
column: stable_id,
label: "#{libelle} region",
type: :enum,
value_column: ['region_name']
)
])
end
end
end