remove categories_type_de_champ feature flag

This commit is contained in:
Eric Leroy-Terquem 2022-11-03 13:29:10 +01:00
parent 5867f2cbe7
commit 09c5b9dc99
4 changed files with 17 additions and 45 deletions

View file

@ -56,32 +56,22 @@ class TypesDeChampEditor::ChampComponent < ApplicationComponent
end
def types_of_type_de_champ
if feature_enabled?(:categories_type_de_champ)
cat_scope = "activerecord.attributes.type_de_champ.categorie"
tdc_scope = "activerecord.attributes.type_de_champ.type_champs"
cat_scope = "activerecord.attributes.type_de_champ.categorie"
tdc_scope = "activerecord.attributes.type_de_champ.type_champs"
TypeDeChamp.type_champs
.keys
.filter(&method(:filter_type_champ))
.filter(&method(:filter_featured_type_champ))
.filter(&method(:filter_block_type_champ))
.group_by { TypeDeChamp::TYPE_DE_CHAMP_TO_CATEGORIE.fetch(_1.to_sym) }
.sort_by { |k, _v| TypeDeChamp::CATEGORIES.find_index(k) }
.to_h do |cat, tdc|
[
t(cat, scope: cat_scope),
tdc.map { [t(_1, scope: tdc_scope), _1] }
]
end
else
TypeDeChamp.type_champs
.keys
.filter(&method(:filter_type_champ))
.filter(&method(:filter_featured_type_champ))
.filter(&method(:filter_block_type_champ))
.map { |type_champ| [t("activerecord.attributes.type_de_champ.type_champs.#{type_champ}"), type_champ] }
.sort_by(&:first)
end
TypeDeChamp.type_champs
.keys
.filter(&method(:filter_type_champ))
.filter(&method(:filter_featured_type_champ))
.filter(&method(:filter_block_type_champ))
.group_by { TypeDeChamp::TYPE_DE_CHAMP_TO_CATEGORIE.fetch(_1.to_sym) }
.sort_by { |k, _v| TypeDeChamp::CATEGORIES.find_index(k) }
.to_h do |cat, tdc|
[
t(cat, scope: cat_scope),
tdc.map { [t(_1, scope: tdc_scope), _1] }
]
end
end
def piece_justificative_options(form)

View file

@ -19,10 +19,7 @@
%span.sr-only Déplacer le champ vers le bas
.cell.flex.justify-start.column.flex-grow
= form.label :type_champ, "Type de champ", for: dom_id(type_de_champ, :type_champ)
- if feature_enabled?(:categories_type_de_champ)
= form.select :type_champ, grouped_options_for_select(types_of_type_de_champ, type_de_champ.type_champ), {}, class: 'small-margin small inline width-100', id: dom_id(type_de_champ, :type_champ)
- else
= form.select :type_champ, types_of_type_de_champ, {}, class: 'small-margin small inline width-100', id: dom_id(type_de_champ, :type_champ)
= form.select :type_champ, grouped_options_for_select(types_of_type_de_champ, type_de_champ.type_champ), {}, class: 'small-margin small inline width-100', id: dom_id(type_de_champ, :type_champ)
.flex.column.justify-start.flex-grow
.cell
.flex.align-center