mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-23 05:15:45 -04:00
Show mobile view as default for nexus 7 tablet
This commit is contained in:
parent
500a24ebf9
commit
07d08b81c7
2 changed files with 8 additions and 3 deletions
|
@ -119,6 +119,6 @@ module ApplicationHelper
|
|||
|
||||
def mobile_device?
|
||||
# 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
|
||||
|
|
|
@ -34,10 +34,15 @@ describe ApplicationHelper do
|
|||
helper.mobile_view?.should be_false
|
||||
end
|
||||
|
||||
it "is false for Android 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")
|
||||
it "is false for Nexus 10 tablet" do
|
||||
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
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue