Skip to content

Commit

Permalink
feat(referentiel): display referentiel columns
Browse files Browse the repository at this point in the history
  • Loading branch information
E-L-T committed Dec 20, 2024
1 parent 99f3b5b commit 69f6043
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/models/types_de_champ/drop_down_list_type_de_champ.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# frozen_string_literal: true

class TypesDeChamp::DropDownListTypeDeChamp < TypesDeChamp::TypeDeChampBase
def columns(procedure:, displayable: true, prefix: nil)
if referentiel?
referentiel.headers.map do |header|
Columns::JSONPathColumn.new(
procedure_id: procedure.id,
stable_id:,
tdc_type: type_champ,
label: "#{libelle_with_prefix(prefix)} – Référentiel #{header}",
type: :text,
jsonpath: "$.referentiel.data.#{header.parameterize.underscore}",
displayable:
)
end
else
super
end
end
end

0 comments on commit 69f6043

Please sign in to comment.