diff --git a/app/assets/stylesheets/base.css.scss b/app/assets/stylesheets/base.css.scss index cf43f619..38ad7054 100644 --- a/app/assets/stylesheets/base.css.scss +++ b/app/assets/stylesheets/base.css.scss @@ -101,4 +101,8 @@ body { .comment-count { margin-top: -2em; -} \ No newline at end of file +} + +.ios-web-app { + padding-top: 1em; +} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f8218a84..dc333f67 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index 48d2ad76..e74223e3 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -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 diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index c71325d2..9ff55266 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -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