Merge pull request #3331 from betagouv/improve-send-buttons
brouillon: remove the "Delete draft" button
This commit is contained in:
commit
4de069d436
6 changed files with 12 additions and 33 deletions
|
@ -311,8 +311,9 @@
|
||||||
margin-left: $default-spacer;
|
margin-left: $default-spacer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button.danger {
|
// If there are more than one button, align the "Send" button to the right
|
||||||
margin-right: auto;
|
.button:not(:first-of-type).send {
|
||||||
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,8 +322,7 @@
|
||||||
flex-direction: column-reverse;
|
flex-direction: column-reverse;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.button,
|
.button {
|
||||||
.button.danger {
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 350px;
|
max-width: 350px;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
= dossier.updated_at.strftime("%d/%m/%Y")
|
= dossier.updated_at.strftime("%d/%m/%Y")
|
||||||
%td.action-col.delete-col
|
%td.action-col.delete-col
|
||||||
- if dossier.brouillon?
|
- if dossier.brouillon?
|
||||||
= 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 qu’il contient. Toute suppression entraine l’annulation de la démarche en cours.\n\nConfirmer la suppression ?" }) do
|
= 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 qu’il contient. Toute suppression entraine l’annulation de la démarche en cours.\n\nConfirmer la suppression ?" }) do
|
||||||
%span.icon.delete
|
%span.icon.delete
|
||||||
Supprimer
|
Supprimer
|
||||||
= paginate(@dossiers)
|
= paginate(@dossiers)
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
%input{ type: "password", value: "12345678" }
|
%input{ type: "password", value: "12345678" }
|
||||||
.send-wrapper
|
.send-wrapper
|
||||||
= f.submit 'Enregistrer un brouillon (formnovalidate)', formnovalidate: true, class: 'button send'
|
= 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
|
%hr
|
||||||
|
|
||||||
|
|
|
@ -70,13 +70,6 @@
|
||||||
- if !apercu
|
- if !apercu
|
||||||
.send-wrapper
|
.send-wrapper
|
||||||
- if dossier.brouillon?
|
- 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 qu’il contient. Toute suppression entraine l’annulation de la démarche en cours.\n\nConfirmer la suppression ?" } do
|
|
||||||
Supprimer le brouillon
|
|
||||||
|
|
||||||
= f.button 'Enregistrer le brouillon',
|
= f.button 'Enregistrer le brouillon',
|
||||||
formnovalidate: true,
|
formnovalidate: true,
|
||||||
name: :save_draft,
|
name: :save_draft,
|
||||||
|
|
|
@ -112,20 +112,6 @@ feature 'The user' do
|
||||||
expect(page).to have_current_path(merci_dossier_path(user_dossier))
|
expect(page).to have_current_path(merci_dossier_path(user_dossier))
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
def log_in(email, password, procedure)
|
def log_in(email, password, procedure)
|
||||||
|
|
|
@ -49,13 +49,13 @@ describe 'user access to the list of his dossier' do
|
||||||
expect(page).not_to have_link(nil, href: ask_deletion_dossier_path(dossier1))
|
expect(page).not_to have_link(nil, href: ask_deletion_dossier_path(dossier1))
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user clicks on delete brouillon list', js: true do
|
context 'when user clicks on delete brouillon', js: true do
|
||||||
before do
|
|
||||||
find(:xpath, "//a[@href='#{ask_deletion_dossier_path(dossier_brouillon)}']").click
|
|
||||||
page.driver.browser.switch_to.alert.accept
|
|
||||||
end
|
|
||||||
scenario 'dossier is deleted' do
|
scenario 'dossier is deleted' do
|
||||||
expect(page).not_to have_link("Supprimer", href: dossier_brouillon.procedure.libelle)
|
page.accept_alert('Confirmer la suppression ?') do
|
||||||
|
find(:xpath, "//a[@href='#{ask_deletion_dossier_path(dossier_brouillon)}']").click
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(page).to have_content('Votre dossier a bien été supprimé.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue