Add confirm popup on important actions

This commit is contained in:
Mathieu Magnin 2017-03-09 16:55:47 +01:00
parent 48d12cfa34
commit ad1250af6f
5 changed files with 20 additions and 18 deletions

View file

@ -14,5 +14,5 @@
.col-xs-3
= form_tag invites_dossier_path(dossier_id: @facade.dossier.id), method: :post, class: 'form-inline' do
= text_field_tag :email, '', class: 'form-control', placeholder: 'Envoyer une invitation'
= submit_tag 'Ajouter', class: 'btn btn-success', id: 'send-invitation'
= submit_tag 'Ajouter', class: 'btn btn-success', id: 'send-invitation', data: {confirm: "Envoyer l'invitation ?"}

View file

@ -5,19 +5,21 @@
#action-block
- if gestionnaire_signed_in?
- if !@facade.dossier.read_only? || @facade.dossier.initiated?
= link_to 'Passer en instruction', backoffice_dossier_receive_path(@facade.dossier), method: :post, class: 'btn btn-danger btn-block'
= link_to 'Passer en instruction', backoffice_dossier_receive_path(@facade.dossier), method: :post, class: 'btn btn-danger btn-block', data: { confirm: "Confirmer vous le passage en instruction de ce dossier ?" }
- elsif @facade.dossier.received?
= form_tag(url_for({controller: 'backoffice/dossiers', action: :close, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Accepter') do
%button.action.close-dossier
%ul.list-inline
%li
= link_to url_for({controller: 'backoffice/dossiers', action: :close, dossier_id: @facade.dossier.id}), class: 'btn btn-success', method: :post, title: 'Accepter', data: { toggle: :tooltip, confirm: "Accepter ce dossier ?" } do
%i.fa.fa-check
= form_tag(url_for({controller: 'backoffice/dossiers', action: :without_continuation, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Classer sans suite') do
%button.action.forget-dossier
%li
= link_to url_for({controller: 'backoffice/dossiers', action: :without_continuation, dossier_id: @facade.dossier.id}), class: 'btn btn-warning', method: :post, title: 'Classer sans suite', data: { toggle: :tooltip, confirm: "Classer sans suite ce dossier ?" } do
%i.fa.fa-circle-o
= form_tag(url_for({controller: 'backoffice/dossiers', action: :refuse, dossier_id: @facade.dossier.id}), class: 'form-inline action_button', method: 'POST', style: 'display:inline', 'data-toggle' => :tooltip, title: 'Refuser') do
%button.action.refuse-dossier
%li
= link_to url_for({controller: 'backoffice/dossiers', action: :refuse, dossier_id: @facade.dossier.id}), class: 'btn btn-danger', method: :post, title: 'Refuser', data: { toggle: :tooltip, confirm: "Refuser ce dossier ?" } do
%i.fa.fa-times
= link_to 'Reouvrir', backoffice_dossier_reopen_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
= link_to 'Reouvrir', backoffice_dossier_reopen_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block', data: { confirm: "Confirmer vous la réouverture de ce dossier ?" }
%hr
- if @facade.dossier.archived?
@ -26,7 +28,7 @@
= link_to 'Désarchiver', unarchive_backoffice_dossier_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
- else
= link_to 'Archiver', archive_backoffice_dossier_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block'
= link_to 'Archiver', archive_backoffice_dossier_path(@facade.dossier), method: :post, class: 'btn btn-default btn-block', data: { confirm: "Confirmer vous l'archivage de ce dossier ?" }

View file

@ -38,4 +38,4 @@
%li
= form_tag invites_dossier_path(dossier_id: @facade.dossier.id), method: :post, class: 'form-inline', id: 'send-invitation' do
= text_field_tag :email, '', class: 'form-control', placeholder: 'Envoyer une invitation', id: 'invitation-email'
= submit_tag 'Ajouter', class: 'btn btn-success'
= submit_tag 'Ajouter', class: 'btn btn-success', data: {confirm: "Envoyer l'invitation ?"}

View file

@ -28,4 +28,4 @@
%li
= form_tag invites_dossier_path(dossier_id: @facade.dossier.id), method: :post, class: 'form-inline', id: 'send-invitation' do
= text_field_tag :email, '', class: 'form-control', placeholder: 'Envoyer une invitation', id: 'invitation-email'
= submit_tag 'Ajouter', class: 'btn btn-success'
= submit_tag 'Ajouter', class: 'btn btn-success', data: {confirm: "Envoyer l'invitation ?"}

View file

@ -75,9 +75,9 @@ describe 'layouts/left_panels/_left_panel_backoffice_dossierscontroller_show.htm
it { expect(rendered).to have_content('En instruction') }
it 'button accepter / refuser / classer sans suite are present' do
expect(rendered).to have_css('form[data-toggle="tooltip"][title="Accepter"]')
expect(rendered).to have_css('form[data-toggle="tooltip"][title="Classer sans suite"]')
expect(rendered).to have_css('form[data-toggle="tooltip"][title="Refuser"]')
expect(rendered).to have_css('a[title="Accepter"]')
expect(rendered).to have_css('a[title="Classer sans suite"]')
expect(rendered).to have_css('a[title="Refuser"]')
end
end