iOS web app things
This commit is contained in:
parent
a2e1e2557b
commit
382277adf0
|
@ -102,3 +102,7 @@ body {
|
|||
.comment-count {
|
||||
margin-top: -2em;
|
||||
}
|
||||
|
||||
.ios-web-app {
|
||||
padding-top: 1em;
|
||||
}
|
||||
|
|
|
@ -54,4 +54,12 @@ module ApplicationHelper
|
|||
return '//www.gravatar.com/avatar' if user.nil?
|
||||
"//www.gravatar.com/avatar/#{Digest::MD5.hexdigest(user.email)}"
|
||||
end
|
||||
|
||||
def ios_web_app?
|
||||
user_agent = request.env['HTTP_USER_AGENT']
|
||||
# normal MobileSafari.app UA: Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B435 Safari/600.1.4
|
||||
# webapp UA: Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B435
|
||||
return true if user_agent.match /^Mozilla\/\d+\.\d+ \(i(?:Phone|Pad|Pod); CPU(?:.*) like Mac OS X\)(?:.*) Mobile(?:\S*)$/
|
||||
false
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%nav.navbar.navbar-inverse.navbar-fixed-top{role: "navigation"}
|
||||
.container
|
||||
.container{class: ios_web_app? ? "ios-web-app" : ''}
|
||||
.navbar-header
|
||||
%button.navbar-toggle{"data-target" => "#j2-main-navbar-collapse", "data-toggle" => "collapse", type: "button"}
|
||||
%span.sr-only Toggle navigation
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%meta{name: 'viewport', content: 'width=device-width, initial-scale=1, user-scalable=no'}
|
||||
%meta{name: 'theme-color', content: '#0C84E4'}
|
||||
%meta{name: "apple-mobile-web-app-capable", content: "yes"}
|
||||
%meta{name: 'apple-mobile-web-app-status-bar-style', content: 'default'}
|
||||
%meta{name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent'}
|
||||
%title= APP_CONFIG['site_name']
|
||||
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
||||
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
||||
|
|
Loading…
Reference in New Issue