Module: Mongoid::Paperclip::Mobile::Helper

Extended by:
ActiveSupport::Concern
Defined in:
lib/mongoid/paperclip/mobile/helper.rb

Instance Method Summary collapse

Instance Method Details

#mobile_app_helper(icon, splash, *args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/mongoid/paperclip/mobile/helper.rb', line 7

def mobile_app_helper(icon,splash,*args)
  content = String.new
  content.concat((:meta,'',
                             :name => "apple-mobile-web-app-capable",
                             :content => "yes"))
  content.concat((:meta,'',
                             :name => "apple-touch-fullscreen",
                             :content => "yes"))
  content.concat((:meta,'',
                             :name => "viewport",
                             :content => "width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"))
  content.concat((:meta,'',
                             :name => "apple-mobile-web-app-status-bar-style",
                             :content => "black"))

  content.concat("<!-- Mobile Web App Icons -->\n")

  content.concat(link_tag(:rel => "apple-touch-icon-precomposed",
                                    :sizes => "72x72",
                                    :href => icon.url(:ipad)))


  content.concat(link_tag(:rel => "apple-touch-icon-precomposed",
                          :sizes => "114x114",
                          :href => icon.url(:iphone_retina)))
  content.concat(link_tag(:rel => "apple-touch-icon-precomposed",
                          :href => icon.url(:iphone)))
  content.concat(link_tag(:rel => "apple-touch-icon-precomposed",
                          :sizes => "144x144",
                          :href => icon.url(:ipad_retina)))
  content.concat("\n<!-- END Mobile Web App Icons -->")

  content.concat("\n<!-- Mobile Web App Splash Screen -->")

  content.concat("\n\t\t<!-- iPhone 3g/3gs -->")
  content.concat(link_tag(:rel => "apple-touch-startup-image",
                          :href => splash[:portrait].url(:iphone)))
  #
  #content.concat("\n\t\t<!-- iPhone 4/4s -->")
  #content.concat(link_tag(:rel => "apple-touch-startup-image",
  #                        :href => splash[:portrait].url(:iphone_retina),
  #                        :media => "(max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)"))

  content.concat("\n\t\t<!-- iPad-->")
  content.concat(link_tag(:rel => "apple-touch-startup-image",
                          :href => splash[:portrait].url(:ipad),
                          :media => "screen and (min-device-width: 481px) and (max-device-width: 768px) and (orientation:portrait)",
                          ))
  content.concat(link_tag(:rel => "apple-touch-startup-image",
                          :href => splash[:landscape].url(:ipad),
                          :media => "screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)",
                          ))
#<link rel="apple-touch-startup-image" href="touch-splash-ipad-land.png"  media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)" />
#<link rel="apple-touch-startup-image" href="touch-splash-ipad-port.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)" />
  content.concat("\n<!-- END Mobile Web App Splash Screen -->")
  content.html_safe
end