Merge pull request #3010 from betagouv/fix-3008

[Fix #3008] Soft delete demarche button in manager
This commit is contained in:
gregoirenovel 2018-11-21 14:34:37 +01:00 committed by GitHub
commit fc6fcb6f19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View file

@ -17,5 +17,12 @@ module Manager
end
redirect_to manager_procedure_path(procedure)
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

View file

@ -40,6 +40,8 @@ as well as a link to its edit page.
<% if procedure.publiee? && procedure.dossiers.empty? %>
<%= link_to 'passer en brouillon', draft_manager_procedure_path(procedure), method: :post, class: 'button' %>
<% 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>
</header>

View file

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