diff --git a/app/assets/stylesheets/new_design/auth.scss b/app/assets/stylesheets/new_design/auth.scss index 6109a22a3..9196f0fa1 100644 --- a/app/assets/stylesheets/new_design/auth.scss +++ b/app/assets/stylesheets/new_design/auth.scss @@ -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; diff --git a/app/assets/stylesheets/new_design/procedure_context.scss b/app/assets/stylesheets/new_design/procedure_context.scss new file mode 100644 index 000000000..f0772825f --- /dev/null +++ b/app/assets/stylesheets/new_design/procedure_context.scss @@ -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; + } + } +} diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 175795308..926bb0ff4 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -1,4 +1,6 @@ class AdminController < ApplicationController + layout 'application_old' + before_action :authenticate_administrateur! def index diff --git a/app/controllers/administrateurs/activate_controller.rb b/app/controllers/administrateurs/activate_controller.rb index 5d2654587..dc2347e8b 100644 --- a/app/controllers/administrateurs/activate_controller.rb +++ b/app/controllers/administrateurs/activate_controller.rb @@ -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]) diff --git a/app/controllers/administrateurs/sessions_controller.rb b/app/controllers/administrateurs/sessions_controller.rb index 432ff9f25..dfaab02f8 100644 --- a/app/controllers/administrateurs/sessions_controller.rb +++ b/app/controllers/administrateurs/sessions_controller.rb @@ -1,6 +1,4 @@ class Administrateurs::SessionsController < Sessions::SessionsController - layout "new_application" - def new redirect_to new_user_session_path end diff --git a/app/controllers/administrations/sessions_controller.rb b/app/controllers/administrations/sessions_controller.rb index 78de713c8..90ed081b1 100644 --- a/app/controllers/administrations/sessions_controller.rb +++ b/app/controllers/administrations/sessions_controller.rb @@ -1,6 +1,4 @@ class Administrations::SessionsController < ApplicationController - layout "new_application" - def new end diff --git a/app/controllers/demandes_controller.rb b/app/controllers/demandes_controller.rb index 571233896..5aac0b6b7 100644 --- a/app/controllers/demandes_controller.rb +++ b/app/controllers/demandes_controller.rb @@ -1,6 +1,4 @@ class DemandesController < ApplicationController - layout "new_application" - def new end diff --git a/app/controllers/gestionnaires/activate_controller.rb b/app/controllers/gestionnaires/activate_controller.rb index 12fdae36a..02a855bb2 100644 --- a/app/controllers/gestionnaires/activate_controller.rb +++ b/app/controllers/gestionnaires/activate_controller.rb @@ -1,8 +1,6 @@ class Gestionnaires::ActivateController < ApplicationController include TrustedDeviceConcern - layout "new_application" - def new @gestionnaire = Gestionnaire.with_reset_password_token(params[:token]) diff --git a/app/controllers/gestionnaires/sessions_controller.rb b/app/controllers/gestionnaires/sessions_controller.rb index ed49b6185..d098d4058 100644 --- a/app/controllers/gestionnaires/sessions_controller.rb +++ b/app/controllers/gestionnaires/sessions_controller.rb @@ -1,6 +1,4 @@ class Gestionnaires::SessionsController < Sessions::SessionsController - layout "new_application" - def new redirect_to new_user_session_path end diff --git a/app/controllers/new_administrateur/administrateur_controller.rb b/app/controllers/new_administrateur/administrateur_controller.rb index ebf306f67..ebab217f2 100644 --- a/app/controllers/new_administrateur/administrateur_controller.rb +++ b/app/controllers/new_administrateur/administrateur_controller.rb @@ -1,7 +1,5 @@ module NewAdministrateur class AdministrateurController < ApplicationController - layout 'new_application' - before_action :authenticate_administrateur! end end diff --git a/app/controllers/new_gestionnaire/avis_controller.rb b/app/controllers/new_gestionnaire/avis_controller.rb index 7cb207e7a..7ff6bfec6 100644 --- a/app/controllers/new_gestionnaire/avis_controller.rb +++ b/app/controllers/new_gestionnaire/avis_controller.rb @@ -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 diff --git a/app/controllers/new_gestionnaire/gestionnaire_controller.rb b/app/controllers/new_gestionnaire/gestionnaire_controller.rb index 2ffe8ae50..cd23783b7 100644 --- a/app/controllers/new_gestionnaire/gestionnaire_controller.rb +++ b/app/controllers/new_gestionnaire/gestionnaire_controller.rb @@ -1,7 +1,5 @@ module NewGestionnaire class GestionnaireController < ApplicationController - layout "new_application" - before_action :authenticate_gestionnaire! def nav_bar_profile diff --git a/app/controllers/new_user/dossiers_controller.rb b/app/controllers/new_user/dossiers_controller.rb index b9f1d3fdd..fb4c01ddf 100644 --- a/app/controllers/new_user/dossiers_controller.rb +++ b/app/controllers/new_user/dossiers_controller.rb @@ -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] diff --git a/app/controllers/new_user/user_controller.rb b/app/controllers/new_user/user_controller.rb index dc74e3d12..35519a3f0 100644 --- a/app/controllers/new_user/user_controller.rb +++ b/app/controllers/new_user/user_controller.rb @@ -1,7 +1,5 @@ module NewUser class UserController < ApplicationController - layout "new_application" - before_action :authenticate_user! def nav_bar_profile diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index fee41a2fb..c44b7a224 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -1,6 +1,4 @@ class RootController < ApplicationController - layout 'new_application' - def index if administrateur_signed_in? return redirect_to admin_procedures_path diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index 52cb324d2..73d68e8be 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -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 diff --git a/app/controllers/support_controller.rb b/app/controllers/support_controller.rb index 330100091..034ba0a0e 100644 --- a/app/controllers/support_controller.rb +++ b/app/controllers/support_controller.rb @@ -1,6 +1,4 @@ class SupportController < ApplicationController - layout "new_application" - def index setup_context end diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index b60e2deeb..a93ac5600 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -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 diff --git a/app/controllers/users/passwords_controller.rb b/app/controllers/users/passwords_controller.rb index b679af447..f65b71202 100644 --- a/app/controllers/users/passwords_controller.rb +++ b/app/controllers/users/passwords_controller.rb @@ -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] diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 980740240..27af0703f 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -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] diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 87f312d51..a74588b5e 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -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 ? diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index a5a6a67b8..033ec625c 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -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 diff --git a/app/views/layouts/application_old.html.haml b/app/views/layouts/application_old.html.haml new file mode 100644 index 000000000..a5a6a67b8 --- /dev/null +++ b/app/views/layouts/application_old.html.haml @@ -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 } diff --git a/app/views/layouts/new_application.html.haml b/app/views/layouts/new_application.html.haml deleted file mode 100644 index 142e5262c..000000000 --- a/app/views/layouts/new_application.html.haml +++ /dev/null @@ -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 diff --git a/app/views/layouts/procedure_context.html.haml b/app/views/layouts/procedure_context.html.haml new file mode 100644 index 000000000..223bff4c2 --- /dev/null +++ b/app/views/layouts/procedure_context.html.haml @@ -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' diff --git a/app/views/new_user/dossiers/_demarche_overview.html.haml b/app/views/new_user/dossiers/_demarche_overview.html.haml deleted file mode 100644 index 548bdf757..000000000 --- a/app/views/new_user/dossiers/_demarche_overview.html.haml +++ /dev/null @@ -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) diff --git a/app/views/new_user/dossiers/identite.html.haml b/app/views/new_user/dossiers/identite.html.haml index 8a6de338b..28d4466b4 100644 --- a/app/views/new_user/dossiers/identite.html.haml +++ b/app/views/new_user/dossiers/identite.html.haml @@ -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" diff --git a/app/views/new_user/dossiers/siret.html.haml b/app/views/new_user/dossiers/siret.html.haml index ec049a242..4f0f25283 100644 --- a/app/views/new_user/dossiers/siret.html.haml +++ b/app/views/new_user/dossiers/siret.html.haml @@ -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…" } diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb index d99aa43c6..0e6d44c41 100644 --- a/spec/factories/procedure.rb +++ b/spec/factories/procedure.rb @@ -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 diff --git a/spec/features/new_user/dossier_creation_spec.rb b/spec/features/new_user/dossier_creation_spec.rb index 23785d9cb..a45af4ba0 100644 --- a/spec/features/new_user/dossier_creation_spec.rb +++ b/spec/features/new_user/dossier_creation_spec.rb @@ -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' diff --git a/spec/views/layouts/procedure_context.html.haml_spec.rb b/spec/views/layouts/procedure_context.html.haml_spec.rb new file mode 100644 index 000000000..2c9e51856 --- /dev/null +++ b/spec/views/layouts/procedure_context.html.haml_spec.rb @@ -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 diff --git a/spec/views/new_user/dossiers/identite.html.haml_spec.rb b/spec/views/new_user/dossiers/identite.html.haml_spec.rb index c9db3953e..38b6e709f 100644 --- a/spec/views/new_user/dossiers/identite.html.haml_spec.rb +++ b/spec/views/new_user/dossiers/identite.html.haml_spec.rb @@ -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 diff --git a/spec/views/new_user/dossiers/siret.html.haml_spec.rb b/spec/views/new_user/dossiers/siret.html.haml_spec.rb index 4b003ba33..318542e05 100644 --- a/spec/views/new_user/dossiers/siret.html.haml_spec.rb +++ b/spec/views/new_user/dossiers/siret.html.haml_spec.rb @@ -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