commit
719ac06271
3 changed files with 27 additions and 0 deletions
|
@ -54,6 +54,26 @@ class Admin::AttestationTemplatesController < AdminController
|
|||
render 'admin/attestation_templates/show', formats: [:pdf]
|
||||
end
|
||||
|
||||
def delete_logo
|
||||
attestation_template = @procedure.attestation_template
|
||||
|
||||
attestation_template.remove_logo!
|
||||
attestation_template.save
|
||||
|
||||
flash.notice = 'le logo a bien été supprimée'
|
||||
redirect_to edit_admin_procedure_attestation_template_path(@procedure)
|
||||
end
|
||||
|
||||
def delete_signature
|
||||
attestation_template = @procedure.attestation_template
|
||||
|
||||
attestation_template.remove_signature!
|
||||
attestation_template.save
|
||||
|
||||
flash.notice = 'la signature a bien été supprimée'
|
||||
redirect_to edit_admin_procedure_attestation_template_path(@procedure)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def activated_attestation_params
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
= image_tag @attestation_template.logo.url, class: 'thumbnail'
|
||||
.form-group
|
||||
= f.label :logo, "Logo de l'attestation"
|
||||
- if @attestation_template.logo.present?
|
||||
= link_to 'Supprimer le logo', admin_procedure_attestation_template_logo_path(@procedure), method: :delete
|
||||
= f.file_field :logo, accept: 'image/png, image/jpg, image/jpeg'
|
||||
%p.help-block
|
||||
Fichier accepté : JPG / JPEG / PNG
|
||||
|
@ -52,6 +54,8 @@
|
|||
= image_tag @attestation_template.signature.url, class: 'thumbnail'
|
||||
.form-group
|
||||
= f.label :signature, "Tampon de l'attestation"
|
||||
- if @attestation_template.signature.present?
|
||||
= link_to 'Supprimer le tampon', admin_procedure_attestation_template_signature_path(@procedure), method: :delete
|
||||
= f.file_field :signature, accept: 'image/png, image/jpg, image/jpeg'
|
||||
%p.help-block
|
||||
Fichier accepté : JPG / JPEG / PNG
|
||||
|
|
|
@ -231,6 +231,9 @@ Rails.application.routes.draw do
|
|||
|
||||
post 'attestation_template/preview' => 'attestation_templates#preview'
|
||||
patch 'attestation_template/preview' => 'attestation_templates#preview'
|
||||
|
||||
delete 'attestation_template/logo' => 'attestation_templates#delete_logo'
|
||||
delete 'attestation_template/signature' => 'attestation_templates#delete_signature'
|
||||
end
|
||||
|
||||
namespace :instructeurs do
|
||||
|
|
Loading…
Reference in a new issue