Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:tscolari/mobylette into revering_…

…n_refactoring

Conflicts:
	lib/mobylette/controllers/respond_to_mobile_requests.rb
  • Loading branch information...
commit c762af8841fd50d444b1cb9a2555b9a742e8a7cc 2 parents 8408684 + 413e91c
Tiago Scolari tscolari authored
2  Gemfile.lock
View
@@ -179,7 +179,7 @@ GEM
sprockets (2.0.0)
hike (~> 1.2)
rack (~> 1.0)
- tilt (!= 1.3.0, ~> 1.1)
+ tilt (~> 1.1, != 1.3.0)
syntax (1.0.0)
term-ansicolor (1.0.6)
thor (0.14.6)
25 lib/mobylette/controllers/respond_to_mobile_requests.rb
View
@@ -42,18 +42,14 @@ def respond_to_mobile_requests(options = {})
return if self.included_modules.include?(Mobylette::Controllers::RespondToMobileRequestsMethods)
options.reverse_merge!({
- :skip_xhr_requests => true,
- :ignore_mobile_view_path => false
+ :skip_xhr_requests => true
})
- cattr_accessor :mobylette_fall_back_format
- self.mobylette_fall_back_format = options[:fall_back]
-
- cattr_accessor :mobylette_skip_xhr_requests
- self.mobylette_skip_xhr_requests = options[:skip_xhr_requests]
-
- cattr_accessor :mobylette_ignore_mobile_view_path
- self.mobylette_ignore_mobile_view_path = options[:ignore_mobile_view_path]
+ cattr_accessor :mobylette_options
+ # works on 1.9, but not on 1.8
+ #valid_options = [:fall_back, :skip_xhr_requests]
+ #self.mobylette_options = options.reject {|option| !valid_options.include?(option)}
+ self.mobylette_options = options
self.send(:include, Mobylette::Controllers::RespondToMobileRequestsMethods)
end
@@ -75,9 +71,7 @@ def is_mobile_request?
def is_mobile_view?
true if (request.format.to_s == "mobile") or (params[:format] == "mobile")
end
-
end
-
end
# RespondToMobileRequestsMethods is included by respond_to_mobile_requests
@@ -107,7 +101,7 @@ def force_mobile_by_session?
# Returns true only if treating XHR requests (when skip_xhr_requests are set to false) or
# or when this is a non xhr request
def processing_xhr_requests?
- not self.mobylette_skip_xhr_requests && request.xhr?
+ not self.mobylette_options[:skip_xhr_requests] && request.xhr?
end
# :doc:
@@ -119,11 +113,12 @@ def handle_mobile
original_format = request.format.to_sym
request.format = :mobile
- if self.mobylette_fall_back_format != false
- request.formats << Mime::Type.new(self.mobylette_fall_back_format || original_format)
+ if self.mobylette_options[:fall_back] != false
+ request.formats << Mime::Type.new(self.mobylette_options[:fall_back] || original_format)
end
end
end
+
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.