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..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,31 +4,15 @@ %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 |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}") + - 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 } - %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' + - 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/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..8a445bd23 --- /dev/null +++ b/app/views/fields/types_de_champ_collection_field/_type_champ_line.html.haml @@ -0,0 +1,16 @@ +%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.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' 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 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)