demarches-normaliennes/app/models/concerns/addressable_column_concern.rb

27 lines
719 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module AddressableColumnConcern
extend ActiveSupport::Concern
included do
2024-10-07 21:46:59 +02:00
def columns(procedure_id:, displayable: true, prefix: nil)
super.concat([
["code postal (5 chiffres)", '$.postal_code', :text],
["commune", '$.city_name', :text],
["département", '$.departement_code', :enum],
["region", '$.region_name', :enum]
].map do |(label, jsonpath, type)|
Columns::JSONPathColumn.new(
2024-10-07 21:46:59 +02:00
procedure_id:,
stable_id:,
2024-11-04 16:34:00 +01:00
tdc_type: type_champ,
label: "#{libelle_with_prefix(prefix)} #{label}",
jsonpath:,
displayable:,
type:
)
end)
end
end
end