mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:01:18 +08:00
Re-apply with fixes: Stop using user agent to detect mobile devices. Use a media query and yepnope to load the appropriate css and customizations.
This commit is contained in:
@ -19,10 +19,6 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
|
||||
def html_classes
|
||||
"#{mobile_view? ? 'mobile-view' : 'desktop-view'} #{mobile_device? ? 'mobile-device' : 'not-mobile-device'}"
|
||||
end
|
||||
|
||||
def escape_unicode(javascript)
|
||||
if javascript
|
||||
javascript = javascript.dup.force_encoding("utf-8")
|
||||
@ -115,18 +111,8 @@ module ApplicationHelper
|
||||
"#{Discourse::base_uri}/login"
|
||||
end
|
||||
|
||||
def mobile_view?
|
||||
return false unless SiteSetting.enable_mobile_theme
|
||||
if session[:mobile_view]
|
||||
session[:mobile_view] == '1'
|
||||
else
|
||||
mobile_device?
|
||||
end
|
||||
end
|
||||
|
||||
def mobile_device?
|
||||
# TODO: this is dumb. user agent matching is a doomed approach. a better solution is coming.
|
||||
request.user_agent =~ /Mobile|webOS|Nexus 7/ and !(request.user_agent =~ /iPad/)
|
||||
def stylesheet_filenames(target=:desktop)
|
||||
[asset_path("#{target}.css"), customization_disabled? ? nil : SiteCustomization.custom_stylesheet_path(session[:preview_style], target)].compact
|
||||
end
|
||||
|
||||
def customization_disabled?
|
||||
|
Reference in New Issue
Block a user