<%= form_for @device, html: { class: 'form-horizontal' } do |f| %>
<%= render 'object_errors', object: f.object %> <%= form_group f, :name, :text_field %>
<%= f.label(:encoding, class: 'col-sm-2 control-label') %>
<%= f.select :encoding, Encoding.aliases.collect{ |k,v| ["#{v} (#{k})", k]}.sort, { include_blank: true }, class: "form-control" %>
<%= f.label :driver, class: 'col-sm-2 control-label' %>
<% unless @device.driver.blank? || params[:driver_change] %>

<%= link_to edit_device_path(@device, driver_change: true), class: 'btn btn-danger btn-sm pull-right' do %> <%= t('.change_driver') %> <% end %> <%= @device.driver.class::NAME %>

<% else %> <%= f.select :driver_class, options_for_drivers, { include_blank: true }, class: 'form-control' %> <% if @device.driver.present? %> Driver change will destroy current driver configuration! <% end %> <% end %>
<%= fields_for :driver do |fd| %> <%= driver_settings fd, @device.driver %> <%= fields_for :serial_config do |fds| %>
<%= render 'extface/serial_configs/settings', f: fds %>
<% end if @device.driver.serial? %> <% end if @device.driver.present? %> <% end %>