refactor(type de champ): rename routable_types in simple_routable_types
This commit is contained in:
parent
52d8f8ed00
commit
60ff785009
6 changed files with 10 additions and 10 deletions
|
@ -41,7 +41,7 @@ module Administrateurs
|
|||
@procedure = procedure
|
||||
stable_id = params[:create_simple_routing][:stable_id].to_i
|
||||
|
||||
tdc = @procedure.active_revision.routable_types_de_champ.find { |tdc| tdc.stable_id == stable_id }
|
||||
tdc = @procedure.active_revision.simple_routable_types_de_champ.find { |tdc| tdc.stable_id == stable_id }
|
||||
|
||||
case tdc.type_champ
|
||||
when TypeDeChamp.type_champs.fetch(:departements)
|
||||
|
|
|
@ -265,8 +265,8 @@ class ProcedureRevision < ApplicationRecord
|
|||
[coordinate, coordinate&.type_de_champ]
|
||||
end
|
||||
|
||||
def routable_types_de_champ
|
||||
types_de_champ_public.filter(&:routable?)
|
||||
def simple_routable_types_de_champ
|
||||
types_de_champ_public.filter(&:simple_routable?)
|
||||
end
|
||||
|
||||
def conditionable_types_de_champ
|
||||
|
|
|
@ -110,7 +110,7 @@ class TypeDeChamp < ApplicationRecord
|
|||
expression_reguliere: 'expression_reguliere'
|
||||
}
|
||||
|
||||
ROUTABLE_TYPES = [
|
||||
SIMPLE_ROUTABLE_TYPES = [
|
||||
type_champs.fetch(:drop_down_list),
|
||||
type_champs.fetch(:communes),
|
||||
type_champs.fetch(:departements),
|
||||
|
@ -652,8 +652,8 @@ class TypeDeChamp < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def routable?
|
||||
type_champ.in?(ROUTABLE_TYPES)
|
||||
def simple_routable?
|
||||
type_champ.in?(SIMPLE_ROUTABLE_TYPES)
|
||||
end
|
||||
|
||||
def conditionable?
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
%div{ data: { 'action': "click->enable-submit-if-checked#click" } }
|
||||
.notice
|
||||
Sélectionner le champ à partir duquel créer des groupes d’instructeurs
|
||||
- buttons_content = @procedure.active_revision.routable_types_de_champ.map { |tdc| { label: tdc.libelle, value: tdc.stable_id } }
|
||||
- buttons_content = @procedure.active_revision.simple_routable_types_de_champ.map { |tdc| { label: tdc.libelle, value: tdc.stable_id } }
|
||||
= render Dsfr::RadioButtonListComponent.new(form: f,
|
||||
target: :stable_id,
|
||||
buttons: buttons_content)
|
||||
|
|
|
@ -12,7 +12,7 @@ describe 're_routing_dossiers' do
|
|||
|
||||
dossier2.champs.last.update(value: 'Allier')
|
||||
|
||||
tdc = procedure.active_revision.routable_types_de_champ.first
|
||||
tdc = procedure.active_revision.simple_routable_types_de_champ.first
|
||||
|
||||
tdc_options = APIGeoService.departements.map { ["#{_1[:code]} – #{_1[:name]}", _1[:code]] }
|
||||
|
||||
|
|
|
@ -1144,7 +1144,7 @@ describe ProcedureRevision do
|
|||
}
|
||||
end
|
||||
|
||||
describe '#routable_types_de_champ' do
|
||||
describe '#simple_routable_types_de_champ' do
|
||||
let(:procedure) do
|
||||
create(:procedure, types_de_champ_public: [
|
||||
{ type: :text, libelle: 'l1' },
|
||||
|
@ -1156,6 +1156,6 @@ describe ProcedureRevision do
|
|||
])
|
||||
end
|
||||
|
||||
it { expect(draft.routable_types_de_champ.pluck(:libelle)).to eq(['l2', 'l3', 'l4', 'l5', 'l6']) }
|
||||
it { expect(draft.simple_routable_types_de_champ.pluck(:libelle)).to eq(['l2', 'l3', 'l4', 'l5', 'l6']) }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue