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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9bde35d103618e2a5a9a058b2d4c9dd2dbd020c82446bb83aee45e87c8b64be8
4
- data.tar.gz: a57f42a409cabbc5a932d6507e8e94bb6fcfc712598615c3fe8060317a1cc36f
3
+ metadata.gz: 0c2cb94f73a5e4807d187713fd8731d56b6b1bc1526d5d375ceea7785ab47c68
4
+ data.tar.gz: f41a2813fea7841147b1493b89a6bb27ecfa2f135bd6166c00306b8533d989d7
5
5
  SHA512:
6
- metadata.gz: 7a3b15a2a9ad9da9d082ade297d9d76f02177d5676579bbb5de9ce16d41da10c7eac1eed7454db92ebd28e73d944a46f9aaa8342b558e68ad4813af1411be2fa
7
- data.tar.gz: d10f0cdb4ded99a36d89cad0b41ac9f9345706a5ced6d87da3abcd0ee03985d3d2ddcc97d46def2650a5cb2ae942abab2395a7258eaa49c59a2e7e8fac4b66c6
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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module HasContactNumber
3
3
 
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
 
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_contact_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anand Bait