iphone_helpers 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/iphone_helpers/version.rb +1 -1
- data/lib/iphone_helpers.rb +13 -10
- metadata +9 -9
data/lib/iphone_helpers.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'action_view'
|
2
2
|
|
3
3
|
module IphoneHelpers
|
4
|
+
STATUS_BAR_COLORS = %w[black black-translucent]
|
5
|
+
|
4
6
|
def iphone(key, options = {})
|
5
7
|
tagname, attributes = send(key, options)
|
6
8
|
|
@@ -11,8 +13,8 @@ module IphoneHelpers
|
|
11
13
|
|
12
14
|
def format_detection(options)
|
13
15
|
options[:name] = 'format-detection'
|
14
|
-
options[:content] =
|
15
|
-
options[:
|
16
|
+
options[:content] = 'telephone='
|
17
|
+
options[:content] += options.delete(:telephone) ? 'yes' : 'no'
|
16
18
|
|
17
19
|
[:meta, options]
|
18
20
|
end
|
@@ -26,8 +28,7 @@ module IphoneHelpers
|
|
26
28
|
|
27
29
|
def icon(options)
|
28
30
|
options[:rel] = 'apple-touch-icon'
|
29
|
-
options[:rel] += '-precomposed' if options
|
30
|
-
options[:precomposed] = nil if options[:precomposed]
|
31
|
+
options[:rel] += '-precomposed' if options.delete(:precomposed)
|
31
32
|
|
32
33
|
[:link, options]
|
33
34
|
end
|
@@ -39,23 +40,25 @@ module IphoneHelpers
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def status_bar(options)
|
43
|
+
color = options.delete(:color)
|
42
44
|
options[:name] = 'apple-mobile-web-app-status-bar-style'
|
43
|
-
options[:content] =
|
44
|
-
options[:color] = nil if options[:color]
|
45
|
+
options[:content] = STATUS_BAR_COLORS.include?(color) ? color : 'default'
|
45
46
|
|
46
47
|
[:meta, options]
|
47
48
|
end
|
48
49
|
|
49
50
|
def viewport(options)
|
51
|
+
default_options = {
|
52
|
+
'initial-scale' => 1,'maximum-scale' => 1, 'width' => 'device-width'
|
53
|
+
}
|
50
54
|
options = options.map do |key, value|
|
51
|
-
key = key.to_s.gsub('_', '-')
|
55
|
+
key = key.to_s.gsub('_', '-')
|
52
56
|
|
53
57
|
[key, value]
|
54
58
|
end
|
55
59
|
options = Hash[options]
|
56
|
-
|
57
|
-
|
58
|
-
options = {:content => content, :name => 'viewport'}
|
60
|
+
content = default_options.merge(options).sort.collect { |k, v| "#{k}=#{v}" }.join(', ')
|
61
|
+
options = {content: content, name: 'viewport'}
|
59
62
|
|
60
63
|
[:meta, options]
|
61
64
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iphone_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-01-09 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
16
|
-
requirement: &
|
16
|
+
requirement: &70344551723560 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70344551723560
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: awesome_print
|
27
|
-
requirement: &
|
27
|
+
requirement: &70344551806640 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.1.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70344551806640
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: minitest
|
38
|
-
requirement: &
|
38
|
+
requirement: &70344551805720 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 4.4.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70344551805720
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &70344551804620 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 10.0.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70344551804620
|
58
58
|
description: iPhone specific HTML tags helper
|
59
59
|
email:
|
60
60
|
- anton@qvister.se
|