Sha256: f19127bad29f51e83af986abe02577891671775b6faff0213b02e7ff70545692

Contents?: true

Size: 780 Bytes

Versions: 13

Compression:

Stored size: 780 Bytes

Contents

module ThinkFeelDoDashboard
  module Concerns
    # Methods for browser type detection.
    module BrowserDetective
      extend ActiveSupport::Concern

      private

      # See http://richonrails.com/articles/action-pack-variants-in-rails-4-1
      def detect_browser
        request.variant = case request.user_agent
                          when /iPad/i
                            :tablet
                          when /iPhone|Windows Phone/i
                            :phone
                          when /Android/i && /mobile/i
                            :phone
                          when /Android/i
                            :tablet
                          else
                            :desktop
                          end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
think_feel_do_dashboard-1.2.0.beta1 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.21 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.20 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.19 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.18 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.17 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.16 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.15 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.14 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.13 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.12 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.11 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb
think_feel_do_dashboard-1.1.10 app/controllers/think_feel_do_dashboard/concerns/browser_detective.rb