Module: MobileFu::ActionView::HelperMethods

Defined in:
lib/mobile_fu/helper_methods.rb

Constant Summary collapse

ACCEPTABLE_TYPES =
[:mobile, :basic]

Instance Method Summary collapse

Instance Method Details

#js_enabled_mobile_device?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/mobile_fu/helper_methods.rb', line 21

def js_enabled_mobile_device?
  is_device?('iphone') or is_device?('ipod') or is_device?('ipad') or is_device?('mobileexplorer') or is_device?('android')
end

#mobile_xhtml_doctype(type = :mobile, version = '1.0') ⇒ Object

Raises:

  • (Exception)


6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/mobile_fu/helper_methods.rb', line 6

def mobile_xhtml_doctype(type = :mobile, version = '1.0')
  raise Exception.new("MobileFu: XHTML DOCTYPE type must either be ':mobile' or ':basic'") unless ACCEPTABLE_TYPES.include?(type)
  raise Exception.new("MobileFu: XHTML DOCTYPE version must be in the format of '1.0' or '1.1', etc.") unless version.include?('.')
    
  doc_type = "<?xml version=\"1.0\" charset=\"UTF-8\" ?>\n"
  doc_type << "<!DOCTYPE html PUBLIC "
  doc_type << case type
              when :mobile
                "\"-//WAPFORUM//DTD XHTML Mobile #{version}//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile#{version.gsub('.','')}.dtd\">"
              when :basic
                "\"-//W3C//DTD XHTML Basic #{version}//EN\" \"http://www.w3.org/TR/xhtml-basic/xhtml-basic#{version.gsub('.','')}.dtd\">"
              end
  doc_type
end