Merge pull request #10864 from mfo/US/fix-export-template-with-lots-of-types-de-champs

correctif: ETQ instructeur, j'aimerais pouvoir modifier mes modèles d'export, meme sur des démarches avec beaucoup de champs
This commit is contained in:
mfo 2024-09-24 16:37:37 +00:00 committed by GitHub
commit 0cbb296e7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 8 deletions

View file

@ -11,7 +11,7 @@
.fr-grid-row.fr-grid-row--gutters
.fr-col-12.fr-col-md-8.fr-pr-4w
= form_with model: [:instructeur, procedure, export_template], data: { turbo: 'true', controller: 'autosubmit' } do |f|
= form_with model: [:instructeur, procedure, export_template], data: { turbo: 'true', controller: 'autosubmit', method: :put } do |f|
%input.hidden{ type: 'submit', formaction: preview_instructeur_procedure_export_templates_path, data: { autosubmit_target: 'submitter' }, formnovalidate: 'true', formmethod: 'get' }
= f.hidden_field :kind, value: 'zip'

View file

@ -454,7 +454,7 @@ Rails.application.routes.draw do
resources :procedures, only: [] do
resources :export_templates, only: [:new, :create, :edit, :update, :destroy] do
collection do
get 'preview'
put 'preview'
end
end
end

View file

@ -166,13 +166,15 @@ describe Instructeurs::ExportTemplatesController, type: :controller do
let(:export_template) { create(:export_template, groupe_instructeur:) }
subject { get :preview, params: { procedure_id: procedure.id, id: export_template.id, export_template: export_template_params }, format: :turbo_stream }
context 'with put request' do
subject { put :preview, params: { procedure_id: procedure.id, id: export_template.id, export_template: export_template_params }, format: :turbo_stream }
it '' do
dossier = create(:dossier, procedure: procedure, for_procedure_preview: true)
subject
expect(response.body).to include "DOSSIER_#{dossier.id}"
expect(response.body).to include "mon_export_#{dossier.id}.pdf"
it 'works with bigbig procedure' do
dossier = create(:dossier, procedure: procedure, for_procedure_preview: true)
subject
expect(response.body).to include "DOSSIER_#{dossier.id}"
expect(response.body).to include "mon_export_#{dossier.id}.pdf"
end
end
end