OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/helpers/browser_helper.rb

40 lines
1.1 KiB

module BrowserHelper
##
# Instead of defining what makes up a modern user,
# only define those where we want to show a warning.
#
# Uses the +browser+ gem.
def unsupported_browser?
RequestStore.fetch(:unsupported_browser) do
# Any version of IE
return true if browser.ie?
version = browser.version.to_i
# Older versions behind last ESR FF
return true if browser.firefox? && version < 60
# Older version of safari
return true if browser.safari? && version < 12
false
end
end
##
# Browser specific classes for browser-specific fixes
# or mobile detection
def browser_specific_classes
[].tap do |classes|
classes << '-browser-chrome' if browser.chrome?
classes << '-browser-firefox' if browser.firefox?
classes << '-browser-safari' if browser.safari?
classes << '-browser-edge' if browser.edge?
classes << '-browser-mobile' if browser.device.mobile?
classes << '-browser-windows' if browser.platform.windows?
classes << '-unsupported-browser' if unsupported_browser?
end
end
end