[Fix #3008] Soft delete demarche button in manager

This commit is contained in:
Mathieu Magnin 2018-11-20 17:38:04 +01:00 committed by gregoirenovel
parent 53699e71d9
commit 3ce9dd39af
3 changed files with 10 additions and 0 deletions

View file

@ -17,5 +17,12 @@ module Manager
end end
redirect_to manager_procedure_path(procedure) redirect_to manager_procedure_path(procedure)
end end
def hide
procedure = Procedure.find(params[:id])
procedure.hide!
flash[:notice] = "La démarche a bien été supprimée, en cas d'erreur contactez un développeur."
redirect_to manager_procedure_path(procedure)
end
end end
end end

View file

@ -40,6 +40,8 @@ as well as a link to its edit page.
<% if procedure.publiee? && procedure.dossiers.empty? %> <% if procedure.publiee? && procedure.dossiers.empty? %>
<%= link_to 'passer en brouillon', draft_manager_procedure_path(procedure), method: :post, class: 'button' %> <%= link_to 'passer en brouillon', draft_manager_procedure_path(procedure), method: :post, class: 'button' %>
<% end %> <% end %>
<%= link_to 'supprimer la démarche', hide_manager_procedure_path(procedure), method: :post, class: 'button', data: { confirm: "Confirmez-vous la suppression de la démarche ?" } %>
<div> <div>
</header> </header>

View file

@ -9,6 +9,7 @@ Rails.application.routes.draw do
resources :procedures, only: [:index, :show] do resources :procedures, only: [:index, :show] do
post 'whitelist', on: :member post 'whitelist', on: :member
post 'draft', on: :member post 'draft', on: :member
post 'hide', on: :member
end end
resources :dossiers, only: [:index, :show] do resources :dossiers, only: [:index, :show] do