Module: Mongoid::Paperclip::Mobile::SplashScreen::ClassMethods

Defined in:
lib/mongoid/paperclip/mobile/splash_screen.rb

Instance Method Summary collapse

Instance Method Details

#has_mobile_web_splash_screen(field, options = { }) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mongoid/paperclip/mobile/splash_screen.rb', line 6

def has_mobile_web_splash_screen(field, options={ })
  if options[:styles]
    Rails.logger.warn ":style option for has_mobile_web_splash_screen :#{field} will be ignored."
  end

  l_opts = options.merge({  :styles => landscape_styles,
                            :default_url       => placeholder_image_url("1024x748", :text => "Missing")
                         })
  p_opts = options.merge({  :styles => portrait_styles,
                            :default_url       => placeholder_image_url("768x1004", :text => "Missing")
                         })



  #make sure that mongoid paperclip is included
  unless self.ancestors.include?(::Mongoid::Paperclip)
    include ::Mongoid::Paperclip
  end

  has_mongoid_attached_file("#{field}_landscape", l_opts)
  has_mongoid_attached_file("#{field}_portrait", p_opts)
end