<h2>
  <i class="fa fa-users" aria-hidden="true"></i>
	<%= I18n.t(:permissions)%>
	&nbsp;
	<a href="/users/new" id="new_user_link" class="btn btn-default btn-sm"><%= I18n.t(:new_user)%></a>
</h2>

<p><%= I18n.t(:permissions_intro) %></p>

<% Project.retrieve_all.each do |project| %>

<div class="">
	<h4><span class="" title=""><%= project.name %></span></h4>
  <table id="users" class="table table-striped table-condensed" style="margin-left: 20px;">
  <thead>
	<tr>
		<th><%= I18n.t(:role)%></th>
		<th><%= I18n.t(:users)%></th>
	</tr>
	</thead>
	<tbody>	
	<% project.roles.each do |role|  %>
	<tr id="role<%= role.id %>">
	  <td width="15%"><%= I18n.t(role.name) %></td>
	  <td>

	  	<% role.users.uniq.each do |user| %>
			<% next if user.is_admin? %>
			<% if current_user.is_admin? %>
				<a href="/users/<%= user.id %>/edit"><%= user.username %> 
				<% if user.email %>
					(<%= user.email %>)
				<% end %>
				</a>	
			<% else %>
				<%= user.email %>
			<% end %>
			&nbsp; 
		<% end %>
	  </td>	
	</tr>
	<% end %>
	
	</tbody>
</table>		
</div>

<% end %>