introduce tdc_type
This commit is contained in:
parent
52aaff5ffc
commit
ea57a97c06
8 changed files with 16 additions and 6 deletions
|
@ -3,8 +3,9 @@
|
|||
class Columns::ChampColumn < Column
|
||||
attr_reader :stable_id
|
||||
|
||||
def initialize(procedure_id:, label:, stable_id:, displayable: true, filterable: true, type: :text, value_column: :value)
|
||||
def initialize(procedure_id:, label:, stable_id:, tdc_type:, displayable: true, filterable: true, type: :text, value_column: :value)
|
||||
@stable_id = stable_id
|
||||
@tdc_type = tdc_type
|
||||
|
||||
super(
|
||||
procedure_id:,
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
class Columns::JSONPathColumn < Columns::ChampColumn
|
||||
attr_reader :jsonpath
|
||||
|
||||
def initialize(procedure_id:, label:, stable_id:, jsonpath:, displayable:, type: :text)
|
||||
def initialize(procedure_id:, label:, stable_id:, tdc_type:, jsonpath:, displayable:, type: :text)
|
||||
@jsonpath = quote_string(jsonpath)
|
||||
|
||||
super(
|
||||
procedure_id:,
|
||||
label:,
|
||||
stable_id:,
|
||||
tdc_type:,
|
||||
displayable:,
|
||||
type:
|
||||
)
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
class Columns::LinkedDropDownColumn < Columns::ChampColumn
|
||||
attr_reader :path
|
||||
|
||||
def initialize(procedure_id:, label:, stable_id:, path:, displayable:, type: :text)
|
||||
def initialize(procedure_id:, label:, stable_id:, tdc_type:, path:, displayable:, type: :text)
|
||||
@path = path
|
||||
|
||||
super(
|
||||
procedure_id:,
|
||||
label:,
|
||||
stable_id:,
|
||||
tdc_type:,
|
||||
displayable:,
|
||||
type:
|
||||
)
|
||||
|
|
|
@ -14,6 +14,7 @@ module AddressableColumnConcern
|
|||
Columns::JSONPathColumn.new(
|
||||
procedure_id:,
|
||||
stable_id:,
|
||||
tdc_type: type_champ,
|
||||
label: "#{libelle_with_prefix(prefix)} – #{label}",
|
||||
jsonpath:,
|
||||
displayable:,
|
||||
|
|
|
@ -76,7 +76,8 @@ class TypesDeChamp::LinkedDropDownListTypeDeChamp < TypesDeChamp::TypeDeChampBas
|
|||
Columns::LinkedDropDownColumn.new(
|
||||
procedure_id:,
|
||||
label: libelle_with_prefix(prefix),
|
||||
stable_id: stable_id,
|
||||
stable_id:,
|
||||
tdc_type: type_champ,
|
||||
type: :text,
|
||||
path: :value,
|
||||
displayable:
|
||||
|
@ -84,6 +85,7 @@ class TypesDeChamp::LinkedDropDownListTypeDeChamp < TypesDeChamp::TypeDeChampBas
|
|||
Columns::LinkedDropDownColumn.new(
|
||||
procedure_id:,
|
||||
stable_id:,
|
||||
tdc_type: type_champ,
|
||||
label: "#{libelle_with_prefix(prefix)} (Primaire)",
|
||||
type: :enum,
|
||||
path: :primary,
|
||||
|
@ -92,6 +94,7 @@ class TypesDeChamp::LinkedDropDownListTypeDeChamp < TypesDeChamp::TypeDeChampBas
|
|||
Columns::LinkedDropDownColumn.new(
|
||||
procedure_id:,
|
||||
stable_id:,
|
||||
tdc_type: type_champ,
|
||||
label: "#{libelle_with_prefix(prefix)} (Secondaire)",
|
||||
type: :enum,
|
||||
path: :secondary,
|
||||
|
|
|
@ -29,6 +29,7 @@ class TypesDeChamp::TitreIdentiteTypeDeChamp < TypesDeChamp::TypeDeChampBase
|
|||
Columns::TitreIdentiteColumn.new(
|
||||
procedure_id:,
|
||||
stable_id:,
|
||||
tdc_type: type_champ,
|
||||
label: libelle_with_prefix(prefix),
|
||||
type: TypeDeChamp.column_type(type_champ),
|
||||
value_column: TypeDeChamp.value_column(type_champ),
|
||||
|
|
|
@ -100,7 +100,8 @@ class TypesDeChamp::TypeDeChampBase
|
|||
[
|
||||
Columns::ChampColumn.new(
|
||||
procedure_id:,
|
||||
stable_id: stable_id,
|
||||
stable_id:,
|
||||
tdc_type: type_champ,
|
||||
label: libelle_with_prefix(prefix),
|
||||
type: TypeDeChamp.column_type(type_champ),
|
||||
value_column: TypeDeChamp.value_column(type_champ),
|
||||
|
|
|
@ -5,7 +5,8 @@ describe Columns::JSONPathColumn do
|
|||
let(:dossier) { create(:dossier, procedure:) }
|
||||
let(:champ) { dossier.champs.first }
|
||||
let(:stable_id) { champ.stable_id }
|
||||
let(:column) { described_class.new(procedure_id: procedure.id, label: 'label', stable_id:, jsonpath:, displayable: true) }
|
||||
let(:tdc_type) { champ.type_champ }
|
||||
let(:column) { described_class.new(procedure_id: procedure.id, label: 'label', stable_id:, tdc_type:, jsonpath:, displayable: true) }
|
||||
|
||||
describe '#value' do
|
||||
let(:jsonpath) { '$.city_name' }
|
||||
|
|
Loading…
Reference in a new issue