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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e603a69c33542d5f5011a499a0e5ba1fdc62a1ac
4
- data.tar.gz: a0603173eacda5438940ee2804c3b53ae27bc1aa
3
+ metadata.gz: 8f12dd6f8dc5d7096db917eee13b558c8deae683
4
+ data.tar.gz: b4e7bec365d021a2d899fe390ca85137c76abd4c
5
5
  SHA512:
6
- metadata.gz: a2b832f6054b76dc5c07d32142f59300c21bea067c363302a1ca34679e3c406864836a37e41168ab12ee62095c35ee355f55050d9112922f991d7fa0e95f1fb0
7
- data.tar.gz: 60514ac14b702b84aba9835060772c392c46b894b3167810e8fb7aac8b4ebd6403e0f5df9bee770c4393f221e26491c7656ff8cf8b5f35ee0f952f6dbc85ed50
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
- <%= intl_phone_fr_tag('test') %> # For french
62
+ <%= intl_phone_tag_fr('test') %> # For french
61
63
  ```
62
64
 
63
- ## Usage
64
-
65
- TODO: Write usage instructions here
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
 
@@ -5,7 +5,7 @@ require 'intl_phone_picker/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "intl_phone_picker"
8
- spec.version = "0.0.4"
8
+ spec.version = "0.0.5"
9
9
  spec.authors = ["Fabien Dobat\n\n"]
10
10
  spec.email = ["fabien.dobat@seniormedia.fr"]
11
11
 
@@ -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,3 +1,3 @@
1
1
  module IntlPhonePicker
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -1,16 +1,16 @@
1
1
  module IntlPhonePicker
2
2
  module ViewHelpers
3
3
 
4
- def intl_phone_fr_tag(name, value = nil, options = {})
5
- options[:class] ||= String.new
6
- options[:class] += ' intl_phone_input_fr'
7
- telephone_field_tag(name = name, value = value, options = options)
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 intl_phone_us_tag(name, value = nil, options = {})
11
- options[:class] ||= String.new
12
- options[:class] += ' intl_phone_input_us'
13
- telephone_field_tag(name = name, value = value, options = options)
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
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