mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Detect whether to use mobile view. Session var mobile_view can override automatic detection.
This commit is contained in:
@@ -19,6 +19,10 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
|
||||
def html_classes
|
||||
mobile_view? ? 'mobile' : ''
|
||||
end
|
||||
|
||||
def escape_unicode(javascript)
|
||||
if javascript
|
||||
javascript.gsub(/\342\200\250/u, '
').gsub(/(<\/)/u, '\u003C/').html_safe
|
||||
@@ -100,4 +104,12 @@ module ApplicationHelper
|
||||
def login_path
|
||||
return "#{Discourse::base_uri}/login"
|
||||
end
|
||||
|
||||
def mobile_view?
|
||||
if session[:mobile_view]
|
||||
session[:mobile_view] == '1'
|
||||
else
|
||||
request.user_agent =~ /Mobile|webOS/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user