Merge branch 'master' of git.rrerr.net:nilsding/justask

This commit is contained in:
nilsding 2014-12-07 11:04:45 +01:00
commit a8b8dd31e0
4 changed files with 15 additions and 3 deletions

View File

@ -101,4 +101,8 @@ body {
.comment-count {
margin-top: -2em;
}
}
.ios-web-app {
padding-top: 1em;
}

View File

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

View File

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

View File

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