intl_phone_picker 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +7 -4
- data/intl_phone_picker.gemspec +1 -1
- data/lib/intl_phone_picker/activerecord_helpers.rb +11 -0
- data/lib/intl_phone_picker/railtie.rb +4 -0
- data/lib/intl_phone_picker/version.rb +1 -1
- data/lib/intl_phone_picker/view_helpers.rb +8 -8
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f12dd6f8dc5d7096db917eee13b558c8deae683
|
4
|
+
data.tar.gz: b4e7bec365d021a2d899fe390ca85137c76abd4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77c80d6defbd1167cd8e12ef90ba8aced39a58c77ab5e4f60e9df53c3d90009b3bfdcc8c5020d5f3a28e226cb2b075b673301ec09e1df11cc3be69f3c38623e4
|
7
|
+
data.tar.gz: 8a6e7e75f2f5d6c121fdc256d9005ca2e572db644a35a6f93d2ec95de7d4f89c17d797fba1a5f8a51c3ca07cf5c154c5d71d8f5c1fc6c23a9b4407fdbe9384ec
|
data/CHANGELOG.md
CHANGED
@@ -22,3 +22,8 @@
|
|
22
22
|
- Only one javascript file which contains all traductions.
|
23
23
|
- Can swith switch between languages inside the same project (calling corresponding helper)
|
24
24
|
- Helpers overrides 'telephone_field_tag' (can use same attributes)
|
25
|
+
|
26
|
+
# Version 0.0.5
|
27
|
+
|
28
|
+
- Add Activerecord Helpers : 'intl_phone_input_fr' and 'intl_phone_input_us'
|
29
|
+
- Change name of view methods to 'intl_phone_tag_fr' and 'intl_phone_tag_us'
|
data/README.md
CHANGED
@@ -50,6 +50,8 @@ To use javascript and stylesheet libraries you need to add :
|
|
50
50
|
#= require intlTelInput
|
51
51
|
```
|
52
52
|
|
53
|
+
## Usage
|
54
|
+
|
53
55
|
- To call intlTelInput input :
|
54
56
|
```ruby
|
55
57
|
<%= intl_phone_[lang_shortname]_tag([your_specific_name]) %>
|
@@ -57,12 +59,13 @@ To use javascript and stylesheet libraries you need to add :
|
|
57
59
|
|
58
60
|
- Example :
|
59
61
|
```ruby
|
60
|
-
<%=
|
62
|
+
<%= intl_phone_tag_fr('test') %> # For french
|
61
63
|
```
|
62
64
|
|
63
|
-
|
64
|
-
|
65
|
-
|
65
|
+
- To use with a model (Activerecord), use (choose your language):
|
66
|
+
```ruby
|
67
|
+
<%= f.intl_phone_input_fr(:phone)%>
|
68
|
+
```
|
66
69
|
|
67
70
|
## Development
|
68
71
|
|
data/intl_phone_picker.gemspec
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
class IntlPhonePickerBuilder < ::ActionView::Helpers::FormBuilder
|
2
|
+
|
3
|
+
def intl_phone_input_fr(object_name, options = {})
|
4
|
+
telephone_field(object_name, options.merge(:class => 'intl_phone_input_fr'))
|
5
|
+
end
|
6
|
+
|
7
|
+
def intl_phone_input_us(object_name, options = {})
|
8
|
+
telephone_field(object_name, options.merge(:class => 'intl_phone_input_us'))
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -1,7 +1,11 @@
|
|
1
1
|
require 'intl_phone_picker/view_helpers'
|
2
|
+
require 'intl_phone_picker/activerecord_helpers'
|
2
3
|
|
3
4
|
module IntlPhonePicker
|
4
5
|
class Engine < ::Rails::Engine
|
6
|
+
initializer "intl_phone_picker.activerecord_helpers" do
|
7
|
+
ActionView::Base.default_form_builder = IntlPhonePickerBuilder
|
8
|
+
end
|
5
9
|
end
|
6
10
|
|
7
11
|
class Railtie < Rails::Railtie
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module IntlPhonePicker
|
2
2
|
module ViewHelpers
|
3
3
|
|
4
|
-
def
|
5
|
-
options[:class] ||= String.new
|
6
|
-
options[:class] += ' intl_phone_input_fr'
|
7
|
-
telephone_field_tag(name
|
4
|
+
def intl_phone_tag_fr(name, value = nil, options = {})
|
5
|
+
# options[:class] ||= String.new
|
6
|
+
# options[:class] += ' intl_phone_input_fr'
|
7
|
+
telephone_field_tag(name, value, options.merge(:class => 'intl_phone_input_fr'))
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
options[:class] ||= String.new
|
12
|
-
options[:class] += ' intl_phone_input_us'
|
13
|
-
telephone_field_tag(name
|
10
|
+
def intl_phone_tag_us(name, value = nil, options = {})
|
11
|
+
# options[:class] ||= String.new
|
12
|
+
# options[:class] += ' intl_phone_input_us'
|
13
|
+
telephone_field_tag(name, value, options.merge(:class => 'intl_phone_input_fr'))
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- |+
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- config/settings.yml
|
90
90
|
- intl_phone_picker.gemspec
|
91
91
|
- lib/intl_phone_picker.rb
|
92
|
+
- lib/intl_phone_picker/activerecord_helpers.rb
|
92
93
|
- lib/intl_phone_picker/railtie.rb
|
93
94
|
- lib/intl_phone_picker/version.rb
|
94
95
|
- lib/intl_phone_picker/view_helpers.rb
|