Sha256: 542e74c2b03297f0fe20a6986ed81ff036e1342779e045369af07ed04dae6988

Contents?: true

Size: 820 Bytes

Versions: 1

Compression:

Stored size: 820 Bytes

Contents

module MobileFu
  module Helper
    def js_enabled_mobile_device?
      is_device?('iphone') || is_device?('ipod') || is_device?('ipad') || is_device?('mobileexplorer') || is_device?('android')
    end

    def stylesheet_link_tag_with_mobilization(*sources)
      mobilized_sources = Array.new
      sources.each do |source|
        mobilized_sources << source

        device_names = is_mobile_device? ? ['mobile', mobile_device.downcase] : []

        device_names.compact.each do |device_name|
          possible_source = "#{source.to_s.gsub '.css', ''}_#{device_name}.css"
          path = File.join config.stylesheets_dir, possible_source
          mobilized_sources << possible_source if File.exist?(path)
        end
      end

      stylesheet_link_tag_without_mobilization *mobilized_sources
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mobile-fu-0.2.0 lib/mobile-fu/helper.rb