ajout d'un bouton d'export des mails des demandeurs

This commit is contained in:
clemkeirua 2020-05-18 11:07:51 +02:00 committed by GitHub Action
parent c576b457ff
commit 22a518c921
3 changed files with 11 additions and 0 deletions

View file

@ -39,6 +39,13 @@ module Manager
redirect_to manager_procedure_path(procedure)
end
def export_mail_brouillons
dossiers = procedure.dossiers.state_brouillon
emails = dossiers.map { |d| d.user.email }.sort
date = Time.zone.now.strftime('%d-%m-%Y')
send_data(emails.join("\n"), :filename => "brouillons-#{procedure.id}-au-#{date}.csv")
end
def add_administrateur
administrateur = Administrateur.by_email(params[:email])
if administrateur

View file

@ -71,5 +71,8 @@ as well as a link to its edit page.
<% end %>
</dd>
<% end %>
<dd class="attribute-data">
<a class="button" href="<%= export_mail_brouillons_manager_procedure_url(procedure) %>">Télécharger un export CSV contenant les emails des demandeurs ayant effectué une demandes en brouillon</a>
</dd>
</dl>
</section>

View file

@ -13,6 +13,7 @@ Rails.application.routes.draw do
post 'restore', on: :member
post 'add_administrateur', on: :member
post 'change_piece_justificative_template', on: :member
get 'export_mail_brouillons', on: :member
end
resources :dossiers, only: [:index, :show] do