is_it_iphone 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/is_it_iphone.rb +8 -6
- metadata +3 -3
data/lib/is_it_iphone.rb
CHANGED
@@ -7,18 +7,20 @@ module IsItIPhone
|
|
7
7
|
!!(request.env['HTTP_USER_AGENT'] && request.env['HTTP_USER_AGENT'][/(Mobile\/.+Safari)/])
|
8
8
|
end
|
9
9
|
|
10
|
-
# Returns true if the request or format parameter came from an iPhone
|
10
|
+
# Returns true if the request or format parameter came from an iPhone
|
11
11
|
def iphone_request?
|
12
12
|
params[:format] ? params[:format] == 'iphone' : iphone_user_agent?
|
13
13
|
end
|
14
14
|
|
15
|
-
# Call this as a before_filter if you
|
16
|
-
# the iPhone view (i.e., index.iphone.erb).
|
15
|
+
# Call this as a before_filter if you want to display
|
16
|
+
# the iPhone view (i.e., index.iphone.erb) if one exists.
|
17
17
|
# Note: According to Apple iPhone Web Developer guidelines, websites
|
18
|
-
# should show the normal page and then give the user the option to see
|
18
|
+
# should show the normal page and then give the user the option to see
|
19
19
|
# it formatted for their iPhone.
|
20
20
|
def adjust_format_for_iphone
|
21
|
-
|
21
|
+
|
22
|
+
if iphone_request? && File.exists?(File.join(RAILS_ROOT, 'app', 'views', self.controller_name, "#{self.action_name}.iphone.erb"))
|
23
|
+
request.format = :iphone
|
24
|
+
end
|
22
25
|
end
|
23
26
|
end
|
24
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: is_it_iphone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damon Danieli
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-09-05 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
46
|
requirements:
|
47
47
|
- none
|
48
48
|
rubyforge_project: Is It IPhone
|
49
|
-
rubygems_version: 1.0
|
49
|
+
rubygems_version: 1.2.0
|
50
50
|
signing_key:
|
51
51
|
specification_version: 2
|
52
52
|
summary: This gem checks for the iPhone user agent
|