app/assets/javascripts/initTelInput.js.coffee.erb
#= require intl-tel-input
#= require intl-tel-input/build/js/utils
window.initTelInput = ->
telInput = $('#phone:not(.tel-input)')
telInput.intlTelInput({
preferredCountries: ['ua', 'by', 'md', 'ru']
separateDialCode: true
})
telInput.on 'keyup change', (e) ->
$phone = $(e.target)
$hidden = $phone.closest('.row').find('#hidden-phone')
$hidden.val($phone.intlTelInput('getNumber'))
$hidden.attr('name', $phone.attr('name'))
telInput.addClass('tel-input')