Merge pull request #5447 from betagouv/dev

2020-08-05-01
This commit is contained in:
jpoulvel 2020-08-05 12:41:59 +02:00 committed by GitHub
commit 2234d22b96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 24 deletions

View file

@ -37,7 +37,8 @@
}
.confirmation-resend {
p {
p,
label {
margin-bottom: $default-padding;
}
@ -45,6 +46,10 @@
display: flex;
flex-wrap: wrap;
label {
flex-basis: 100%;
}
input,
button {
margin-bottom: $default-spacer;
@ -56,9 +61,5 @@
margin-right: $default-spacer;
}
}
label {
display: none;
}
}
}

View file

@ -109,8 +109,11 @@ class AttestationTemplate < ApplicationRecord
def build_pdf(dossier)
attestation = render_attributes_for(dossier: dossier)
action_view = ActionView::Base.new(ActionController::Base.view_paths, attestation: attestation)
attestation_view = action_view.render(file: 'new_administrateur/attestation_templates/show', formats: [:pdf])
attestation_view = ApplicationController.render(
file: 'new_administrateur/attestation_templates/show',
formats: :pdf,
assigns: { attestation: attestation }
)
StringIO.new(attestation_view)
end

View file

@ -122,14 +122,14 @@
%h2.procedure-admin-explanation Pour aller plus loin
.procedure-grid
.card-admin
- if @procedure.attestation_template.present?
- if @procedure.attestation_template.present? && @procedure.attestation_template.activated
%div
%span.icon.accept
%p.card-admin-status-accept Activée
- else
%div
%span.icon.clock
%p.card-admin-status-todo À activer
%p.card-admin-status-todo Désactivée
%div
%p.card-admin-title Attestation
%p.card-admin-subtitle Délivrance automatique pour les dossiers acceptés

View file

@ -1,4 +1,4 @@
- content_for(:title, 'Confirmer votre adresse email')
- content_for(:title, 'Confirmez votre adresse email')
- content_for :footer do
= render partial: 'root/footer'
@ -6,8 +6,9 @@
.container.devise-container.devise-confirmations
.one-column-centered
= devise_error_messages!
%h1.center Confirmez votre adresse email
%img.confirmation-icon{ src: image_url("user/confirmation-email.svg"), alt: "" }
%img.confirmation-icon{ src: image_url("user/confirmation-email.svg"), alt: "Email envoyé" }
%p.confirmation-preamble
= succeed '.' do
@ -26,7 +27,8 @@
%p Si vous navez pas reçu notre message (avez-vous vérifié les indésirables ?), nous pouvons vous le renvoyer.
= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { class: 'form' }) do |f|
= f.label :email, 'Email'
= f.label :email, 'Votre email'
%br
= f.email_field :email, placeholder: 'Email', class: 'small', autofocus: true
= f.submit 'Renvoyer un email de confirmation', class: 'button'

View file

@ -22,7 +22,7 @@ feature 'wcag rules for usager', js: true do
perform_enqueued_jobs do
click_button 'Créer un compte'
expect(page).to be_accessible.skipping(:'page-has-heading-one', :'role-img-alt', :label)
expect(page).to be_accessible
end
end

View file

@ -122,12 +122,11 @@ describe AttestationTemplate, type: :model do
end
let(:view_args) do
original_new = ActionView::Base.method(:new)
arguments = nil
allow(ActionView::Base).to receive(:new) do |paths, args|
arguments = args
original_new.call(paths, args)
allow(ApplicationController).to receive(:render).and_wrap_original do |m, *args|
arguments = args.first[:assigns]
m.call(*args)
end
attestation_template.attestation_for(dossier)
@ -162,10 +161,14 @@ describe AttestationTemplate, type: :model do
.update(value: 'libelle2')
end
it do
it 'passes the correct parameters to the view' do
expect(view_args[:attestation][:title]).to eq('title libelle1')
expect(view_args[:attestation][:body]).to eq('body libelle2')
end
it 'generates an attestation' do
expect(attestation.title).to eq('title libelle1')
expect(attestation.pdf).to be_attached
end
end
end

View file

@ -2003,9 +2003,9 @@ bluebird@^3.5.5:
integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.4.0:
version "4.11.8"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f"
integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==
version "4.11.9"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828"
integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==
bn.js@^5.1.1:
version "5.1.1"
@ -3458,9 +3458,9 @@ electron-to-chromium@^1.3.413:
integrity sha512-BVXnq+NCefidU7GOFPx4CPBfPcccLCRBKZYSbvBJMSn2kwGD7ML+eUA9tqfHAumRqy3oX5zaeTI1Bpt7qVat0Q==
elliptic@^6.0.0, elliptic@^6.5.2:
version "6.5.2"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762"
integrity sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==
version "6.5.3"
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6"
integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==
dependencies:
bn.js "^4.4.0"
brorand "^1.0.1"