Merge pull request #2295 from betagouv/delete-brouillon
Supprimer un brouillon
This commit is contained in:
commit
58a2bff733
5 changed files with 76 additions and 4 deletions
|
@ -11,6 +11,7 @@
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
color: $black;
|
color: $black;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
text-align: center;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -44,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 {
|
&.accepted {
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
border-color: $green;
|
border-color: $green;
|
||||||
|
|
|
@ -281,13 +281,44 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.send-wrapper {
|
.send-wrapper {
|
||||||
text-align: right;
|
display: flex;
|
||||||
margin-top: 2 * $default-padding;
|
width: 100%;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: $default-padding;
|
||||||
margin-bottom: 2 * $default-padding;
|
margin-bottom: 2 * $default-padding;
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
|
margin-top: $default-padding;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wide layout: align buttons on a single row
|
||||||
|
@media (min-width: 550px) {
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
.button:not(:first-of-type) {
|
||||||
|
margin-left: $default-spacer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button.danger {
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Narrow layout: stack buttons vertically
|
||||||
|
@media (max-width: 550px) {
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.button,
|
||||||
|
.button.danger {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 350px;
|
||||||
|
line-height: 30px;
|
||||||
|
margin-left: none;
|
||||||
|
margin-right: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-champ {
|
.inline-champ {
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
= link_to ".button.secondary", "#", class: "button secondary"
|
= link_to ".button.secondary", "#", class: "button secondary"
|
||||||
|
|
||||||
= link_to ".button.accepted", "#", class: "button accepted"
|
= link_to ".button.danger", "#", class: "button danger"
|
||||||
|
|
||||||
= link_to "#", class: "button" do
|
= link_to "#", class: "button" do
|
||||||
%span.icon.follow
|
%span.icon.follow
|
||||||
|
@ -58,6 +58,13 @@
|
||||||
= link_to "#", class: "button icon-only" do
|
= link_to "#", class: "button icon-only" do
|
||||||
%span.icon.follow
|
%span.icon.follow
|
||||||
|
|
||||||
|
%p
|
||||||
|
= link_to ".button.accepted", "#", class: "button accepted"
|
||||||
|
|
||||||
|
= link_to ".button.refused", "#", class: "button refused"
|
||||||
|
|
||||||
|
= link_to ".button.without-continuation", "#", class: "button without-continuation"
|
||||||
|
|
||||||
%p
|
%p
|
||||||
= link_to ".button.large", "#", class: "button large"
|
= link_to ".button.large", "#", class: "button large"
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,16 @@
|
||||||
= hidden_field_tag 'submit_action', 'draft'
|
= hidden_field_tag 'submit_action', 'draft'
|
||||||
|
|
||||||
- if dossier.brouillon?
|
- 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',
|
= f.button 'Enregistrer le brouillon',
|
||||||
formnovalidate: true,
|
formnovalidate: true,
|
||||||
class: 'button send',
|
class: 'button send secondary',
|
||||||
data: { action: 'draft', disable_with: 'Envoi...' }
|
data: { action: 'draft', disable_with: 'Envoi...' }
|
||||||
|
|
||||||
- if current_user.owns?(dossier) && dossier.can_transition_to_en_construction?
|
- 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))
|
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)
|
||||||
|
|
Loading…
Reference in a new issue