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.
This commit is contained in:
Javi Martín
2023-07-17 23:34:38 +02:00
parent caf7387f27
commit 21a268ab96
8 changed files with 1 additions and 102 deletions

View File

@@ -52,7 +52,6 @@
//= require check_all_none //= require check_all_none
//= require comments //= require comments
//= require foundation_extras //= require foundation_extras
//= require ie_alert
//= require location_changer //= require location_changer
//= require moderator_comment //= require moderator_comment
//= require moderator_debates //= require moderator_debates
@@ -129,7 +128,6 @@ var initialize_modules = function() {
App.FoundationExtras.initialize(); App.FoundationExtras.initialize();
App.LocationChanger.initialize(); App.LocationChanger.initialize();
App.CheckAllNone.initialize(); App.CheckAllNone.initialize();
App.IeAlert.initialize();
App.AdvancedSearch.initialize(); App.AdvancedSearch.initialize();
App.RegistrationForm.initialize(); App.RegistrationForm.initialize();
App.Suggest.initialize(); App.Suggest.initialize();

View File

@@ -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);

View File

@@ -223,17 +223,6 @@ button,
color: $check; color: $check;
} }
.ie-callout {
position: absolute;
top: 0;
width: 100%;
.close {
font-size: rem-calc(34);
top: 20%;
}
}
.menu.simple { .menu.simple {
border-bottom: 1px solid $border; border-bottom: 1px solid $border;
clear: both; clear: both;

View File

@@ -17,34 +17,11 @@
<div class="wrapper <%= yield(:wrapper_class) %>"> <div class="wrapper <%= yield(:wrapper_class) %>">
<%= render "layouts/header", with_subnavigation: true %> <%= render "layouts/header", with_subnavigation: true %>
<% if request.headers["User-Agent"] =~ /MSIE/ && cookies["ie_alert_closed"] != "true" %>
<!--[if lt IE 9]>
<div data-alert class="callout primary ie-callout" data-closable>
<button class="close-button ie-callout-close-js"
aria-label="<%= t("application.close") %>" type="button" data-close>
<span aria-hidden="true">&times;</span>
</button>
<h2><%= t("layouts.application.ie_title") %></h2>
<p>
<%= sanitize(t("layouts.application.ie",
chrome: link_to(t("layouts.application.chrome"),
"https://www.google.com/chrome/browser/desktop/",
title: t("shared.target_blank"),
target: "_blank"),
firefox: link_to(t("layouts.application.firefox"),
"https://www.mozilla.org/firefox",
title: t("shared.target_blank"),
target: "_blank"))) %>
</p>
</div>
<![endif]-->
<% end %>
<%= render "layouts/flash" %> <%= render "layouts/flash" %>
<%= yield %> <%= yield %>
</div> </div>
<div class="footer"> <div class="footer">
<%= render Layout::FooterComponent.new %> <%= render Layout::FooterComponent.new %>
</div> </div>

View File

@@ -177,11 +177,6 @@ en:
geozones: geozones:
none: All city none: All city
layouts: 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: dashboard:
proposal_header: proposal_header:
published: Published published: Published

View File

@@ -177,11 +177,6 @@ es:
geozones: geozones:
none: Toda la ciudad none: Toda la ciudad
layouts: 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: dashboard:
proposal_header: proposal_header:
published: Publicada published: Publicada

View File

@@ -58,10 +58,6 @@ RSpec.configure do |config|
Capybara::Webmock.stop Capybara::Webmock.stop
end end
config.after(:each, :page_driver) do
page.driver.reset!
end
config.before(:each, type: :system) do |example| config.before(:each, type: :system) do |example|
driven_by :headless_chrome driven_by :headless_chrome
Capybara.default_set_options = { clear: :backspace } Capybara.default_set_options = { clear: :backspace }

View File

@@ -105,39 +105,6 @@ describe "Home" do
end end
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 describe "Menu button" do
scenario "is not present on large screens" do scenario "is not present on large screens" do
visit root_path visit root_path