move tdc facets builder to tdc
This commit is contained in:
parent
2a0537134d
commit
b910705353
2 changed files with 14 additions and 11 deletions
|
@ -78,16 +78,7 @@ module FacetsConcern
|
||||||
.reject { |(type_champ)| type_champ == TypeDeChamp.type_champs.fetch(:repetition) }
|
.reject { |(type_champ)| type_champ == TypeDeChamp.type_champs.fetch(:repetition) }
|
||||||
.flat_map do |(type_champ, libelle, stable_id)|
|
.flat_map do |(type_champ, libelle, stable_id)|
|
||||||
tdc = TypeDeChamp.new(type_champ:, libelle:, stable_id:)
|
tdc = TypeDeChamp.new(type_champ:, libelle:, stable_id:)
|
||||||
|
tdc.dynamic_type.facets(table: TYPE_DE_CHAMP)
|
||||||
tdc.dynamic_type.search_paths.map do |path_struct|
|
|
||||||
Facet.new(
|
|
||||||
table: TYPE_DE_CHAMP,
|
|
||||||
column: tdc.stable_id.to_s,
|
|
||||||
label: path_struct[:libelle],
|
|
||||||
type: TypeDeChamp.filter_hash_type(tdc.type_champ),
|
|
||||||
value_column: TypeDeChamp.filter_hash_value_column(type_champ)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class TypesDeChamp::TypeDeChampBase
|
class TypesDeChamp::TypeDeChampBase
|
||||||
include ActiveModel::Validations
|
include ActiveModel::Validations
|
||||||
|
|
||||||
delegate :description, :libelle, :mandatory, :mandatory?, :stable_id, :fillable?, :public?, to: :@type_de_champ
|
delegate :description, :libelle, :mandatory, :mandatory?, :stable_id, :fillable?, :public?, :type_champ, to: :@type_de_champ
|
||||||
|
|
||||||
FILL_DURATION_SHORT = 10.seconds
|
FILL_DURATION_SHORT = 10.seconds
|
||||||
FILL_DURATION_MEDIUM = 1.minute
|
FILL_DURATION_MEDIUM = 1.minute
|
||||||
|
@ -96,6 +96,18 @@ class TypesDeChamp::TypeDeChampBase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def facets(table:)
|
||||||
|
[
|
||||||
|
Facet.new(
|
||||||
|
table:,
|
||||||
|
column: stable_id.to_s,
|
||||||
|
label: libelle,
|
||||||
|
type: TypeDeChamp.filter_hash_type(type_champ),
|
||||||
|
value_column: TypeDeChamp.filter_hash_value_column(type_champ)
|
||||||
|
)
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def paths
|
def paths
|
||||||
|
|
Loading…
Reference in a new issue