style(instructeurs): human/i18n value for state filter
This commit is contained in:
parent
7ff6455440
commit
7ff04c1a05
2 changed files with 11 additions and 2 deletions
|
@ -233,9 +233,10 @@ class ProcedurePresentation < ApplicationRecord
|
|||
end
|
||||
|
||||
def human_value_for_filter(filter)
|
||||
case filter[TABLE]
|
||||
when TYPE_DE_CHAMP, TYPE_DE_CHAMP_PRIVATE
|
||||
if [TYPE_DE_CHAMP, TYPE_DE_CHAMP_PRIVATE].include?(filter[TABLE])
|
||||
find_type_de_champ(filter[COLUMN]).dynamic_type.filter_to_human(filter['value'])
|
||||
elsif filter['column'] == 'state'
|
||||
Dossier.human_attribute_name("state.#{filter['value']}")
|
||||
else
|
||||
filter['value']
|
||||
end
|
||||
|
|
|
@ -784,6 +784,14 @@ describe ProcedurePresentation do
|
|||
expect(subject).to eq("oui")
|
||||
end
|
||||
end
|
||||
|
||||
context 'when filter is state' do
|
||||
let(:filters) { { "suivis" => [{ "table" => "self", "column" => "state", "value" => "en_construction" }] } }
|
||||
|
||||
it 'should get i18n value' do
|
||||
expect(subject).to eq("En construction")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#add_filter" do
|
||||
|
|
Loading…
Reference in a new issue