diff --git a/.babelrc b/.babelrc index ded31c0d8..714f21eae 100644 --- a/.babelrc +++ b/.babelrc @@ -3,7 +3,16 @@ ["env", { "modules": false, "targets": { - "browsers": "> 1%", + // See config/browser.rb + "browsers": [ + "> 1%", + "Chrome 40", + "IE 11", + "Edge 12", + "Firefox 45", + "Safari 8", + "iOS 8" + ], "uglify": true }, "useBuiltIns": true diff --git a/README.md b/README.md index bb1c41a6d..ea03f7c33 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ Pour les lister: `bin/rake -D support:`. ## Compatibilité navigateurs -L'application supporte les navigateurs récents Firefox, Chrome, Internet Explorer (Edge, 11). +L'application supporte les navigateurs récents : Firefox, Chrome, Safari, Edge et Internet Explorer 11 (voir `config/browser.rb`). La compatibilité est testée par Browserstack. diff --git a/app/assets/stylesheets/new_design/support_navigator_banner.scss b/app/assets/stylesheets/new_design/support_navigator_banner.scss new file mode 100644 index 000000000..956c82ec4 --- /dev/null +++ b/app/assets/stylesheets/new_design/support_navigator_banner.scss @@ -0,0 +1,20 @@ +@import "colors"; +@import "constants"; + +#support-navigator-banner { + position: fixed; + width: 100%; + bottom: 0; + left: 0; + margin: 0; + padding: $default-padding; + text-align: center; + color: #FFFFFF; + background-color: $medium-red; + z-index: 1000; + + a { + color: #C3D9FF; + text-decoration: underline; + } +} diff --git a/app/javascript/packs/application-old.js b/app/javascript/packs/application-old.js index a4f7c54ed..6926ac025 100644 --- a/app/javascript/packs/application-old.js +++ b/app/javascript/packs/application-old.js @@ -6,6 +6,11 @@ import Highcharts from 'highcharts'; import Bloodhound from 'bloodhound-js'; import jQuery from 'jquery'; +// Include runtime-polyfills for older browsers. +// Due to .babelrc's 'useBuiltIns', only polyfills actually +// required by the browsers we support will be included. +import 'babel-polyfill'; + import 'select2'; import 'typeahead.js'; diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 78649f91c..73f5862e8 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -6,6 +6,11 @@ import Chartkick from 'chartkick'; import Highcharts from 'highcharts'; import jQuery from 'jquery'; +// Include runtime-polyfills for older browsers. +// Due to .babelrc's 'useBuiltIns', only polyfills actually +// required by the browsers we support will be included. +import 'babel-polyfill'; + import 'select2'; import 'typeahead.js'; diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 12d6eb53a..ce7dbae03 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -291,9 +291,11 @@ class Dossier < ApplicationRecord deleted_dossier = DeletedDossier.create!(dossier_id: id, procedure: procedure, state: state, deleted_at: now) update(hidden_at: now) - administration_emails = followers_gestionnaires.present? ? followers_gestionnaires.pluck(:email) : [procedure.administrateur.email] - administration_emails.each do |email| - DossierMailer.notify_deletion_to_administration(deleted_dossier, email).deliver_later + if en_construction? + administration_emails = followers_gestionnaires.present? ? followers_gestionnaires.pluck(:email) : [procedure.administrateur.email] + administration_emails.each do |email| + DossierMailer.notify_deletion_to_administration(deleted_dossier, email).deliver_later + end end DossierMailer.notify_deletion_to_user(deleted_dossier, user.email).deliver_later end diff --git a/app/views/layouts/_ie_lt_10.html.haml b/app/views/layouts/_ie_lt_10.html.haml deleted file mode 100644 index 53af69557..000000000 --- a/app/views/layouts/_ie_lt_10.html.haml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/app/views/layouts/_support_navigator_banner.html.haml b/app/views/layouts/_support_navigator_banner.html.haml index 5f6cf628e..95f7955d1 100644 --- a/app/views/layouts/_support_navigator_banner.html.haml +++ b/app/views/layouts/_support_navigator_banner.html.haml @@ -1,7 +1,13 @@ +-# See config/browser.rb - if !browser.modern? #support-navigator-banner.row .col-xs-12 = browser.name = browser.version \- - Attention, votre navigateur n'est pas recommandé pour la navigation sur ce site internet. Aucun support ne pourra vous être prodigué en cas de dysfonctionnement. + Attention, votre navigateur est trop ancien pour utiliser Démarches Simplifiées : certaines parties du site ne fonctionneront pas correctement. + %br/ + %br/ + Nous vous recommendons fortement de + %a{ href: "https://browser-update.org/fr/update.html" }mettre à jour votre navigateur + \. diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index eda75709c..cc6e06cb7 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -25,8 +25,6 @@ #beta Env Test - = render partial: 'layouts/ie_lt_10' - #wrap .row #header.navbar diff --git a/app/views/layouts/new_application.html.haml b/app/views/layouts/new_application.html.haml index 493377efc..661a8990c 100644 --- a/app/views/layouts/new_application.html.haml +++ b/app/views/layouts/new_application.html.haml @@ -26,7 +26,6 @@ %body .page-wrapper = render partial: "layouts/support_navigator_banner" - = render partial: "layouts/ie_lt_10" = render partial: 'layouts/pre_maintenance' - if Rails.env == "staging" #beta diff --git a/config/initializers/browser.rb b/config/initializers/browser.rb index 647ce8a39..eb506559f 100644 --- a/config/initializers/browser.rb +++ b/config/initializers/browser.rb @@ -1,6 +1,7 @@ +# See .babelrc Browser.modern_rules.clear Browser.modern_rules << -> b { b.chrome? && b.version.to_i >= 40 } -Browser.modern_rules << -> b { b.ie?([">=10"]) } +Browser.modern_rules << -> b { b.ie?([">=11"]) } Browser.modern_rules << -> b { b.edge? } Browser.modern_rules << -> b { b.firefox? && b.version.to_i >= 45 } Browser.modern_rules << -> b { b.opera? && b.version.to_i >= 19 } diff --git a/spec/controllers/new_user/dossiers_controller_spec.rb b/spec/controllers/new_user/dossiers_controller_spec.rb index 3d891b1f9..15f75cae1 100644 --- a/spec/controllers/new_user/dossiers_controller_spec.rb +++ b/spec/controllers/new_user/dossiers_controller_spec.rb @@ -498,7 +498,7 @@ describe NewUser::DossiersController, type: :controller do end context 'when dossier is owned by signed in user' do - let(:dossier) { create(:dossier, user: user, autorisation_donnees: true) } + let(:dossier) { create(:dossier, :en_construction, user: user, autorisation_donnees: true) } it do expect(DossierMailer).to receive(:notify_deletion_to_administration).with(kind_of(DeletedDossier), dossier.procedure.administrateur.email).and_return(double(deliver_later: nil)) diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index dbc79fffe..e873d2448 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -859,7 +859,7 @@ describe Dossier do end context 'where gestionnaires are following the dossier' do - let(:dossier) { create(:dossier, :followed) } + let(:dossier) { create(:dossier, :en_construction, :followed) } let!(:non_following_gestionnaire) do non_following_gestionnaire = create(:gestionnaire) non_following_gestionnaire.procedures << dossier.procedure @@ -873,11 +873,19 @@ describe Dossier do end context 'when there are no following gestionnaires' do + let(:dossier) { create(:dossier, :en_construction) } it 'notifies the procedure administrateur' do expect(DossierMailer).to have_received(:notify_deletion_to_administration).once expect(DossierMailer).to have_received(:notify_deletion_to_administration).with(deleted_dossier, dossier.procedure.administrateur.email) end end + + context 'when dossier is brouillon' do + let(:dossier) { create(:dossier) } + it 'do not notifies the procedure administrateur' do + expect(DossierMailer).not_to have_received(:notify_deletion_to_administration) + end + end end describe 'webhook' do