<%
# LookupValue#match is generated automatically by Host#lookup_values_attributes=
# from the name, so don't present errors directly to the user.  Any validation
# errors should also be visible against the Host#name field.
if f.object.errors[:match].any?
  logger.debug("Ignoring #{f.object.inspect} match errors: #{f.object.errors[:match]}")
  f.object.errors.delete(:match)
end
%>
<div class="fields">
  <table>
    <tbody>
      <tr class="<%= 'has-error' if f.object.errors.any? %>">
        <td class="col-md-3">
          <%= f.hidden_field :lookup_key_id, :'data-property' => 'lookup_key_id' %>
          <% puppetclass = f.object.lookup_key ? f.object.lookup_key.param_class : nil %>
          <%= content_tag :span, (trunc_with_tooltip(puppetclass.name, 20) rescue ''), :'data-property' => 'class' %>
        </td>
        <td class="col-md-2">
          <%= content_tag :span, (trunc_with_tooltip(f.object.lookup_key.key,20) rescue ''), :'data-property' => 'name' %>
        </td>
        <td class="col-md-5">
          <div class="input-group">
            <%= f.text_area :value, :rows => 1, :class => 'form-control no-stretch', :'data-property' => 'value',
                          :disabled => (not authorized_via_my_scope("host_editing", "edit_params")) || f.object.use_puppet_default,
                          :placeholder => _("Value") %>
            <%= fullscreen_input %>
          </div>
          <%= text_field_tag '', (f.object.lookup_key.key_type rescue 'unknown'), :class=> 'hide',  :'data-property' => 'type', :disabled => true, :title => _('Parameter type') %>
        </td>
        <td class="col-md-4">
          <%= f.check_box :use_puppet_default, :'data-property' => 'use_puppet_default',
                        :disabled => (not authorized_via_my_scope("host_editing", "edit_params")),
                        :onchange=>'toggleUsePuppetDefaultValue(this, "value")' %>
          <%= use_puppet_default_help('') %>
        </td>
        <td>
          <span class="help-block">
            <%= link_to_remove_fields('', f) %>
          </span>
        </td>
        <span class="help-block">
          <%= f.object.errors.full_messages.to_sentence %>
        </span>
      </tr>
    </tbody>
  </table>
</div>
