KyivKrishnaAcademy/ved_akadem_students

View on GitHub
app/views/shared/_nested_telephones.html.haml

Summary

Maintainability
Test Coverage
- content_for(:js_and_css) do
  = stylesheet_link_tag 'intl-tel-input/build/css/intlTelInput', media: 'all'
  = javascript_include_tag 'nested_form_custom_telephones', type: 'text/javascript'

.row
  .col-xs-12#nested-telephones
    = f.fields_for :telephones do |t|
      .row
        .col-xs-12
          = t.label :phone
      .row
        .col-xs-9
          = t.input :phone, as: :tel, required: true, label: false, input_html: { id: 'phone' }
          = t.input :phone, as: :hidden, input_html: { id: 'hidden-phone', name: '' }
        .col-xs-1
          = t.link_to_remove '', class: 'btn btn-danger btn-xs glyphicon glyphicon-minus-sign'
.row.vert-offset-bottom-1
  .col-xs-12
    = f.link_to_add '', :telephones, class: 'btn btn-success btn-xs glyphicon glyphicon-plus-sign', data: { target: '#nested-telephones' }