<% Puppetclass.classes2hash(puppetclasses).sort.in_groups(2,nil) do |group| %>
  <div class="col-md-6 classes">
    <% group.each do |list| %>
      <% next if list.nil? %>
      <ul class="puppetclass_group">
        <li><%= link_to_function image_tag("bullet_toggle_plus.png") + " " + list.first, "$('#pc_#{list.first}').fadeToggle('slow')" %>
          <ul id="pc_<%= list.first %>" style="display: none;">
            <% for klass in list.last.sort %>
              <% unless authorized_for(:host_editing, :edit_classes) %>
                <li data-original-title="<%= _('Not authorized to edit classes') %>" rel="twipsy"><%= h klass.name %></li>
              <% else %>
                <% style = selected_puppet_classes.include?(klass) ? "hide" : "" %>
                <%= content_tag_for :li, klass, :class=> style do %>
                  <%= link_to_add_puppetclass(klass, @host, type) %>
                <% end %>
              <% end %>
            <% end %>
          </ul>
        </li>
      </ul>
    <% end %>
  </div>
<% end %>
