Sha256: b3ac4a05eee28bf336a50b64b93c92df29b777bf77a08e2fdc8aa143196f0358

Contents?: true

Size: 1.29 KB

Versions: 22

Compression:

Stored size: 1.29 KB

Contents

# -*- coding: utf-8 -*-
ActiveSupport.on_load(:action_controller) do
  require 'jpmobile/docomo_guid'
  require 'jpmobile/filter'
  require 'jpmobile/helpers'
  require 'jpmobile/hook_action_controller'
  require 'jpmobile/hook_action_view'
  require 'jpmobile/trans_sid'
  require 'jpmobile/hook_test_request'
end
ActiveSupport.on_load(:action_dispatch) do
  require 'jpmobile/hook_action_dispatch'
end

ActiveSupport.on_load(:before_configuration) do
  # MobileCarrierのみデフォルトで有効
  ::Rails.application.middleware.insert_before('ActionDispatch::ParamsParser', Jpmobile::Rack::MobileCarrier)
  module Rails
    class Application
      class Configuration
        def jpmobile
          @jpmobile ||= ::Jpmobile::Configuration.new
        end
      end
    end
  end
end

module Jpmobile
  module ViewSelector
    def self.included(base)
      base.class_eval do
        before_filter :register_mobile

        self._view_paths = self._view_paths.dup
        self.view_paths.unshift(Jpmobile::Resolver.new(File.join(Rails.root, "app/views")))
      end
    end

    def register_mobile
      if request.mobile
        # register mobile
        self.lookup_context.mobile = request.mobile.variants
      end
    end

    def disable_mobile_view!
      self.lookup_context.mobile = nil
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
jpmobile-1.0.9 lib/jpmobile/rails.rb
jpmobile-2.0.8 lib/jpmobile/rails.rb
jpmobile-2.0.7 lib/jpmobile/rails.rb
jpmobile-2.0.6 lib/jpmobile/rails.rb
jpmobile-2.0.5 lib/jpmobile/rails.rb
jpmobile-1.0.8 lib/jpmobile/rails.rb
jpmobile-2.0.4 lib/jpmobile/rails.rb
jpmobile-2.0.3 lib/jpmobile/rails.rb
jpmobile-1.0.7 lib/jpmobile/rails.rb
jpmobile-1.0.6 lib/jpmobile/rails.rb
jpmobile-2.0.2 lib/jpmobile/rails.rb
jpmobile-2.0.1 lib/jpmobile/rails.rb
jpmobile-1.0.5 lib/jpmobile/rails.rb
jpmobile-2.0.0 lib/jpmobile/rails.rb
jpmobile-1.0.4 lib/jpmobile/rails.rb
jpmobile-1.0.3 lib/jpmobile/rails.rb
jpmobile-1.0.2 lib/jpmobile/rails.rb
jpmobile-1.0.1 lib/jpmobile/rails.rb
jpmobile-2.0.0.pre.2 lib/jpmobile/rails.rb
jpmobile-2.0.0.pre.1 lib/jpmobile/rails.rb