Merge pull request #2662 from betagouv/fix-2332

[Fix #2332] Allow the notice deletion
This commit is contained in:
gregoirenovel 2018-09-24 12:31:36 +02:00 committed by GitHub
commit cea67efd44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View file

@ -228,6 +228,15 @@ class Admin::ProceduresController < AdminController
redirect_to edit_admin_procedure_path(procedure)
end
def delete_notice
procedure = Procedure.find(params[:id])
procedure.notice.purge_later
flash.notice = 'la notice a bien été supprimée'
redirect_to edit_admin_procedure_path(procedure)
end
private
def cloned_from_library?

View file

@ -60,6 +60,9 @@
- else
%a{ href: url_for(notice), target: '_blank' }
= notice.filename.to_s
\-
= link_to 'supprimer', delete_notice_admin_procedure_path(@procedure),
method: :delete
%br
Modifier :
= f.file_field :notice,

View file

@ -194,6 +194,7 @@ Rails.application.routes.draw do
member do
post :hide
delete :delete_deliberation
delete :delete_notice
end
resources :types_de_champ, only: [:destroy]