dialtone_rails 0.1.0 → 0.2.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 +3 -3
- data/lib/dialtone_rails/form_builder.rb +1 -1
- data/lib/dialtone_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6fadfd1b0e14f6e619a597da3f8455c318269999a0e4ce32446e9a4f685da8e1
|
|
4
|
+
data.tar.gz: a0e1c2e7d8ca71e932f9d74a5fff2de6d0b42df11e584a0056fe35cded05b45a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ab18cf9518bcc1417f31d3b55e74db4d9f8551c62d62291fcc64fefd7a3988b288c3040ff913349ce2e2723af69553533a22a49382c58bbb45b7192694829728
|
|
7
|
+
data.tar.gz: 69d6635a104b5d9e6ad6009e71409381fd6b6da8dc2032797e77878f01858c22dbe628f8e5a770960976d17d055b6432daf08314a55e0049ed80c3504013653f
|
data/README.md
CHANGED
|
@@ -6,7 +6,7 @@ for international phone fields with a country picker and number formatting.
|
|
|
6
6
|
The Ruby gem is **`dialtone_rails`**; its companion npm package is **`dialtone-rails`**.
|
|
7
7
|
|
|
8
8
|
```erb
|
|
9
|
-
<%= form.
|
|
9
|
+
<%= form.dialtone_field :phone_number,
|
|
10
10
|
initial_country: "ba",
|
|
11
11
|
class_names: {
|
|
12
12
|
input: "input",
|
|
@@ -58,7 +58,7 @@ Use it with standard Rails forms and labels:
|
|
|
58
58
|
```erb
|
|
59
59
|
<%= form_with model: @contact do |form| %>
|
|
60
60
|
<%= form.label :phone_number %>
|
|
61
|
-
<%= form.
|
|
61
|
+
<%= form.dialtone_field :phone_number,
|
|
62
62
|
initial_country: "ba",
|
|
63
63
|
required: true,
|
|
64
64
|
autocomplete: "tel",
|
|
@@ -81,7 +81,7 @@ Use it with standard Rails forms and labels:
|
|
|
81
81
|
For example:
|
|
82
82
|
|
|
83
83
|
```erb
|
|
84
|
-
<%= form.
|
|
84
|
+
<%= form.dialtone_field :phone_number,
|
|
85
85
|
initial_country: "ba",
|
|
86
86
|
options: {
|
|
87
87
|
only_countries: %w[ba hr rs me],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module DialtoneRails
|
|
2
2
|
module FormBuilder
|
|
3
|
-
def
|
|
3
|
+
def dialtone_field(method, initial_country: "", class_names: {}, options: {}, **html_options)
|
|
4
4
|
classes = class_names.transform_keys { |key| key.to_s.camelize(:lower) }
|
|
5
5
|
configuration = options.deep_transform_keys { |key| key.to_s.camelize(:lower) }
|
|
6
6
|
.merge("initialCountry" => initial_country.to_s.downcase, "classNames" => classes)
|