Add platform attribute
This commit is contained in:
@@ -35,10 +35,26 @@ class ApplicationPlatform < PlatformAgent
|
||||
!mobile?
|
||||
end
|
||||
|
||||
def native?
|
||||
match? /Hotwire Native/
|
||||
end
|
||||
|
||||
def windows?
|
||||
operating_system == "Windows"
|
||||
end
|
||||
|
||||
def type
|
||||
if native? && android?
|
||||
"native android"
|
||||
elsif native? && ios?
|
||||
"native ios"
|
||||
elsif mobile?
|
||||
"mobile web"
|
||||
else
|
||||
"desktop web"
|
||||
end
|
||||
end
|
||||
|
||||
def operating_system
|
||||
case user_agent.platform
|
||||
when /Android/ then "Android"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<%= render "layouts/shared/head" %>
|
||||
|
||||
<body data-controller="local-time timezone-cookie turbo-navigation theme" data-action="turbo:morph@window->local-time#refreshAll turbo:before-visit@document->turbo-navigation#rememberLocation">
|
||||
<body data-controller="local-time timezone-cookie turbo-navigation theme" data-action="turbo:morph@window->local-time#refreshAll turbo:before-visit@document->turbo-navigation#rememberLocation" data-platform="<%= platform.type %>">
|
||||
<header class="header <%= @header_class %>" id="header">
|
||||
<a href="#main" class="header__skip-navigation btn" data-turbo="false">Skip to main content</a>
|
||||
<%= render "my/menu" if Current.user %>
|
||||
|
||||
Reference in New Issue
Block a user