mirror of
https://github.com/discourse/discourse.git
synced 2025-09-08 12:06:51 +08:00
Detect whether to use mobile view. Session var mobile_view can override automatic detection.
This commit is contained in:
parent
009dec833f
commit
9efa29e688
5 changed files with 46 additions and 1 deletions
|
@ -26,6 +26,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
before_filter :set_mobile_view
|
||||
before_filter :inject_preview_style
|
||||
before_filter :block_if_maintenance_mode
|
||||
before_filter :authorize_mini_profiler
|
||||
|
@ -117,6 +118,10 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def set_mobile_view
|
||||
session[:mobile_view] = params[:mobile_view] if params.has_key?(:mobile_view)
|
||||
end
|
||||
|
||||
|
||||
def inject_preview_style
|
||||
style = request['preview-style']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue