From 21a268ab9658cf4d181f542f52a5bc4c9a1206a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 17 Jul 2023 23:34:38 +0200 Subject: [PATCH] Remove alert for Internet Explorer 8 and below Internet Explorer 8 was released in 2009 and people using it already know that most web pages look broken on it, so we don't need to warn them. Removing it makes our application layout file much easier to read and modify. --- app/assets/javascripts/application.js | 2 -- app/assets/javascripts/ie_alert.js | 18 -------------- app/assets/stylesheets/layout.scss | 11 --------- app/views/layouts/application.html.erb | 25 +------------------ config/locales/en/general.yml | 5 ---- config/locales/es/general.yml | 5 ---- spec/spec_helper.rb | 4 ---- spec/system/home_spec.rb | 33 -------------------------- 8 files changed, 1 insertion(+), 102 deletions(-) delete mode 100644 app/assets/javascripts/ie_alert.js diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index b7c650a5e..0b8813002 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -52,7 +52,6 @@ //= require check_all_none //= require comments //= require foundation_extras -//= require ie_alert //= require location_changer //= require moderator_comment //= require moderator_debates @@ -129,7 +128,6 @@ var initialize_modules = function() { App.FoundationExtras.initialize(); App.LocationChanger.initialize(); App.CheckAllNone.initialize(); - App.IeAlert.initialize(); App.AdvancedSearch.initialize(); App.RegistrationForm.initialize(); App.Suggest.initialize(); diff --git a/app/assets/javascripts/ie_alert.js b/app/assets/javascripts/ie_alert.js deleted file mode 100644 index 7f447d8c9..000000000 --- a/app/assets/javascripts/ie_alert.js +++ /dev/null @@ -1,18 +0,0 @@ -(function() { - "use strict"; - App.IeAlert = { - set_cookie_and_hide: function(event) { - event.preventDefault(); - $.cookie("ie_alert_closed", "true", { - path: "/", - expires: 365 - }); - $(".ie-callout").remove(); - }, - initialize: function() { - $(".ie-callout-close-js").on("click", function(event) { - App.IeAlert.set_cookie_and_hide(event); - }); - } - }; -}).call(this); diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 568e36891..9c3780f56 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -223,17 +223,6 @@ button, color: $check; } -.ie-callout { - position: absolute; - top: 0; - width: 100%; - - .close { - font-size: rem-calc(34); - top: 20%; - } -} - .menu.simple { border-bottom: 1px solid $border; clear: both; diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8cdffdce9..58cffe017 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -17,34 +17,11 @@
<%= render "layouts/header", with_subnavigation: true %> - - <% if request.headers["User-Agent"] =~ /MSIE/ && cookies["ie_alert_closed"] != "true" %> - - <% end %> - <%= render "layouts/flash" %> <%= yield %>
+ diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index 8c2bd991f..0be47b5a9 100644 --- a/config/locales/en/general.yml +++ b/config/locales/en/general.yml @@ -177,11 +177,6 @@ en: geozones: none: All city layouts: - application: - chrome: Google Chrome - firefox: Firefox - ie: We have detected that you are browsing with Internet Explorer. For an enhanced experience, we recommend using %{firefox} or %{chrome}. - ie_title: This website is not optimised for your browser dashboard: proposal_header: published: Published diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index f2f25146c..e40c5b43d 100644 --- a/config/locales/es/general.yml +++ b/config/locales/es/general.yml @@ -177,11 +177,6 @@ es: geozones: none: Toda la ciudad layouts: - application: - chrome: Google Chrome - firefox: Firefox - ie: Hemos detectado que estás navegando desde Internet Explorer. Para una mejor experiencia te recomendamos utilizar %{firefox} o %{chrome}. - ie_title: Esta web no está optimizada para tu navegador dashboard: proposal_header: published: Publicada diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f47bafa8d..e13a80f99 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -58,10 +58,6 @@ RSpec.configure do |config| Capybara::Webmock.stop end - config.after(:each, :page_driver) do - page.driver.reset! - end - config.before(:each, type: :system) do |example| driven_by :headless_chrome Capybara.default_set_options = { clear: :backspace } diff --git a/spec/system/home_spec.rb b/spec/system/home_spec.rb index 053cef2ee..0fb882e75 100644 --- a/spec/system/home_spec.rb +++ b/spec/system/home_spec.rb @@ -105,39 +105,6 @@ describe "Home" do end end - describe "IE alert", :no_js do - scenario "IE visitors are presented with an alert until they close it", :page_driver do - # Selenium API does not include page request/response inspection methods - # so we must use Capybara::RackTest driver to set the browser's headers - Capybara.current_session.driver.header( - "User-Agent", - "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)" - ) - - visit root_path - expect(page).to have_xpath(ie_alert_box_xpath) - expect(page.driver.request.cookies["ie_alert_closed"]).to be nil - - # faking close button, since a normal find and click - # will not work as the element is inside a HTML conditional comment - page.driver.browser.set_cookie("ie_alert_closed=true") - - visit root_path - expect(page).not_to have_xpath(ie_alert_box_xpath) - expect(page.driver.request.cookies["ie_alert_closed"]).to eq("true") - end - - scenario "non-IE visitors are not bothered with IE alerts", :page_driver do - visit root_path - expect(page).not_to have_xpath(ie_alert_box_xpath) - expect(page.driver.request.cookies["ie_alert_closed"]).to be nil - end - - def ie_alert_box_xpath - "/html/body/div[@class='wrapper ']/comment()[contains(.,'ie-callout')]" - end - end - describe "Menu button" do scenario "is not present on large screens" do visit root_path