From e3ba2ed96ca6c70797964e465995222cc4ec36de Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Wed, 12 Feb 2020 13:54:44 +0100 Subject: [PATCH] Revert "form: add number to section headers" This reverts commit f42977e40a269a45a53a09e726ddb7ee825983fe. --- app/models/champs/header_section_champ.rb | 7 ----- .../editable_champs/_header_section.html.haml | 4 --- .../champs/header_section_champ_spec.rb | 26 ------------------- 3 files changed, 37 deletions(-) delete mode 100644 spec/models/champs/header_section_champ_spec.rb diff --git a/app/models/champs/header_section_champ.rb b/app/models/champs/header_section_champ.rb index 47ec93eb4..95df5d03d 100644 --- a/app/models/champs/header_section_champ.rb +++ b/app/models/champs/header_section_champ.rb @@ -2,11 +2,4 @@ class Champs::HeaderSectionChamp < Champ def search_terms # The user cannot enter any information here so it doesn’t make much sense to search end - - def section_index - dossier - .champs - .filter { |c| c.type_champ == TypeDeChamp.type_champs.fetch(:header_section) } - .index(self) + 1 - end end diff --git a/app/views/shared/dossiers/editable_champs/_header_section.html.haml b/app/views/shared/dossiers/editable_champs/_header_section.html.haml index 108300647..16c6c6c9f 100644 --- a/app/views/shared/dossiers/editable_champs/_header_section.html.haml +++ b/app/views/shared/dossiers/editable_champs/_header_section.html.haml @@ -1,6 +1,2 @@ -- section_index = champ.section_index - %h2.header-section - - if section_index - = "#{section_index}." = champ.libelle diff --git a/spec/models/champs/header_section_champ_spec.rb b/spec/models/champs/header_section_champ_spec.rb deleted file mode 100644 index 34f3a5602..000000000 --- a/spec/models/champs/header_section_champ_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'spec_helper' - -describe Champs::CheckboxChamp do - let(:types_de_champ) do - [ - create(:type_de_champ_header_section, order_place: 1), - create(:type_de_champ_civilite, order_place: 2), - create(:type_de_champ_text, order_place: 3), - create(:type_de_champ_header_section, order_place: 4), - create(:type_de_champ_email, order_place: 5) - ] - end - - let(:procedure) { create(:procedure, types_de_champ: types_de_champ) } - let(:dossier) { create(:dossier, procedure: procedure) } - - describe '#section_index' do - let(:first_header) { dossier.champs[0] } - let(:second_header) { dossier.champs[3] } - - it 'returns the index of the section (starting from 1)' do - expect(first_header.section_index).to eq 1 - expect(second_header.section_index).to eq 2 - end - end -end