[Fix #430] Add delete procedure button
This commit is contained in:
parent
be3304f71e
commit
70c7c42e1f
3 changed files with 29 additions and 0 deletions
|
@ -42,6 +42,14 @@ class Admin::ProceduresController < AdminController
|
|||
def edit
|
||||
end
|
||||
|
||||
def hide
|
||||
procedure = Procedure.find(params[:id])
|
||||
procedure.hide!
|
||||
|
||||
flash.notice = "Procédure supprimée, en cas d'erreur contactez nous : contact@tps.apientreprise.fr"
|
||||
redirect_to admin_procedures_draft_path
|
||||
end
|
||||
|
||||
def destroy
|
||||
procedure = Procedure.find(params[:id])
|
||||
|
||||
|
|
|
@ -129,3 +129,20 @@
|
|||
Aucune statistique pour le moment
|
||||
- else
|
||||
= pie_chart @facade.dossiers_for_pie_highchart
|
||||
|
||||
- if @facade.procedure.published? || @facade.procedure.archived?
|
||||
%h3 Supprimer la procédure
|
||||
.alert.alert-danger
|
||||
%p
|
||||
Attention : la suppression d'une procédure est définitive.
|
||||
- dossiers_count = @facade.procedure.dossiers.count
|
||||
- if dossiers_count > 0
|
||||
%p
|
||||
= pluralize(dossiers_count, "dossier est rattaché", "dossiers sont rattachés")
|
||||
à cette procédure, la suppression de cette procédure entrainera également leur suppression.
|
||||
%p.text-right
|
||||
= link_to "J'ai compris, je supprime la procédure",
|
||||
hide_admin_procedure_path(@facade.procedure),
|
||||
method: :post,
|
||||
class: "btn btn-danger",
|
||||
data: { confirm: "Voulez-vous supprimer la procédure ?", disable_with: "Suppression..." }
|
||||
|
|
|
@ -114,6 +114,10 @@ Rails.application.routes.draw do
|
|||
patch 'change_dossier_state' => 'change_dossier_state#change'
|
||||
|
||||
resources :procedures do
|
||||
member do
|
||||
post :hide
|
||||
end
|
||||
|
||||
resources :types_de_champ, only: [:destroy]
|
||||
resource :types_de_champ, only: [:show, :update] do
|
||||
post '/:index/move_up' => 'types_de_champ#move_up', as: :move_up
|
||||
|
|
Loading…
Reference in a new issue