dossier: add an button to delete a brouillon
This commit is contained in:
parent
768537fedc
commit
0f1811dd4e
5 changed files with 38 additions and 1 deletions
|
@ -45,6 +45,18 @@
|
|||
}
|
||||
}
|
||||
|
||||
&.danger {
|
||||
color: $black;
|
||||
border-color: $border-grey;
|
||||
background-color: #FFFFFF;
|
||||
|
||||
&:hover {
|
||||
color: #FFFFFF;
|
||||
border-color: $medium-red;
|
||||
background-color: $medium-red;
|
||||
}
|
||||
}
|
||||
|
||||
&.accepted {
|
||||
color: #FFFFFF;
|
||||
border-color: $green;
|
||||
|
|
|
@ -288,6 +288,9 @@
|
|||
.button {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.button.danger {
|
||||
float:left;
|
||||
}
|
||||
}
|
||||
|
||||
.inline-champ {
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
|
||||
= link_to ".button.secondary", "#", class: "button secondary"
|
||||
|
||||
= link_to ".button.danger", "#", class: "button danger"
|
||||
|
||||
= link_to "#", class: "button" do
|
||||
%span.icon.follow
|
||||
|
|
|
@ -62,9 +62,16 @@
|
|||
= hidden_field_tag 'submit_action', 'draft'
|
||||
|
||||
- if dossier.brouillon?
|
||||
- if current_user.owns?(dossier)
|
||||
= link_to ask_deletion_dossier_path(dossier),
|
||||
method: :post,
|
||||
class: 'button danger',
|
||||
data: { 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',
|
||||
formnovalidate: true,
|
||||
class: 'button send',
|
||||
class: 'button send secondary',
|
||||
data: { action: 'draft', disable_with: 'Envoi...' }
|
||||
|
||||
- if current_user.owns?(dossier) && dossier.can_transition_to_en_construction?
|
||||
|
|
|
@ -112,6 +112,20 @@ 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)
|
||||
|
|
Loading…
Add table
Reference in a new issue