form: remove the "Delete draft" button

Draft can now be deleted from the dossiers list. This is the best place
to delete it (as it allow to clean the list) – and it is better than
asking the user if they want to delete a draft *precisely while they
are filling the form*.
This commit is contained in:
Pierre de La Morinerie 2019-01-24 15:30:41 +00:00
parent ac4d084463
commit 934368616c
4 changed files with 5 additions and 26 deletions

View file

@ -311,8 +311,9 @@
margin-left: $default-spacer;
}
.button.danger {
margin-right: auto;
// If there are more than one button, align the "Send" button to the right
.button:not(:first-of-type).send {
margin-left: auto;
}
}
@ -321,8 +322,7 @@
flex-direction: column-reverse;
align-items: center;
.button,
.button.danger {
.button {
width: 100%;
max-width: 350px;
line-height: 30px;

View file

@ -40,7 +40,7 @@
%input{ type: "password", value: "12345678" }
.send-wrapper
= f.submit 'Enregistrer un brouillon (formnovalidate)', formnovalidate: true, class: 'button send'
= f.submit 'Envoyer', class: 'button send'
= f.submit 'Envoyer', class: 'button send primary'
%hr

View file

@ -70,13 +70,6 @@
- if !apercu
.send-wrapper
- if dossier.brouillon?
- if current_user.owns?(dossier)
= link_to ask_deletion_dossier_path(dossier),
method: :post,
class: 'button danger',
data: { disable: true, confirm: "En continuant, vous allez supprimer ce dossier ainsi que les informations quil contient. Toute suppression entraine lannulation de la démarche en cours.\n\nConfirmer la suppression ?" } do
Supprimer le brouillon
= f.button 'Enregistrer le brouillon',
formnovalidate: true,
name: :save_draft,

View file

@ -112,20 +112,6 @@ feature 'The user' do
expect(page).to have_current_path(merci_dossier_path(user_dossier))
end
scenario 'delete a draft', js: true do
log_in(user.email, password, simple_procedure)
fill_individual
page.accept_alert('Confirmer la suppression ?') do
click_on 'Supprimer le brouillon'
end
expect(page).to have_current_path(dossiers_path)
expect(page).to have_text('Votre dossier a bien été supprimé')
expect(page).not_to have_text(user_dossier.procedure.libelle)
expect(user_dossier.reload.hidden_at).to be_present
end
private
def log_in(email, password, procedure)