[Fix #187] Allow an admin to delete their demarche logo
This commit is contained in:
parent
cea67efd44
commit
7b3a7d2336
3 changed files with 14 additions and 0 deletions
|
@ -219,6 +219,16 @@ class Admin::ProceduresController < AdminController
|
|||
end
|
||||
end
|
||||
|
||||
def delete_logo
|
||||
procedure = Procedure.find(params[:id])
|
||||
|
||||
procedure.remove_logo!
|
||||
procedure.save
|
||||
|
||||
flash.notice = 'le logo a bien été supprimé'
|
||||
redirect_to edit_admin_procedure_path(procedure)
|
||||
end
|
||||
|
||||
def delete_deliberation
|
||||
procedure = Procedure.find(params[:id])
|
||||
|
||||
|
|
|
@ -73,6 +73,9 @@
|
|||
%h4 Logo de la démarche
|
||||
- if @procedure.logo.present?
|
||||
= image_tag @procedure.decorate.logo_img, { style: 'height: 40px; display: inline; margin-right: 6px;', id: 'preview_procedure_logo' }
|
||||
\-
|
||||
= link_to 'supprimer', delete_logo_admin_procedure_path(@procedure),
|
||||
method: :delete
|
||||
= f.file_field :logo, accept: 'image/png, image/jpg, image/jpeg', style: 'display: inline'
|
||||
|
||||
%div{ style: 'margin-top: 5px;' }
|
||||
|
|
|
@ -193,6 +193,7 @@ Rails.application.routes.draw do
|
|||
|
||||
member do
|
||||
post :hide
|
||||
delete :delete_logo
|
||||
delete :delete_deliberation
|
||||
delete :delete_notice
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue