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

View file

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

View file

@ -122,14 +122,14 @@
%h2.procedure-admin-explanation Pour aller plus loin %h2.procedure-admin-explanation Pour aller plus loin
.procedure-grid .procedure-grid
.card-admin .card-admin
- if @procedure.attestation_template.present? - if @procedure.attestation_template.present? && @procedure.attestation_template.activated
%div %div
%span.icon.accept %span.icon.accept
%p.card-admin-status-accept Activée %p.card-admin-status-accept Activée
- else - else
%div %div
%span.icon.clock %span.icon.clock
%p.card-admin-status-todo À activer %p.card-admin-status-todo Désactivée
%div %div
%p.card-admin-title Attestation %p.card-admin-title Attestation
%p.card-admin-subtitle Délivrance automatique pour les dossiers acceptés %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 - content_for :footer do
= render partial: 'root/footer' = render partial: 'root/footer'
@ -6,8 +6,9 @@
.container.devise-container.devise-confirmations .container.devise-container.devise-confirmations
.one-column-centered .one-column-centered
= devise_error_messages! = 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 %p.confirmation-preamble
= succeed '.' do = 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. %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| = 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.email_field :email, placeholder: 'Email', class: 'small', autofocus: true
= f.submit 'Renvoyer un email de confirmation', class: 'button' = 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 perform_enqueued_jobs do
click_button 'Créer un compte' 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
end end

View file

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

View file

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