app/views/users/index.html.erb
<div class="page-header">
<%= link_to "New User", new_user_path, class: "btn btn-info pull-right" %>
<h1>Users</h1>
</div>
<table class="table">
<thead>
<tr>
<th class= "col-md-3">Name</th>
<th class= "col-md-3">Email</th>
<th class= "col-md-3"> </th>
<th class= "col-md-3"> </th>
</tr>
</thead>
<% @users.each do |user| %>
<tr>
<td class = "col-md-3">
<%= link_to "#{user.first_name} #{user.last_name}", user_path(user) %>
</td>
<td class = "col-md-3">
<% if current_user == user || current_user.is_admin || belong_to_same_project(current_user,user) %>
<%= mail_to user.email %>
<% end %>
</td>
<td></td>
<td class = "text-right">
<% if current_user.id == user.id || current_user.is_admin %>
<%= link_to "Edit", edit_user_path(user) %>
<% end %>
</td>
</tr>
<% end %>
</table>