views: explicitely marks form_with as non-remote forms

Starting from Rails 5.1, `form_with` behavior is to generate remote
forms by default.

However with Turbolinks disabled, the form gets sent, but nothing is set
up to handle the server response (like replacing the content of the
page).

So we have two choices: either enable a global config option that makes
`form_with` generate non-remote forms, or do it explicitely on each
form. I chose the explicit way, so that developers expecting the usual
remote behavior of `form_with` are not surprised.
This commit is contained in:
Pierre de La Morinerie 2020-08-04 17:48:53 +02:00
parent 1e9da059d3
commit 7708dbbc71
3 changed files with 3 additions and 3 deletions

View file

@ -18,7 +18,7 @@
.col-xs-6
%h3 Ajouter un instructeur
#procedure_new.section.section-label
= form_with url: { controller: 'admin/instructeurs', action: :create } do
= form_with url: { controller: 'admin/instructeurs', action: :create }, local: true do
.row
.col-xs-5
= render partial: 'admin/instructeurs/informations'

View file

@ -9,7 +9,7 @@
.container
%h1
= form_with model: @procedure, url: url_for({ controller: 'new_administrateur/procedures', action: :update_jeton }), html: { class: 'form' } do |f|
= form_with model: @procedure, url: url_for({ controller: 'new_administrateur/procedures', action: :update_jeton }), local: true, html: { class: 'form' } do |f|
%p.explication
Démarches Simplifiées utilise
= link_to 'API Entreprise', "https://entreprise.api.gouv.fr/"

View file

@ -1,4 +1,4 @@
= form_with model: [ :admin, service] , html: { class: 'form' } do |f|
= form_with model: [ :admin, service], local: true, html: { class: 'form' } do |f|
= f.label :nom do
Nom