intl_phone_picker 0.0.5 → 0.0.6
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/CHANGELOG.md +5 -0
- data/README.md +5 -5
- data/intl_phone_picker.gemspec +1 -1
- data/lib/intl_phone_picker/activerecord_helpers.rb +8 -4
- data/lib/intl_phone_picker/version.rb +1 -1
- data/lib/intl_phone_picker/view_helpers.rb +7 -9
- data/vendor/assets/javascripts/intlTelInputLang.js +4 -4
- metadata +1 -2
- data/config/settings.yml +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6cdf4b24d7a2c8b32a80baf8bbf63b6f2988f09
|
4
|
+
data.tar.gz: 9276206796e12a52919c7cf1705489d01a1220c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e26682c4c9977cebe4b12c44b611be367d51ca4418c0f385ac2ff7cf87be541e1ac28db68ddea2e200343418e54fcef6fc96bf29e8a71e41334fa852d98ed70
|
7
|
+
data.tar.gz: 94eab92d7a98a759807792e7b2d29e6404aa53ff446066401a1b66bb08309403607b25f109782011b57f09cce81f372403434d267d75e93eb8bef5000bf8f0d2
|
data/CHANGELOG.md
CHANGED
@@ -27,3 +27,8 @@
|
|
27
27
|
|
28
28
|
- Add Activerecord Helpers : 'intl_phone_input_fr' and 'intl_phone_input_us'
|
29
29
|
- Change name of view methods to 'intl_phone_tag_fr' and 'intl_phone_tag_us'
|
30
|
+
|
31
|
+
# Version 0.0.6
|
32
|
+
|
33
|
+
- Select number picker country by locale of main application
|
34
|
+
- Only 2 helpers : 'intl_phone_tag' and 'intl_phone_input'
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ IntlPhonePicker is a ruby gem which allow you to change your html5 "tel" fields
|
|
7
7
|
Feel free to contribute and add your own config translation files through pull requests !
|
8
8
|
If you want to add a tranlation file, just put it into config/locales ! Or if you can't just send us by email, we will do it for you.
|
9
9
|
|
10
|
-
Currently supported languages : US, FR.
|
10
|
+
Currently supported languages : US (default), FR. The gem takes the language of the locale from your project.
|
11
11
|
|
12
12
|
## Sources
|
13
13
|
|
@@ -54,17 +54,17 @@ To use javascript and stylesheet libraries you need to add :
|
|
54
54
|
|
55
55
|
- To call intlTelInput input :
|
56
56
|
```ruby
|
57
|
-
<%=
|
57
|
+
<%= intl_phone_tag([your_specific_name]) %>
|
58
58
|
```
|
59
59
|
|
60
60
|
- Example :
|
61
61
|
```ruby
|
62
|
-
<%=
|
62
|
+
<%= intl_phone_tag('test') %> # For french
|
63
63
|
```
|
64
64
|
|
65
|
-
- To use with a model (Activerecord)
|
65
|
+
- To use with a model (Activerecord) :
|
66
66
|
```ruby
|
67
|
-
<%= f.
|
67
|
+
<%= f.intl_phone_input(:phone)%>
|
68
68
|
```
|
69
69
|
|
70
70
|
## Development
|
data/intl_phone_picker.gemspec
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
class IntlPhonePickerBuilder < ::ActionView::Helpers::FormBuilder
|
2
2
|
|
3
|
-
def
|
4
|
-
|
3
|
+
def self.available_languages
|
4
|
+
['us', 'fr']
|
5
5
|
end
|
6
6
|
|
7
|
-
def
|
8
|
-
|
7
|
+
def intl_phone_input(object_name, options = {})
|
8
|
+
if (I18n.locale && I18n.locale.to_s.in?(IntlPhonePickerBuilder.available_languages))
|
9
|
+
telephone_field(object_name, options.merge(:class => 'intl_phone_input_' + I18n.locale.to_s))
|
10
|
+
else
|
11
|
+
telephone_field(object_name, options.merge(:class => 'intl_phone_input_us'))
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
end
|
@@ -1,16 +1,14 @@
|
|
1
1
|
module IntlPhonePicker
|
2
2
|
module ViewHelpers
|
3
3
|
|
4
|
-
def
|
5
|
-
|
6
|
-
# options[:class] += ' intl_phone_input_fr'
|
7
|
-
telephone_field_tag(name, value, options.merge(:class => 'intl_phone_input_fr'))
|
8
|
-
end
|
4
|
+
def intl_phone_tag(name, value = nil, options = {})
|
5
|
+
available_languages = ['us', 'fr']
|
9
6
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
if (I18n.locale && I18n.locale.to_s.in?(available_languages))
|
8
|
+
telephone_field_tag(name, value, options.merge(:class => 'intl_phone_input_' + I18n.locale.to_s))
|
9
|
+
else
|
10
|
+
telephone_field_tag(name, value, options.merge(:class => 'intl_phone_input_us'))
|
11
|
+
end
|
14
12
|
end
|
15
13
|
|
16
14
|
end
|
@@ -13,15 +13,15 @@ jQuery(document).ready(function($) {
|
|
13
13
|
});
|
14
14
|
}
|
15
15
|
|
16
|
-
|
17
16
|
$(".intl_phone_input_fr").intlTelInput({
|
18
17
|
defaultCountry: "fr",
|
19
18
|
preferredCountries: ['fr', 'be', 'ch', 'lu', 'ca', 'mc'],
|
19
|
+
nationalMode: true
|
20
20
|
});
|
21
21
|
|
22
22
|
$(".intl_phone_input_us").intlTelInput({
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
defaultCountry: "us",
|
24
|
+
nationalMode: true
|
25
|
+
});
|
26
26
|
|
27
27
|
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intl_phone_picker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- |+
|
@@ -86,7 +86,6 @@ files:
|
|
86
86
|
- bin/setup
|
87
87
|
- config/locales/fr.yml
|
88
88
|
- config/locales/us.yml
|
89
|
-
- config/settings.yml
|
90
89
|
- intl_phone_picker.gemspec
|
91
90
|
- lib/intl_phone_picker.rb
|
92
91
|
- lib/intl_phone_picker/activerecord_helpers.rb
|
data/config/settings.yml
DELETED
File without changes
|