mirror of
https://github.com/discourse/discourse.git
synced 2025-04-28 04:54:32 +08:00
Show mobile view as default for nexus 7 tablet
This commit is contained in:
parent
500a24ebf9
commit
07d08b81c7
@ -119,6 +119,6 @@ module ApplicationHelper
|
|||||||
|
|
||||||
def mobile_device?
|
def mobile_device?
|
||||||
# TODO: this is dumb. user agent matching is a doomed approach. a better solution is coming.
|
# TODO: this is dumb. user agent matching is a doomed approach. a better solution is coming.
|
||||||
request.user_agent =~ /Mobile|webOS/ and !(request.user_agent =~ /iPad/)
|
request.user_agent =~ /Mobile|webOS|Nexus 7/ and !(request.user_agent =~ /iPad/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -34,10 +34,15 @@ describe ApplicationHelper do
|
|||||||
helper.mobile_view?.should be_false
|
helper.mobile_view?.should be_false
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is false for Android tablet" do
|
it "is false for Nexus 10 tablet" do
|
||||||
controller.request.stubs(:user_agent).returns("Mozilla/5.0 (Linux; Android 4.1.2; Nexus 7 Build/JZ054K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19")
|
controller.request.stubs(:user_agent).returns("Mozilla/5.0 (Linux; Android 4.2.1; Nexus 10 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19")
|
||||||
helper.mobile_view?.should be_false
|
helper.mobile_view?.should be_false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "is true for Nexus 7 tablet" do
|
||||||
|
controller.request.stubs(:user_agent).returns("Mozilla/5.0 (Linux; Android 4.1.2; Nexus 7 Build/JZ054K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19")
|
||||||
|
helper.mobile_view?.should be_true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user