diff --git a/app/assets/stylesheets/carte.scss b/app/assets/stylesheets/carte.scss index b0e5134e7..eb9f459a8 100644 --- a/app/assets/stylesheets/carte.scss +++ b/app/assets/stylesheets/carte.scss @@ -3,74 +3,10 @@ // You can use Sass (SCSS) here: http://sass-lang.com/ @import "bootstrap"; -#carte-page { - #map { - height: 600px; - z-index: 0; - } - - #map.edit { - width: 70%; - } - - .list { - margin-bottom: 20px; - - h3 { - margin-top: 0px; - } - - ul li { - margin-bottom: 10px; - } - } -} - .leaflet-container path { cursor: url("/assets/edit.png"), default !important; } -#map.mode-create { - cursor: url("/assets/pencil.png"), crosshair !important; -} - -#map g path.leaflet-polygon { - transition: all 0.25s; - stroke-width: 4px; - stroke-opacity: 1; - stroke: #D7217E; - position: absolute; - z-index: 100; - fill: #D7217E; - fill-opacity: 0.75; -} - -#map.mode-delete path.leaflet-polygon { - cursor: no-drop !important; - - &:hover { - fill: #4D4D4D !important; - } -} - -#map div.leaflet-edge { - box-shadow: 0 0 0 2px #FFFFFF, 0 0 10px rgba(0, 0, 0, 0.35); - border: 5px solid #D7217E; - border-radius: 10px; - transition: opacity 0.25s; - cursor: move; - opacity: 0; - pointer-events: none; - box-sizing: border-box; - width: 0 !important; - height: 0 !important; -} - -#map.mode-edit div.leaflet-edge { - opacity: 1; - pointer-events: all; -} - .info { padding: 6px 8px; font: 14px/16px Arial, Helvetica, sans-serif; diff --git a/app/assets/stylesheets/new_design/map.scss b/app/assets/stylesheets/new_design/map.scss index c7cb4c564..aa30790d2 100644 --- a/app/assets/stylesheets/new_design/map.scss +++ b/app/assets/stylesheets/new_design/map.scss @@ -1,4 +1,3 @@ -#map, .carte { height: 400px; margin-bottom: 16px; diff --git a/app/controllers/champs/siret_controller.rb b/app/controllers/champs/siret_controller.rb index 763146915..4923f6585 100644 --- a/app/controllers/champs/siret_controller.rb +++ b/app/controllers/champs/siret_controller.rb @@ -13,9 +13,9 @@ class Champs::SiretController < ApplicationController etablissement = find_etablisement_with_siret if etablissement.present? @etablissement = etablissement - if @champ.present? - etablissement.champ = @champ - etablissement.save! + + if !@champ.nil? + @champ.update!(value: etablissement.siret, etablissement: etablissement) end else @champ&.update!(value: '') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index efadf5712..28dc0af2a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -119,20 +119,4 @@ module ApplicationHelper {} end end - - def try_format_date(date) - begin - date.is_a?(String) ? Date.parse(date).strftime("%d %B %Y") : date.strftime("%d %B %Y") - rescue - date - end - end - - def try_format_datetime(datetime) - begin - datetime.is_a?(String) ? Time.zone.parse(datetime).strftime("%d %B %Y %R") : datetime.strftime("%d %B %Y %R") - rescue - datetime - end - end end diff --git a/app/javascript/new_design/carto.js b/app/javascript/new_design/carto.js deleted file mode 100644 index 310c8429b..000000000 --- a/app/javascript/new_design/carto.js +++ /dev/null @@ -1,25 +0,0 @@ -import { getData } from '../shared/data'; -import { - initMap, - drawCadastre, - drawQuartiersPrioritaires, - drawUserSelection -} from '../shared/carte'; - -function initialize() { - const element = document.getElementById('map'); - - if (element) { - const data = getData('carto'); - const map = initMap(element, data.position); - - // draw external polygons - drawCadastre(map, data); - drawQuartiersPrioritaires(map, data); - - // draw user polygon - drawUserSelection(map, data); - } -} - -addEventListener('turbolinks:load', initialize); diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 75f75f5d0..df20804b9 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -14,7 +14,6 @@ import '../shared/remote-input'; import '../shared/franceconnect'; import '../shared/toggle-target'; -import '../new_design/carto'; import '../new_design/dropdown'; import '../new_design/form-validation'; import '../new_design/select2'; diff --git a/app/views/demandes/new.html.haml b/app/views/demandes/new.html.haml index 43ab4aa3b..5cb4b83ad 100644 --- a/app/views/demandes/new.html.haml +++ b/app/views/demandes/new.html.haml @@ -3,12 +3,20 @@ - content_for :footer do = render partial: "root/footer" -.container.demande - %h1 Demande de compte administrateur - .card + +.container.demande + + %b + Étape 1 : demandez un compte administrateur + >> Étape 2 : recevez une confirmation par email >> Étape 3 : créez une démarche de test + %br + %br + %h1 Demande de compte administrateur pour créer une 1ère démarche de test + .card.featured .card-title Vous souhaitez seulement compléter une démarche sur notre site ? + %p Vous n'avez pas besoin de compte administrateur ! %p @@ -52,7 +60,8 @@ Vous utilisez un email orange, wanadoo, free, gmail etc. ? Merci de nous %a{ href: contact_admin_path, target:'_blank', rel: 'noopener' } contacter préalablement. - = email_field_tag :email, nil, placeholder: 'jean.martin@developpement-durable.gouv.fr', required: true + + = email_field_tag :email, nil, placeholder: 'jean.martin@developpement-durable.gouv.fr', required: true, pattern:'^.+@((?!hotmail)(?!gmail)(?!orange)(?!free)(?!wanadoo).)+\..+$',title:'Saisir un email valide et ne se finissant pas par Orange, Wanadoo, Free, etc.' = label_tag :phone do Quel est votre numéro de téléphone (ligne directe) ? @@ -90,4 +99,4 @@ %span.mandatory * = number_field_tag :nb_of_dossiers, nil, required: true - = submit_tag 'Envoyer', class: 'button', data: { disable: true } + = submit_tag 'Demander un compte administrateur pour créer une 1ère démarche de test', class: 'button primary expand large', data: { disable: true } diff --git a/app/views/root/administration.html.haml b/app/views/root/administration.html.haml index fc80e2490..df176903f 100644 --- a/app/views/root/administration.html.haml +++ b/app/views/root/administration.html.haml @@ -13,41 +13,51 @@ .hero-illustration %img{ :src => image_url("landing/hero/dematerialiser.svg"), alt: "" } - .landing-panel.usagers-panel - .container - .role-panel-wrapper.role-administrations-panel - .role-panel-30.role-administrations-image - %img.role-image{ :src => image_url("landing/roles/administrations.svg"), alt: "" } - - .role-panel-70 - %h1.role-panel-title Vous êtes une administration et êtes prête pour dématérialiser ? - %p.role-panel-explanation Créez des formulaires en ligne en quelques minutes et instruisez les demandes des usagers sur une plateforme dédiée - - = link_to "Demander un compte administrateur", - new_demande_path, - class: "role-panel-button-primary", - rel: "noopener noreferrer" - .landing-panel.more-info .container .role-panel-wrapper.role-administrations-panel .role-panel-70 - %h1.role-panel-title Vous voulez en savoir plus ? - %p.role-panel-explanation Découvrez notre outil + %h1.role-panel-title Est-ce fait pour mon administration ? + %p.role-panel-explanation Découvrez notre outil et posez nous vos questions lors de notre démonstration en ligne ou lisez notre documentation - = link_to "Contactez-nous", - contact_admin_path, + = link_to "Participer à notre démonstration en ligne", + "https://app.livestorm.co/demarches-simplifiees/presentation-general-de-demarches-simplifieesfr", rel: "noopener noreferrer", + target: "_blank", class: "role-panel-button-primary" - = link_to "Consultez notre documentation", + = link_to "Documentation", DOC_URL, rel: "noopener noreferrer", + target: "_blank", class: "role-panel-button-secondary" .role-panel-30.role-more-info-image %img.role-image{ :src => image_url("landing/roles/usagers.svg"), alt: "" } +.landing-panel.usagers-panel + .container + .role-panel-wrapper.role-administrations-panel + .role-panel-30.role-administrations-image + %img.role-image{ :src => image_url("landing/roles/administrations.svg"), alt: "" } + + .role-panel-70 + %h1.role-panel-title Votre administration est prête pour dématérialiser + %p.role-panel-explanation Créez un premier formulaire de test en quelques minutes + + + + = link_to "Créez une démarche de test", + new_demande_path, + class: "role-panel-button-primary", + rel: "noopener noreferrer" + %br + %br + %br + + + + .landing-panel.features-panel .container %ul.features @@ -194,15 +204,16 @@ .half.first-half %h1.cta-panel-title Vous êtes prêt pour dématérialiser ? %p.cta-panel-explanation Réduisez vos temps d'instruction de 50 % - = link_to "Demander un compte", + = link_to "Créer une démarche de test", new_demande_path, class: "cta-panel-button-blue" .half %h1.cta-panel-title Vous voulez en savoir plus ? - %p.cta-panel-explanation Nous vous faisons découvrir l'outil - = link_to "Contactez-nous", - contact_admin_path, + %p.cta-panel-explanation Participez à notre prochain Webinaire + = link_to "Inscription à notre webinaire", + "https://app.livestorm.co/demarches-simplifiees/presentation-general-de-demarches-simplifieesfr", + target: "_blank", class: "cta-panel-button-blue" .clearfix diff --git a/app/views/root/landing.html.haml b/app/views/root/landing.html.haml index 5469e3a2d..ed9c4df2d 100644 --- a/app/views/root/landing.html.haml +++ b/app/views/root/landing.html.haml @@ -80,8 +80,8 @@ .container .cta-panel-wrapper %div - %h1.cta-panel-title Vous êtes une administration ? - %p.cta-panel-explanation Vous souhaitez dématerialiser une démarche administrative ? + %h1.cta-panel-title Administration : vous voulez dématerialiser ? + %p.cta-panel-explanation Proposez à vos usagers de remplir leurs dossiers en ligne %div = link_to "Découvrez notre outil", administration_path, diff --git a/app/views/shared/dossiers/_champ_row.html.haml b/app/views/shared/dossiers/_champ_row.html.haml index 62f6feb87..361c6e786 100644 --- a/app/views/shared/dossiers/_champ_row.html.haml +++ b/app/views/shared/dossiers/_champ_row.html.haml @@ -30,10 +30,6 @@ = render partial: "shared/champs/siret/show", locals: { champ: c, profile: profile } - when TypeDeChamp.type_champs.fetch(:textarea) = render partial: "shared/champs/textarea/show", locals: { champ: c } - - when TypeDeChamp.type_champs.fetch(:date) - = try_format_date(c.to_s) - - when TypeDeChamp.type_champs.fetch(:datetime) - = try_format_datetime(c.to_s) - else = sanitize(c.to_s) diff --git a/app/views/shared/dossiers/_identite_entreprise.html.haml b/app/views/shared/dossiers/_identite_entreprise.html.haml index 33f0ce548..87be8390f 100644 --- a/app/views/shared/dossiers/_identite_entreprise.html.haml +++ b/app/views/shared/dossiers/_identite_entreprise.html.haml @@ -22,7 +22,7 @@ %td= etablissement.naf %tr %th.libelle Date de création : - %td= try_format_date(etablissement.entreprise.date_creation) + %td= etablissement.entreprise.date_creation&.strftime("%d/%m/%Y") %tr %th.libelle Effectif de l'organisation : %td= effectif(etablissement) @@ -64,10 +64,10 @@ %td= etablissement.association_objet %tr %th.libelle Date de création : - %td= try_format_date(etablissement.association_date_creation) + %td= etablissement.association_date_creation&.strftime("%d/%m/%Y") %tr %th.libelle Date de publication : - %td= try_format_date(etablissement.association_date_publication) + %td= etablissement.association_date_publication&.strftime("%d/%m/%Y") %tr %th.libelle Date de déclaration : - %td= try_format_date(etablissement.association_date_declaration) + %td= etablissement.association_date_declaration&.strftime("%d/%m/%Y") diff --git a/app/views/users/dossiers/etablissement/_infos_association.html.haml b/app/views/users/dossiers/etablissement/_infos_association.html.haml index d8afcbdb6..4fe9b8f91 100644 --- a/app/views/users/dossiers/etablissement/_infos_association.html.haml +++ b/app/views/users/dossiers/etablissement/_infos_association.html.haml @@ -13,12 +13,12 @@ %li Date de création : - = try_format_date(etablissement.association_date_creation) + = etablissement.association_date_creation&.strftime('%d/%m/%Y') %li Date de déclaration : - = try_format_date(etablissement.association_date_declaration) + = etablissement.association_date_declaration&.strftime('%d/%m/%Y') %li Date de publication : - = try_format_date(etablissement.association_date_publication) + = etablissement.association_date_publication&.strftime('%d/%m/%Y') diff --git a/app/views/users/dossiers/etablissement/_infos_entreprise.html.haml b/app/views/users/dossiers/etablissement/_infos_entreprise.html.haml index 9667a54bd..54f03b486 100644 --- a/app/views/users/dossiers/etablissement/_infos_entreprise.html.haml +++ b/app/views/users/dossiers/etablissement/_infos_entreprise.html.haml @@ -22,7 +22,7 @@ %li Date de création : - = try_format_date(etablissement.entreprise.date_creation) + = etablissement.entreprise.date_creation&.strftime('%d/%m/%Y') %li Effectif organisation : diff --git a/spec/controllers/champs/siret_controller_spec.rb b/spec/controllers/champs/siret_controller_spec.rb index dfacb8f36..154b3e4ca 100644 --- a/spec/controllers/champs/siret_controller_spec.rb +++ b/spec/controllers/champs/siret_controller_spec.rb @@ -6,7 +6,7 @@ describe Champs::SiretController, type: :controller do describe '#show' do let(:dossier) { create(:dossier, user: user, procedure: procedure) } - let(:champ) { create(:champ_siret, dossier: dossier) } + let(:champ) { create(:champ_siret, dossier: dossier, value: nil, etablissement: nil) } let(:params) do { champ_id: champ.id, diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 6998f17d2..30a7becef 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -17,62 +17,4 @@ describe ApplicationHelper do it { is_expected.to be_nil } end end - - describe "#try_format_date" do - subject { try_format_date(date) } - - describe 'try formatting 2019-01-24' do - let(:date) { "2019-01-24" } - it { is_expected.to eq("24 January 2019") } - end - - describe 'try formatting 24/01/2019' do - let(:date) { "24/01/2019" } - it { is_expected.to eq("24 January 2019") } - end - - describe 'try formatting 2019-01-32' do - let(:date) { "2019-01-32" } - it { is_expected.to eq("2019-01-32") } - end - - describe 'try formatting a blank string' do - let(:date) { "" } - it { is_expected.to eq("") } - end - - describe 'try formatting a nil string' do - let(:date) { nil } - it { is_expected.to be_nil } - end - end - - describe "#try_format_datetime" do - subject { try_format_datetime(datetime) } - - describe 'try formatting 31/01/2019 11:25' do - let(:datetime) { "31/01/2019 11:25" } - it { is_expected.to eq("31 January 2019 11:25") } - end - - describe 'try formatting 2019-01-31 11:25' do - let(:datetime) { "2019-01-31 11:25" } - it { is_expected.to eq("31 January 2019 11:25") } - end - - describe 'try formatting 2019-01-32 11:25' do - let(:datetime) { "2019-01-32 11:25" } - it { is_expected.to eq("2019-01-32 11:25") } - end - - describe 'try formatting a blank string' do - let(:datetime) { "" } - it { is_expected.to eq("") } - end - - describe 'try formatting a nil string' do - let(:datetime) { nil } - it { is_expected.to be_nil } - end - end end