tel_to_helper 0.0.3 → 0.1.0
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.
- checksums.yaml +4 -4
- data/README.md +12 -12
- data/lib/action_view/helpers/tel_to_helper.rb +11 -5
- data/lib/tel_to_helper/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3abc4e1b0955b001ddbed298df3dc1a8c06a15e6
|
4
|
+
data.tar.gz: 0e022cd15a79a3c10b80bedc901566edb0e97ec8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a81128e11caac76d0a705730677043ab5ee8d2066a4c0c4a68a73e430b265ead0da317f767ea7a637edd9767fbb43caaaa53a23ea9c303eb4fc1b2a9f9e106dd
|
7
|
+
data.tar.gz: 0d1ddfb4ec08a245cccf18e4256cc73ffbcd1de059611b7ca01d91654c35678a62a18b1d629c894b4b40064f62bd2a555d971dbe7567b01a7280d649ff246ccf
|
data/README.md
CHANGED
@@ -19,29 +19,29 @@ gem 'tel_to_helper'
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
+
The parameters is almost the same as `link_to` except pass phone number to `options`.
|
23
|
+
|
22
24
|
```ruby
|
23
|
-
tel_to(
|
25
|
+
tel_to(name = nil, options = nil, html_options = nil, &block)
|
24
26
|
```
|
25
27
|
|
26
28
|
## Examples
|
27
29
|
|
28
30
|
```ruby
|
29
|
-
|
30
|
-
# <a href="tel:
|
31
|
+
tel_to '000-000-0000'
|
32
|
+
# => <a href="tel:000-000-0000">000-000-0000</a>
|
31
33
|
```
|
34
|
+
|
32
35
|
```ruby
|
33
|
-
|
34
|
-
# <a href="tel:
|
36
|
+
tel_to 'My phone number', '000-000-0000'
|
37
|
+
# => <a href="tel:000-000-0000">My phone number</a>
|
35
38
|
```
|
39
|
+
|
36
40
|
```ruby
|
37
|
-
|
38
|
-
# <a href="tel:
|
41
|
+
tel_to '000-000-0000', 'My phone number', target: '_blank'
|
42
|
+
# => <a href="tel:000-000-0000" target="_blank">My phone number</a>
|
39
43
|
```
|
40
44
|
|
41
|
-
## Credits
|
42
|
-
|
43
|
-
* swordray @[ihaveu](http://www.ihaveu.com/home) @[shuhai](http://tw.shuhai.org/) @[leaf](http://leaf.iacger.com)
|
44
|
-
|
45
45
|
## License
|
46
46
|
|
47
|
-
Copyright ©
|
47
|
+
Copyright © 2016 Jianqiu Xiao <swordray@gmail.com> under The [MIT License](http://opensource.org/licenses/MIT).
|
@@ -4,11 +4,17 @@ module ActionView
|
|
4
4
|
module Helpers
|
5
5
|
# = Action View Telephone Link Helper
|
6
6
|
module TelToHelper
|
7
|
-
# Creates a telephone link tag of the given +
|
8
|
-
# is passed as the +
|
9
|
-
# +number+. +
|
10
|
-
def tel_to(
|
11
|
-
|
7
|
+
# Creates a telephone link tag of the given +name+ and +number+. If +nil+
|
8
|
+
# is passed as the +number+ the value of the link itself will become the
|
9
|
+
# +number+. +html_options+ will be same as +link_to+.
|
10
|
+
def tel_to(name = nil, options = nil, html_options = nil, &block)
|
11
|
+
number = block_given? ? name : (options || name)
|
12
|
+
return if number.blank?
|
13
|
+
if block_given?
|
14
|
+
link_to("tel:#{number}", options, html_options, &block)
|
15
|
+
else
|
16
|
+
link_to(name, "tel:#{number}", html_options, &block)
|
17
|
+
end
|
12
18
|
end
|
13
19
|
end
|
14
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tel_to_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jianqiu Xiao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
61
|
version: '0'
|
62
62
|
requirements: []
|
63
63
|
rubyforge_project:
|
64
|
-
rubygems_version: 2.
|
64
|
+
rubygems_version: 2.4.8
|
65
65
|
signing_key:
|
66
66
|
specification_version: 4
|
67
67
|
summary: Telephone Link Tag Helper
|