From 6e91e94888aa6f81b00b181757fc7e224503e23e Mon Sep 17 00:00:00 2001 From: Mohd Zaid Date: Wed, 15 Feb 2012 07:22:57 +0800 Subject: [PATCH] fixed #9 #11 removed mobile user agent and fixed readme --- README.md | 7 +++---- lib/mobile-fu.rb | 11 +---------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index acbbe39..eb73d8f 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,9 @@ set as :mobile format. It is up to you to determine how you want to handle these requests. It is also up to you to create the .mobile.erb versions of your views that are to be requested. -Then add the line below to config/initializers/mime_types.rb - - Mime::Type.register_alias "text/html", :mobile - Mime::Type.register_alias "text/html", :tablet +Mobile Fu automatically adds a new `:mobile` and `:tablet` to `text/html` mime type +alias for Rails apps. If you already have a custom `:mobile` alias registered in +`config/initializers/mime_types.rb`, you can remove that. I recommend that you setup a before_filter that will redirect to a specific page depending on whether or not it is a mobile request. How can you check this? diff --git a/lib/mobile-fu.rb b/lib/mobile-fu.rb index 6d25917..d96a09a 100644 --- a/lib/mobile-fu.rb +++ b/lib/mobile-fu.rb @@ -31,18 +31,9 @@ class Railtie < Rails::Railtie module ActionController module MobileFu - # These are various strings that can be found in mobile devices. Please feel free - # to add on to this list. - MOBILE_USER_AGENTS = 'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' + - 'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' + - 'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' + - 'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' + - 'webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|' + - 'mobile' - # These are various strings that can be found in tablet devices. Please feel free # to add on to this list. - TABLET_USER_AGENTS = 'ipad|android 3.0|xoom|sch-i800|playbook|tablet|kindle' + TABLET_USER_AGENTS = 'ipad|android 3.0|xoom|sch-i800|playbook|tablet|kindle|honeycomb' def self.included(base) base.extend ClassMethods