<div class="row">
  <% if obj.errors[:puppetclasses].any? %>
    <%= alert :class => "alert-block alert-danger base in fade",
              :text => obj.errors[:puppetclasses].map { |e| "<li>#{e}</li>" }.to_s.html_safe %>
  <% end %>
  <div class="col-md-4 classes">
    <h3><%= _('Included Classes') %></h3>
    <%# hidden field to ensure that classes gets removed if none are defined %>
    <%= hidden_field_tag obj.class.model_name.downcase + "[puppetclass_ids][]" %>
    <ul id="selected_classes">
      <% if authorized_for(:host_editing, :edit_classes) %>
        <%= render :partial => "puppetclasses/selectedClasses",
          :collection => obj.puppetclasses ,:as => :klass,
          :locals => { :type => obj.class.model_name.downcase, :host => obj } %>
      <% else %>
        <% obj.puppetclasses.each do |klass| %>
          <li data-original-title="<%= _('Not authorized to edit classes') %>" rel="twipsy" ><%= h klass.name %></li>
        <% end %>
      <% end %>
    </ul>
    <ul>
      <% parent_classes(obj).each do |klass| %>
        <li data-original-title="<%= _('included already from host group') %>" rel="twipsy" style='color:black;'><%= h klass.name %></li>
      <% end %>
    </ul>
  </div>

  <div class="col-md-8">
    <h3><%= _('Available Classes') %></h3>
    <div class='clearfix'>
      <div class='form-group col-md-6'>
        <input placeholder="<%= _('Filter classes') %>" class="form-control" onkeyup="filter_puppet_classes(this);" type='text'>
      </div>
    </div>
    <div class="row">
      <%= render "puppetclasses/classes",
        :puppetclasses => (obj.environment.blank? ? Puppetclass.all : obj.environment.puppetclasses),
        :selected_puppet_classes => obj.all_puppetclasses,
        :obj => obj,
        :type => obj.class.model_name.downcase
      %>
    </div>
  </div>
</div>
