has_contact_number 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/has_contact_number/helper_methods.rb +8 -3
- data/lib/has_contact_number/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: 0c2cb94f73a5e4807d187713fd8731d56b6b1bc1526d5d375ceea7785ab47c68
|
4
|
+
data.tar.gz: f41a2813fea7841147b1493b89a6bb27ecfa2f135bd6166c00306b8533d989d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ebaf7ff6dfc65a67fc559ac2722e7cbaa9c0f0578b1e263a428035af59841a2474230f61d0814721a9bbade41597042e67a1fd737775b89eaea350c8d6fdcec
|
7
|
+
data.tar.gz: 48845fc9570e9b54b49feab1af10e73e43a7cc16a4533e7469212e4e640433cb2d70e94f3675f919ce5cc40cc80236bec5a3ffe22f148ca3de9adef48a1417a2
|
@@ -5,15 +5,20 @@ module ActionView::Helpers::FormOptionsHelper
|
|
5
5
|
{
|
6
6
|
code: icc.calling_code,
|
7
7
|
code_to_i: icc.calling_code.delete('+').to_i,
|
8
|
-
code_to_db: icc.calling_code.delete('+').rjust(4, '0')
|
8
|
+
code_to_db: icc.calling_code.delete('+').rjust(4, '0'),
|
9
|
+
country: icc.name,
|
10
|
+
country_with_code: "#{icc.name} (#{icc.calling_code})"
|
9
11
|
}
|
10
12
|
}
|
11
13
|
OPTIONS_FOR_ISD_CODES_SELECT_BY_CODE = OPTIONS_FOR_ISD_CODES_SELECT.uniq.sort_by{|record| record[:code_to_i]}.map do |record|
|
12
14
|
[record[:code], record[:code_to_db]]
|
13
15
|
end
|
16
|
+
OPTIONS_FOR_ISD_CODES_SELECT_BY_COUNTRY_NAME = OPTIONS_FOR_ISD_CODES_SELECT.sort_by{|record| record[:country]}.map do |record|
|
17
|
+
[record[:country_with_code], record[:code_to_db]]
|
18
|
+
end
|
14
19
|
|
15
|
-
def options_for_isd_code_select
|
16
|
-
OPTIONS_FOR_ISD_CODES_SELECT_BY_CODE
|
20
|
+
def options_for_isd_code_select(display_country_names: true)
|
21
|
+
display_country_names ? OPTIONS_FOR_ISD_CODES_SELECT_BY_COUNTRY_NAME : OPTIONS_FOR_ISD_CODES_SELECT_BY_CODE
|
17
22
|
end
|
18
23
|
|
19
24
|
end
|