
<table class="table table-striped table-condensed">
  <thead>
    <th>Test Files</th>
    <th>Rule</th>
    <th>Agents</th>
    <th>Active?</th>
    <th></th>
  </thead>
  <tbody>
    <% project.distribution_rules.each do |dr| %>
    <tr id="distribution_rule_<%= dr.id%>" class="<%if dr.active %>success<% else %>danger<% end %>">
      <td><%= dr.test_file_names %></td>
      <td><%= dr.constraint %></td>
      <td><% if dr.build_agent_names %><%= dr.build_agent_names%><% end %></td>
      <td style="text-align:center;"><input type="checkbox" id="rule_check_box_<%= dr.id %>"  onclick="$.getScript('/projects/<%= project.id%>/toggle_rule_active?rule_id=<%= dr.id%>')"  <% if dr.active %>checked<% end %> /></td>
      <td style="align:right; padding: 5px;">
				<% if current_user && (current_user.is_admin? || current_user.has_role?("builder", @project) ) %>				
				
				<a href="javascript:void(0);" class="btn btn-sm" onclick="$.getScript('/projects/<%= project.id%>/delete_rule?rule_id=<%= dr.id%>')">
      		<i class="fa fa-trash red" aria-hidden="true"></i></a></td>
			
  			<% end %>
    </tr>
    <% end %>
  </tbody>
</table>
