[Fix #187] Allow an admin to delete their demarche logo

This commit is contained in:
gregoirenovel 2018-09-24 13:29:35 +02:00
parent cea67efd44
commit 7b3a7d2336
3 changed files with 14 additions and 0 deletions

View file

@ -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])

View file

@ -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;' }

View file

@ -193,6 +193,7 @@ Rails.application.routes.draw do
member do
post :hide
delete :delete_logo
delete :delete_deliberation
delete :delete_notice
end