Merge pull request #5167 from betagouv/export-brouillons
Ajout d'un bouton d'export des mails des demandeurs
This commit is contained in:
commit
23316b6e4e
3 changed files with 11 additions and 0 deletions
|
@ -39,6 +39,13 @@ module Manager
|
|||
redirect_to manager_procedure_path(procedure)
|
||||
end
|
||||
|
||||
def export_mail_brouillons
|
||||
dossiers = procedure.dossiers.state_brouillon.includes(:user)
|
||||
emails = dossiers.map { |d| d.user.email }.sort.uniq
|
||||
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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue