Merge pull request #5643 from betagouv/fix-send-copy

Fix send copy
This commit is contained in:
Keirua 2020-09-30 11:11:56 +02:00 committed by GitHub
commit 8a2ae9d852
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 6 deletions

View file

@ -1,6 +1,6 @@
module NewAdministrateur module NewAdministrateur
class ProceduresController < AdministrateurController class ProceduresController < AdministrateurController
before_action :retrieve_procedure, only: [:champs, :annotations, :edit, :monavis, :update_monavis, :jeton, :update_jeton, :publication, :publish] before_action :retrieve_procedure, only: [:champs, :annotations, :edit, :monavis, :update_monavis, :jeton, :update_jeton, :publication, :publish, :transfert]
before_action :procedure_locked?, only: [:champs, :annotations] before_action :procedure_locked?, only: [:champs, :annotations]
ITEMS_PER_PAGE = 25 ITEMS_PER_PAGE = 25
@ -155,10 +155,13 @@ module NewAdministrateur
end end
end end
def transfert
end
def transfer def transfer
admin = Administrateur.by_email(params[:email_admin].downcase) admin = Administrateur.by_email(params[:email_admin].downcase)
if admin.nil? if admin.nil?
redirect_to admin_procedure_publication_path(params[:procedure_id]) redirect_to admin_procedure_transfert_path(params[:procedure_id])
flash.alert = "Envoi vers #{params[:email_admin]} impossible : cet administrateur n'existe pas" flash.alert = "Envoi vers #{params[:email_admin]} impossible : cet administrateur n'existe pas"
else else
procedure = current_administrateur.procedures.find(params[:procedure_id]) procedure = current_administrateur.procedures.find(params[:procedure_id])

View file

@ -20,8 +20,6 @@
= link_to @procedure_lien, sanitize_url(@procedure_lien), target: :blank, rel: :noopener, class: "mb-4" = link_to @procedure_lien, sanitize_url(@procedure_lien), target: :blank, rel: :noopener, class: "mb-4"
%p.mb-4 Attention, diffusez toujours le <strong>lien complet</strong> affiché ci-dessus, et non pas un lien générique vers #{APPLICATION_NAME}. Ne dites pas non plus aux usagers de se rendre sur le site générique #{APPLICATION_NAME}, donnez-leur toujours le lien complet. %p.mb-4 Attention, diffusez toujours le <strong>lien complet</strong> affiché ci-dessus, et non pas un lien générique vers #{APPLICATION_NAME}. Ne dites pas non plus aux usagers de se rendre sur le site générique #{APPLICATION_NAME}, donnez-leur toujours le lien complet.
= render partial: 'procedure_transfert'
- elsif @procedure.brouillon? - elsif @procedure.brouillon?
- if @procedure.missing_steps.empty? - if @procedure.missing_steps.empty?
%p %p

View file

@ -13,7 +13,7 @@
Tester Tester
- if @procedure.publiee? || @procedure.brouillon? - if @procedure.publiee? || @procedure.brouillon?
= link_to admin_procedure_publication_path(@procedure), class: 'button' do = link_to admin_procedure_transfert_path(@procedure), class: 'button' do
%span.icon.reply %span.icon.reply
Envoyer une copie Envoyer une copie

View file

@ -0,0 +1,6 @@
= render partial: 'new_administrateur/breadcrumbs',
locals: { steps: [link_to('Démarches', admin_procedures_path),
link_to(@procedure.libelle, admin_procedure_path(@procedure)),
'Transfert'] }
.container
= render partial: 'procedure_transfert'

View file

@ -369,6 +369,7 @@ Rails.application.routes.draw do
get 'publication' => 'procedures#publication', as: :publication get 'publication' => 'procedures#publication', as: :publication
put 'publish' => 'procedures#publish', as: :publish put 'publish' => 'procedures#publish', as: :publish
get 'transfert' => 'procedures#transfert', as: :transfert
post 'transfer' => 'procedures#transfer', as: :transfer post 'transfer' => 'procedures#transfer', as: :transfer
resources :mail_templates, only: [:edit, :update] resources :mail_templates, only: [:edit, :update]

View file

@ -450,7 +450,7 @@ describe NewAdministrateur::ProceduresController, type: :controller do
let(:email_admin) { 'plop' } let(:email_admin) { 'plop' }
it { expect(subject.status).to eq 302 } it { expect(subject.status).to eq 302 }
it { expect(response.body).to include(admin_procedure_publication_path(procedure.id)) } it { expect(response.body).to include(admin_procedure_transfert_path(procedure.id)) }
it { expect(flash[:alert]).to be_present } it { expect(flash[:alert]).to be_present }
it { expect(flash[:alert]).to eq("Envoi vers #{email_admin} impossible : cet administrateur n'existe pas") } it { expect(flash[:alert]).to eq("Envoi vers #{email_admin} impossible : cet administrateur n'existe pas") }
end end