2024-04-29 00:17:15 +02:00
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-07-22 14:58:16 +02:00
|
|
|
|
module AddressableColumnConcern
|
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
|
|
included do
|
|
|
|
|
def columns(table:)
|
|
|
|
|
super.concat([
|
|
|
|
|
Columns::JSONPathColumn.new(
|
|
|
|
|
table:,
|
2024-09-02 17:22:48 +02:00
|
|
|
|
displayable: false,
|
2024-07-22 14:58:16 +02:00
|
|
|
|
column: stable_id,
|
|
|
|
|
label: "#{libelle} – code postal (5 chiffres)",
|
|
|
|
|
type: :text,
|
|
|
|
|
value_column: ['postal_code']
|
|
|
|
|
),
|
|
|
|
|
Columns::JSONPathColumn.new(
|
|
|
|
|
table:,
|
2024-09-02 17:22:48 +02:00
|
|
|
|
displayable: false,
|
2024-07-22 14:58:16 +02:00
|
|
|
|
column: stable_id,
|
|
|
|
|
label: "#{libelle} – commune",
|
|
|
|
|
type: :text,
|
|
|
|
|
value_column: ['city_name']
|
|
|
|
|
),
|
|
|
|
|
Columns::JSONPathColumn.new(
|
|
|
|
|
table:,
|
2024-09-02 17:22:48 +02:00
|
|
|
|
displayable: false,
|
2024-07-22 14:58:16 +02:00
|
|
|
|
column: stable_id,
|
|
|
|
|
label: "#{libelle} – département",
|
|
|
|
|
type: :enum,
|
|
|
|
|
value_column: ['departement_code']
|
|
|
|
|
),
|
|
|
|
|
Columns::JSONPathColumn.new(
|
|
|
|
|
table:,
|
2024-09-02 17:22:48 +02:00
|
|
|
|
displayable: false,
|
2024-07-22 14:58:16 +02:00
|
|
|
|
column: stable_id,
|
2024-09-10 12:29:53 +02:00
|
|
|
|
label: "#{libelle} – région",
|
2024-07-22 14:58:16 +02:00
|
|
|
|
type: :enum,
|
|
|
|
|
value_column: ['region_name']
|
|
|
|
|
)
|
|
|
|
|
])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|