Merge pull request #3180 from betagouv/common-demarches-layout

layouts: use a common layout for the demarche overview
This commit is contained in:
gregoirenovel 2019-01-07 16:19:44 +01:00 committed by GitHub
commit 263c94c2b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 260 additions and 263 deletions

View file

@ -3,67 +3,6 @@
@import "placeholders";
@import "mixins";
$auth-breakpoint: $two-columns-breakpoint;
.preview {
font-size: 24px;
.paperless-logo {
width: 100%;
margin-bottom: 60px;
@media (max-width: $auth-breakpoint) {
display: none;
}
}
h3 {
color: $blue;
font-weight: bold;
}
.close-procedure {
font-size: 12px;
}
.procedure-title {
font-size: 30px;
margin: 20px 0 0;
@media (min-width: $auth-breakpoint) {
margin: 50px 0 32px;
}
}
.procedure-description {
font-size: 14px;
p {
margin-bottom: 2 * $default-spacer;
}
@media (max-width: $auth-breakpoint) {
display: none; // TO FIX : make this description available for small devices
}
}
.procedure-logos {
display: flex;
justify-content: space-around;
img {
max-height: 50px;
max-width: 100%;
margin: 0 10px;
@media (min-width: $auth-breakpoint) {
max-height: 130px;
max-width: 500px;
}
}
}
}
.auth-form {
.auth-options {
display: flex;
@ -122,14 +61,6 @@ $auth-breakpoint: $two-columns-breakpoint;
}
}
.identity-form {
@media (max-width: $two-columns-breakpoint) {
input[type=submit] {
margin-bottom: 2 * $default-padding;
}
}
}
.sign-in-form .form {
input[type="password"] {
margin-bottom: $default-spacer;

View file

@ -0,0 +1,71 @@
@import "colors";
@import "constants";
$procedure-context-breakpoint: $two-columns-breakpoint;
.procedure-preview {
font-size: 24px;
.paperless-logo {
width: 100%;
margin-bottom: 60px;
@media (max-width: $procedure-context-breakpoint) {
display: none;
}
}
h3 {
color: $blue;
font-weight: bold;
}
.close-procedure {
font-size: 12px;
}
.procedure-title {
font-size: 30px;
margin: 20px 0 0;
@media (min-width: $procedure-context-breakpoint) {
margin: 50px 0 32px;
}
}
.procedure-description {
font-size: 14px;
p {
margin-bottom: 2 * $default-spacer;
}
@media (max-width: $procedure-context-breakpoint) {
display: none; // TO FIX : make this description available for small devices
}
}
.procedure-logos {
display: flex;
justify-content: space-around;
img {
max-height: 50px;
max-width: 100%;
margin: 0 10px;
@media (min-width: $procedure-context-breakpoint) {
max-height: 130px;
max-width: 500px;
}
}
}
}
.procedure-context-content {
@media (max-width: $procedure-context-breakpoint) {
input[type=submit] {
margin-bottom: 2 * $default-padding;
}
}
}

View file

@ -1,4 +1,6 @@
class AdminController < ApplicationController
layout 'application_old'
before_action :authenticate_administrateur!
def index

View file

@ -3,8 +3,6 @@ require 'zxcvbn'
class Administrateurs::ActivateController < ApplicationController
include TrustedDeviceConcern
layout "new_application"
def new
@administrateur = Administrateur.find_inactive_by_token(params[:token])

View file

@ -1,6 +1,4 @@
class Administrateurs::SessionsController < Sessions::SessionsController
layout "new_application"
def new
redirect_to new_user_session_path
end

View file

@ -1,6 +1,4 @@
class Administrations::SessionsController < ApplicationController
layout "new_application"
def new
end

View file

@ -1,6 +1,4 @@
class DemandesController < ApplicationController
layout "new_application"
def new
end

View file

@ -1,8 +1,6 @@
class Gestionnaires::ActivateController < ApplicationController
include TrustedDeviceConcern
layout "new_application"
def new
@gestionnaire = Gestionnaire.with_reset_password_token(params[:token])

View file

@ -1,6 +1,4 @@
class Gestionnaires::SessionsController < Sessions::SessionsController
layout "new_application"
def new
redirect_to new_user_session_path
end

View file

@ -1,7 +1,5 @@
module NewAdministrateur
class AdministrateurController < ApplicationController
layout 'new_application'
before_action :authenticate_administrateur!
end
end

View file

@ -76,7 +76,7 @@ module NewGestionnaire
@email = params[:email]
@dossier = Avis.includes(:dossier).find(params[:id]).dossier
render layout: 'new_application'
render
end
def create_gestionnaire

View file

@ -1,7 +1,5 @@
module NewGestionnaire
class GestionnaireController < ApplicationController
layout "new_application"
before_action :authenticate_gestionnaire!
def nav_bar_profile

View file

@ -2,6 +2,8 @@ module NewUser
class DossiersController < UserController
include DossierHelper
layout 'procedure_context', only: [:identite, :update_identite, :siret, :update_siret]
SESSION_USER_RETURN_LOCATION = 'user_return_to'
ACTIONS_ALLOWED_TO_ANY_USER = [:index, :recherche, :new]
ACTIONS_ALLOWED_TO_OWNER_OR_INVITE = [:show, :demande, :messagerie, :brouillon, :update_brouillon, :modifier, :update, :create_commentaire, :purge_champ_piece_justificative]

View file

@ -1,7 +1,5 @@
module NewUser
class UserController < ApplicationController
layout "new_application"
before_action :authenticate_user!
def nav_bar_profile

View file

@ -1,6 +1,4 @@
class RootController < ApplicationController
layout 'new_application'
def index
if administrateur_signed_in?
return redirect_to admin_procedures_path

View file

@ -1,6 +1,4 @@
class StatsController < ApplicationController
layout "new_application"
before_action :authenticate_administration!, only: [:download]
MEAN_NUMBER_OF_CHAMPS_IN_A_FORM = 24.0

View file

@ -1,6 +1,4 @@
class SupportController < ApplicationController
layout "new_application"
def index
setup_context
end

View file

@ -1,8 +1,6 @@
# frozen_string_literal: true
class Users::ConfirmationsController < Devise::ConfirmationsController
layout "new_application"
# GET /resource/confirmation/new
def new
# Allow displaying the user email in the message

View file

@ -1,6 +1,4 @@
class Users::PasswordsController < Devise::PasswordsController
layout "new_application"
after_action :try_to_authenticate_gestionnaire, only: [:update]
after_action :try_to_authenticate_administrateur, only: [:update]

View file

@ -1,6 +1,4 @@
class Users::RegistrationsController < Devise::RegistrationsController
layout "new_application"
# before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update]

View file

@ -2,8 +2,6 @@ class Users::SessionsController < Sessions::SessionsController
include TrustedDeviceConcern
include ActionView::Helpers::DateHelper
layout "new_application"
# GET /resource/sign_in
def new
if user_return_to_procedure_id.present? # WTF ?

View file

@ -1,23 +1,27 @@
%html
!!! 5
%html{ lang: "fr" }
%head
%meta{ :content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type" }/
%meta{ "http-equiv": "Content-Type", content: "text/html; charset=UTF-8" }
%meta{ "http-equiv": "X-UA-Compatible", content: "IE=edge" }
%meta{ name: "turbolinks-cache-control", content: "no-cache" }
%meta{ name: "viewport", content: "width=device-width, initial-scale=1" }
= csrf_meta_tags
%title
= t('dynamics.page_title')
%meta{ 'http-equiv' => "X-UA-Compatible", :content => "IE=edge" }
= content_for?(:title) ? "#{yield(:title)} · demarches-simplifiees.fr" : "demarches-simplifiees.fr"
= favicon_link_tag(image_url("favicons/16x16.png"), type: "image/png", sizes: "16x16")
= favicon_link_tag(image_url("favicons/32x32.png"), type: "image/png", sizes: "32x32")
= favicon_link_tag(image_url("favicons/96x96.png"), type: "image/png", sizes: "96x96")
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': "reload"
= stylesheet_link_tag 'print', media: 'print', 'data-turbolinks-track': "reload"
= javascript_pack_tag 'application-old', defer: true, 'data-turbolinks-track': 'reload'
= javascript_include_tag 'application', defer: true, 'data-turbolinks-track': 'reload'
= csrf_meta_tags
= javascript_pack_tag 'application', defer: true, 'data-turbolinks-track': 'reload'
= stylesheet_link_tag 'new_design/new_application', media: 'all', 'data-turbolinks-track': 'reload'
= stylesheet_link_tag 'new_design/print', media: 'print', 'data-turbolinks-track': 'reload'
- if Rails.env.development?
= stylesheet_link_tag :xray
= render partial: "layouts/matomo"
= render partial: "layouts/sendinblue"
:javascript
DATA = [{
@ -25,29 +29,21 @@
}];
%body{ class: browser.platform.ios? ? 'ios' : nil }
= render partial: 'layouts/outdated_browser_banner'
= render partial: 'layouts/pre_maintenance'
- if staging?
#beta
Env Test
.page-wrapper
= render partial: "layouts/outdated_browser_banner"
= render partial: 'layouts/pre_maintenance'
- if staging?
#beta
Env Test
#wrap
.row
#header.navbar
= render partial: "layouts/navbar"
.row.no-margin
- if RenderPartialService.left_panel_exist? @left_pannel_url
.col-xs-2#left-panel
= render partial: @left_pannel_url
- main_container_size = 10
- else
- main_container_size = 12
= render partial: "layouts/new_header"
= render partial: "layouts/flash_messages"
= content_for?(:content) ? yield(:content) : yield
= render partial: 'layouts/main_container', locals: { main_container_size: main_container_size }
#mask-search
%h1
%i.fa.fa-times{ style: 'position: fixed; top: 10; right: 30; color: white;' }
- if content_for?(:footer)
= content_for(:footer)
= render partial: 'layouts/switch_devise_profile_module'
- if Rails.env.development?
= javascript_include_tag :xray
= render partial: 'layouts/footer', locals: { main_container_size: main_container_size }
= yield :charts_js

View file

@ -0,0 +1,53 @@
%html
%head
%meta{ :content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type" }/
%meta{ name: "turbolinks-cache-control", content: "no-cache" }
%title
= t('dynamics.page_title')
%meta{ 'http-equiv' => "X-UA-Compatible", :content => "IE=edge" }
= favicon_link_tag(image_url("favicons/16x16.png"), type: "image/png", sizes: "16x16")
= favicon_link_tag(image_url("favicons/32x32.png"), type: "image/png", sizes: "32x32")
= favicon_link_tag(image_url("favicons/96x96.png"), type: "image/png", sizes: "96x96")
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': "reload"
= stylesheet_link_tag 'print', media: 'print', 'data-turbolinks-track': "reload"
= javascript_pack_tag 'application-old', defer: true, 'data-turbolinks-track': 'reload'
= javascript_include_tag 'application', defer: true, 'data-turbolinks-track': 'reload'
= csrf_meta_tags
= render partial: "layouts/matomo"
= render partial: "layouts/sendinblue"
:javascript
DATA = [{
sentry: #{raw(sentry_config)}
}];
%body{ class: browser.platform.ios? ? 'ios' : nil }
= render partial: 'layouts/outdated_browser_banner'
= render partial: 'layouts/pre_maintenance'
- if staging?
#beta
Env Test
#wrap
.row
#header.navbar
= render partial: "layouts/navbar"
.row.no-margin
- if RenderPartialService.left_panel_exist? @left_pannel_url
.col-xs-2#left-panel
= render partial: @left_pannel_url
- main_container_size = 10
- else
- main_container_size = 12
= render partial: 'layouts/main_container', locals: { main_container_size: main_container_size }
#mask-search
%h1
%i.fa.fa-times{ style: 'position: fixed; top: 10; right: 30; color: white;' }
= render partial: 'layouts/switch_devise_profile_module'
= render partial: 'layouts/footer', locals: { main_container_size: main_container_size }

View file

@ -1,49 +0,0 @@
!!! 5
%html{ lang: "fr" }
%head
%meta{ "http-equiv": "Content-Type", content: "text/html; charset=UTF-8" }
%meta{ "http-equiv": "X-UA-Compatible", content: "IE=edge" }
%meta{ name: "turbolinks-cache-control", content: "no-cache" }
%meta{ name: "viewport", content: "width=device-width, initial-scale=1" }
= csrf_meta_tags
%title
= content_for?(:title) ? "#{yield(:title)} · demarches-simplifiees.fr" : "demarches-simplifiees.fr"
= favicon_link_tag(image_url("favicons/16x16.png"), type: "image/png", sizes: "16x16")
= favicon_link_tag(image_url("favicons/32x32.png"), type: "image/png", sizes: "32x32")
= favicon_link_tag(image_url("favicons/96x96.png"), type: "image/png", sizes: "96x96")
= javascript_pack_tag 'application', defer: true, 'data-turbolinks-track': 'reload'
= stylesheet_link_tag 'new_design/new_application', media: 'all', 'data-turbolinks-track': 'reload'
= stylesheet_link_tag 'new_design/print', media: 'print', 'data-turbolinks-track': 'reload'
- if Rails.env.development?
= stylesheet_link_tag :xray
= render partial: "layouts/matomo"
:javascript
DATA = [{
sentry: #{raw(sentry_config)}
}];
%body{ class: browser.platform.ios? ? 'ios' : nil }
.page-wrapper
= render partial: "layouts/outdated_browser_banner"
= render partial: 'layouts/pre_maintenance'
- if staging?
#beta
Env Test
= render partial: "layouts/new_header"
= render partial: "layouts/flash_messages"
= yield
- if content_for?(:footer)
= content_for(:footer)
- if Rails.env.development?
= javascript_include_tag :xray
= yield :charts_js

View file

@ -0,0 +1,22 @@
- content_for :content do
.two-columns.procedure-context
.columns-container
.column.procedure-preview
- procedure = @dossier.procedure
.procedure-logos
= image_tag logo_img(procedure)
- if procedure.euro_flag
= image_tag "flag_of_europe.svg"
%h2.procedure-title
= procedure.libelle
.procedure-description
= h string_to_html(procedure.description)
.column.procedure-context-content
= yield
- content_for :footer do
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
= render template: 'layouts/application'

View file

@ -1,9 +0,0 @@
.procedure-logos
= image_tag logo_img(procedure)
- if procedure.euro_flag
= image_tag "flag_of_europe.svg"
%h2.procedure-title
= procedure.libelle
.procedure-description
= h string_to_html(procedure.description)

View file

@ -1,39 +1,30 @@
- content_for(:title, "Nouveau dossier (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: @dossier }
.two-columns
.columns-container
.column.preview
= render partial: "new_user/dossiers/demarche_overview", locals: { procedure: @dossier.procedure }
- if !dossier_submission_is_closed?(@dossier)
= form_for @dossier.individual, url: update_identite_dossier_path(@dossier), html: { class: "form" } do |f|
%h1 Données d'identité
.column.identity-form
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: @dossier }
%p.mb-1 Merci de remplir vos informations personnelles pour accéder à la démarche.
- if !dossier_submission_is_closed?(@dossier)
= form_for @dossier.individual, url: update_identite_dossier_path(@dossier), html: { class: "form" } do |f|
%h1 Données d'identité
%label
%span.mandatory *
champs requis
%p.mb-1 Merci de remplir vos informations personnelles pour accéder à la démarche.
= f.label :gender, class: "required"
= f.select :gender, ['M.', 'Mme'], {}, class: "small"
%label
%span.mandatory *
champs requis
.flex
.inline-champ
= f.label :prenom, class: "required"
= f.text_field :prenom, class: "small", required: true
.inline-champ
= f.label :nom, class: "required"
= f.text_field :nom, class: "small", required: true
= f.label :gender, class: "required"
= f.select :gender, ['M.', 'Mme'], {}, class: "small"
- if @dossier.procedure.ask_birthday?
= f.label :birthdate, class: "required"
= f.date_field :birthdate, value: @dossier.individual.birthdate, placeholder: 'format : AAAA-MM-JJ', required: true, class: "small"
.flex
.inline-champ
= f.label :prenom, class: "required"
= f.text_field :prenom, class: "small", required: true
.inline-champ
= f.label :nom, class: "required"
= f.text_field :nom, class: "small", required: true
- if @dossier.procedure.ask_birthday?
= f.label :birthdate, class: "required"
= f.date_field :birthdate, value: @dossier.individual.birthdate, placeholder: 'format : AAAA-MM-JJ', required: true, class: "small"
= f.submit "Continuer", class: "button large primary expand"
= f.submit "Continuer", class: "button large primary expand"

View file

@ -1,25 +1,14 @@
- content_for(:title, "Nouveau dossier (#{@dossier.procedure.libelle})")
- content_for :footer do
= render partial: "new_user/dossiers/dossier_footer", locals: { dossier: @dossier }
- if !dossier_submission_is_closed?(@dossier)
= form_for current_user, url: siret_dossier_path(@dossier), html: { class: 'form', method: 'post' } do |f|
%h1 Identifier votre établissement
.two-columns
.columns-container
.column.preview
= render partial: "new_user/dossiers/demarche_overview", locals: { procedure: @dossier.procedure }
%p.mb-1 Merci de remplir le numéro de SIRET de votre entreprise, administration ou association pour commencer la démarche.
.column.identity-form
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: @dossier }
= f.label :siret, style: "display: none"
= f.text_field :siret, placeholder: "Numéro SIRET à 14 chiffres", required: true
- if !dossier_submission_is_closed?(@dossier)
= form_for current_user, url: siret_dossier_path(@dossier), html: { class: 'form', method: 'post' } do |f|
%h1 Identifier votre établissement
= f.hidden_field :dossier_id, value: @dossier.id
%p.mb-1 Merci de remplir le numéro de SIRET de votre entreprise, administration ou association pour commencer la démarche.
= f.label :siret, style: "display: none"
= f.text_field :siret, placeholder: "Numéro SIRET à 14 chiffres", required: true
= f.hidden_field :dossier_id, value: @dossier.id
= f.submit "Valider", class: "button large primary expand", data: { disable_with: "Récupération des informations…" }
= f.submit "Valider", class: "button large primary expand", data: { disable_with: "Récupération des informations…" }

View file

@ -10,6 +10,7 @@ FactoryBot.define do
administrateur { create(:administrateur) }
duree_conservation_dossiers_dans_ds { 3 }
duree_conservation_dossiers_hors_ds { 6 }
ask_birthday { false }
factory :procedure_with_dossiers do
transient do

View file

@ -11,12 +11,17 @@ feature 'Creating a new dossier:' do
end
context 'when the procedure has identification by individual' do
let(:procedure) { create(:procedure, :published, :for_individual, :with_type_de_champ, :with_two_type_de_piece_justificative, ask_birthday: ask_birthday) }
let(:procedure) { create(:procedure, :published, :for_individual, :with_service, :with_type_de_champ, :with_two_type_de_piece_justificative, ask_birthday: ask_birthday) }
let(:ask_birthday) { false }
let(:expected_birthday) { nil }
before do
visit commencer_path(path: procedure.path)
expect(page).to have_content(procedure.libelle)
expect(page).to have_content(procedure.description)
expect(page).to have_content(procedure.service.email)
fill_in 'individual_nom', with: 'Nom'
fill_in 'individual_prenom', with: 'Prenom'
end
@ -58,7 +63,7 @@ feature 'Creating a new dossier:' do
end
context 'when identifying through SIRET' do
let(:procedure) { create(:procedure, :published, :with_type_de_champ, :with_two_type_de_piece_justificative) }
let(:procedure) { create(:procedure, :published, :with_service, :with_type_de_champ, :with_two_type_de_piece_justificative) }
let(:dossier) { procedure.dossiers.last }
before do
@ -74,7 +79,11 @@ feature 'Creating a new dossier:' do
scenario 'the user can enter the SIRET of its etablissement and create a new draft', vcr: { cassette_name: 'api_adresse_search_paris_3' }, js: true do
visit commencer_path(path: procedure.path)
expect(page).to have_current_path(siret_dossier_path(dossier))
expect(page).to have_content(procedure.libelle)
expect(page).to have_content(procedure.description)
expect(page).to have_content(procedure.service.email)
fill_in 'Numéro SIRET', with: siret
click_on 'Valider'

View file

@ -0,0 +1,28 @@
require 'rails_helper'
describe 'layouts/procedure_context.html.haml', type: :view do
let(:procedure) { create(:simple_procedure, :with_service) }
let(:dossier) { create(:dossier, procedure: procedure) }
before do
assign(:dossier, dossier)
end
subject do
render html: 'Column content', layout: 'layouts/procedure_context.html.haml'
end
it 'renders a description of the procedure' do
expect(subject).to have_text(dossier.procedure.libelle)
expect(subject).to have_text(dossier.procedure.description)
end
it 'renders the inner content' do
expect(subject).to have_text('Column content')
end
it 'renders the dossier footer' do
expect(subject).to have_text(dossier.procedure.service.nom)
expect(subject).to have_text(dossier.procedure.service.email)
end
end

View file

@ -1,25 +1,26 @@
require 'spec_helper'
describe 'new_user/dossiers/identite.html.haml', type: :view do
let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: Dossier.states.fetch(:brouillon), procedure: create(:procedure, :with_two_type_de_piece_justificative, for_individual: true)) }
let(:footer) { view.content_for(:footer) }
let(:procedure) { create(:simple_procedure, for_individual: true) }
let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: Dossier.states.fetch(:brouillon), procedure: procedure) }
before do
sign_in dossier.user
assign(:dossier, dossier)
end
context 'test de composition de la page' do
before do
render
end
subject! { render }
it 'affiche les informations de la démarche' do
expect(rendered).to have_text(dossier.procedure.libelle)
end
it 'has identity fields' do
expect(rendered).to have_field('Prénom')
expect(rendered).to have_field('Nom')
end
it 'prépare le footer' do
expect(footer).to have_selector('footer')
context 'when the demarche asks for the birthdate' do
let(:procedure) { create(:simple_procedure, for_individual: true, ask_birthday: true) }
it 'has a birthday field' do
expect(rendered).to have_field('Date de naissance')
end
end
end

View file

@ -2,7 +2,6 @@ require 'spec_helper'
describe 'new_user/dossiers/siret.html.haml', type: :view do
let(:dossier) { create(:dossier) }
let(:footer) { view.content_for(:footer) }
before do
sign_in dossier.user
@ -11,15 +10,7 @@ describe 'new_user/dossiers/siret.html.haml', type: :view do
subject! { render }
it 'affiche les informations de la démarche' do
expect(rendered).to have_text(dossier.procedure.libelle)
end
it 'affiche le formulaire de SIRET' do
expect(rendered).to have_field('Numéro SIRET')
end
it 'prépare le footer' do
expect(footer).to have_selector('footer')
end
end