<div class="fields">
  <div class="form-group">
  <% nat    = compute_resource.networks %>
  <% bridge = compute_resource.interfaces %>

  <%= selectable_f f, :type, libvirt_networks(compute_resource), {},
                   { :label    => _('Network type'), :help_inline =>
                       remove_child_link('X', f, { :method => :'_delete', :title => _('remove network interface'),
                                                   :class  => 'label label-danger disable-unsupported' }),
                     :onchange => 'libvirt_network_selected(this)' } %>
  <div id='nat' class='<%= 'hide' if f.object.type != 'network' %>'>
    <%= selectable_f f, :network, nat.map(&:name),
                     { :include_blank => nat.any? ? false : _("No networks") },
                     { :class => "col-md-2", :label => _("Network"), :disabled => f.object.type != 'network' } %>
  </div>

  <div id='bridge' class='<%= 'hide' if f.object.type != 'bridge' %>'>
    <% if bridge.any? %>
      <%= selectable_f f, :bridge, bridge.map(&:name),
                       { :include_blank => bridge.any? ? false : _("No bridges") },
                       { :class => "col-md-2", :label => _("Network"), :disabled => f.object.type != 'bridge' } %>
    <% else %>
      <%= text_f f, :bridge, :class => "col-md-2", :label => _("Network"), :help_block => _("your libvirt host does not support interface listing, please enter here the bridge name (e.g. br0)") %>
    <% end %>
  </div>
  <%= selectable_f f, :model, %w(virtio rtl8139 ne2k_pci pcnet e1000), {},
                   { :label => _('NIC type'), :class => 'col-md-2' } %>
  </div>
</div>
