From a62e9fe6d2f8e34054006bcf75fa39f1430361f5 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Fri, 7 Feb 2020 15:33:47 +0100 Subject: [PATCH 1/4] Extract type de champ line --- .../_show.html.haml | 26 +++---------------- .../_type_champ_line.html.haml | 22 ++++++++++++++++ 2 files changed, 25 insertions(+), 23 deletions(-) create mode 100644 app/views/fields/types_de_champ_collection_field/_type_champ_line.html.haml diff --git a/app/views/fields/types_de_champ_collection_field/_show.html.haml b/app/views/fields/types_de_champ_collection_field/_show.html.haml index f70d88c66..b0eda814f 100644 --- a/app/views/fields/types_de_champ_collection_field/_show.html.haml +++ b/app/views/fields/types_de_champ_collection_field/_show.html.haml @@ -7,28 +7,8 @@ %td.cell-label Rempli %td.cell-label Modifier le modèle %tbody - - field.data.order(:order_place).each do |f| - %tr - %td.cell-data - = f.libelle - - if f.mandatory? - %span.mandatory{ style: 'color: #A10005;' } * - %td.cell-data - = I18n.t("activerecord.attributes.type_de_champ.type_champs.#{f.type_champ}") - - %td.cell-data - - if f.blank? - vide - - else - rempli - - %td.cell-data - - if f.type_champ == 'piece_justificative' - = form_for f, - url: change_piece_justificative_template_manager_procedure_path, - method: :post do |form| - = form.hidden_field :id - = form.file_field :piece_justificative_template - = form.submit 'modifier' + - field.data.order(:order_place).each do |type_de_champ| + = render partial: 'fields/types_de_champ_collection_field/type_champ_line', + locals: { type_de_champ: type_de_champ } - else Aucun diff --git a/app/views/fields/types_de_champ_collection_field/_type_champ_line.html.haml b/app/views/fields/types_de_champ_collection_field/_type_champ_line.html.haml new file mode 100644 index 000000000..d7421695c --- /dev/null +++ b/app/views/fields/types_de_champ_collection_field/_type_champ_line.html.haml @@ -0,0 +1,22 @@ +%tr + %td.cell-data + = type_de_champ.libelle + - if type_de_champ.mandatory? + %span.mandatory{ style: 'color: #A10005;' } * + %td.cell-data + = I18n.t("activerecord.attributes.type_de_champ.type_champs.#{type_de_champ.type_champ}") + + %td.cell-data + - if type_de_champ.blank? + vide + - else + rempli + + %td.cell-data + - if type_de_champ.type_champ == 'piece_justificative' + = form_for type_de_champ, + url: change_piece_justificative_template_manager_procedure_path, + method: :post do |form| + = form.hidden_field :id + = form.file_field :piece_justificative_template + = form.submit 'modifier' From 4f317e84d1e6cf7a83ebd0ef970705f90040e7cb Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Fri, 7 Feb 2020 15:35:09 +0100 Subject: [PATCH 2/4] Iterate over type_de_champ in repetition type_de_champ --- .../_show.html.haml | 5 +++++ .../manager/procedures_controller_spec.rb | 14 ++++++++++++++ spec/factories/procedure.rb | 9 +++++++++ 3 files changed, 28 insertions(+) diff --git a/app/views/fields/types_de_champ_collection_field/_show.html.haml b/app/views/fields/types_de_champ_collection_field/_show.html.haml index b0eda814f..772095b4e 100644 --- a/app/views/fields/types_de_champ_collection_field/_show.html.haml +++ b/app/views/fields/types_de_champ_collection_field/_show.html.haml @@ -10,5 +10,10 @@ - field.data.order(:order_place).each do |type_de_champ| = render partial: 'fields/types_de_champ_collection_field/type_champ_line', locals: { type_de_champ: type_de_champ } + + - if type_de_champ.type_champ == 'repetition' + - type_de_champ.types_de_champ.each do |sub_champ| + = render partial: 'fields/types_de_champ_collection_field/type_champ_line', + locals: { type_de_champ: sub_champ } - else Aucun diff --git a/spec/controllers/manager/procedures_controller_spec.rb b/spec/controllers/manager/procedures_controller_spec.rb index e4cd1ec45..b546a93e6 100644 --- a/spec/controllers/manager/procedures_controller_spec.rb +++ b/spec/controllers/manager/procedures_controller_spec.rb @@ -11,4 +11,18 @@ describe Manager::ProceduresController, type: :controller do it { expect(procedure.whitelisted_at).not_to be_nil } end + + describe '#show' do + render_views + + let(:administration) { create(:administration) } + let!(:procedure) { create(:procedure, :with_repetition) } + + before do + sign_in(administration) + get :show, params: { id: procedure.id } + end + + it { expect(response.body).to include('sub type de champ') } + end end diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb index c15af065d..e233f0503 100644 --- a/spec/factories/procedure.rb +++ b/spec/factories/procedure.rb @@ -153,6 +153,15 @@ FactoryBot.define do end end + trait :with_repetition do + after(:build) do |procedure, _evaluator| + type_de_champ = create(:type_de_champ_repetition) + procedure.types_de_champ << type_de_champ + + type_de_champ.types_de_champ << create(:type_de_champ, libelle: 'sub type de champ') + end + end + trait :published do after(:build) do |procedure, _evaluator| procedure.path = generate(:published_path) From 90113f1a226a308758c6972f2f9640f3bb56ebd9 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Fri, 7 Feb 2020 15:37:30 +0100 Subject: [PATCH 3/4] Remove Rempli column for type de champ --- .../fields/types_de_champ_collection_field/_show.html.haml | 1 - .../_type_champ_line.html.haml | 6 ------ 2 files changed, 7 deletions(-) diff --git a/app/views/fields/types_de_champ_collection_field/_show.html.haml b/app/views/fields/types_de_champ_collection_field/_show.html.haml index 772095b4e..f7327d76e 100644 --- a/app/views/fields/types_de_champ_collection_field/_show.html.haml +++ b/app/views/fields/types_de_champ_collection_field/_show.html.haml @@ -4,7 +4,6 @@ %tr %td.cell-label Libelle %td.cell-label Type de champ - %td.cell-label Rempli %td.cell-label Modifier le modèle %tbody - field.data.order(:order_place).each do |type_de_champ| diff --git a/app/views/fields/types_de_champ_collection_field/_type_champ_line.html.haml b/app/views/fields/types_de_champ_collection_field/_type_champ_line.html.haml index d7421695c..8a445bd23 100644 --- a/app/views/fields/types_de_champ_collection_field/_type_champ_line.html.haml +++ b/app/views/fields/types_de_champ_collection_field/_type_champ_line.html.haml @@ -6,12 +6,6 @@ %td.cell-data = I18n.t("activerecord.attributes.type_de_champ.type_champs.#{type_de_champ.type_champ}") - %td.cell-data - - if type_de_champ.blank? - vide - - else - rempli - %td.cell-data - if type_de_champ.type_champ == 'piece_justificative' = form_for type_de_champ, From 7b57a806e91bca8040a3f22183c80f3c577a4efb Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 11 Feb 2020 15:35:42 +0100 Subject: [PATCH 4/4] support: hint about the suggestions board on feature-upvote --- app/views/support/index.html.haml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/views/support/index.html.haml b/app/views/support/index.html.haml index 20c89a6e3..02dfa31c9 100644 --- a/app/views/support/index.html.haml +++ b/app/views/support/index.html.haml @@ -18,9 +18,9 @@ .contact-champ = label_tag :type do - Votre problème + Votre question %span.mandatory * - = select_tag :type, options_for_select(@options, params[:type]), include_blank: "Choisir un problème", required: true + = select_tag :type, options_for_select(@options, params[:type]), include_blank: "Choisir une question", required: true .support.card.featured.hidden{ data: { 'contact-type-only': Helpscout::FormAdapter::TYPE_INFO } } .card-title @@ -53,6 +53,24 @@ %br %p Si vous souhaitez poser une question pour un problème technique sur le site, utilisez le formulaire ci-dessous. Nous ne pourrons pas vous renseigner sur l'instruction de votre dossier. + .support.card.featured.hidden{ data: { 'contact-type-only': Helpscout::FormAdapter::TYPE_AMELIORATION } } + .card-title + 👉 Notre réponse + %p + Une idée ? Pensez à consulter notre + = succeed ' !' do + %strong + tableau de bord des améliorations + %p + %ul + %li • Votez pour vos améliorations prioritaires ; + %li • Proposez votre propre idée. + + %p + %strong + %a{ href: 'https://demarches-simplifiees.featureupvote.com' } + ➡ Accéder au tableau des améliorations + .contact-champ = label_tag :dossier_id, 'Numéro du dossier concerné' = text_field_tag :dossier_id, @dossier_id