mfvico/gCamp

View on GitHub
app/views/users/index.html.erb

Summary

Maintainability
Test Coverage
<% if notice != nil %>
  <p class="alert alert-success" id="notice"><%= notice  %></p>
<% end %>
<div class="page-header">
  <div class="pull-right">
     <%= link_to 'Create User', new_user_path, class: "btn btn-info" %>
  </div>
  <h1>Users</h1>
</div>
<table class="table">
  <thead>
    <tr>
      <th>Name</th>
      <th>Email</th>
      <th colspan="3"></th>
    </tr>
  </thead>
  <tbody>
    <% @users.each do |user| %>
      <tr>
        <td><%= link_to user.first_name + " " + user.last_name, user %></td>
        <% if user.id == current_user.id || admin_check  %>
          <td><%= mail_to user.email %></td>
          <td><%= link_to 'Edit', edit_user_path(user), class: "btn btn-warning btn-sm" %></td>
        <% else %>
        <td></td>
        <td></td>
        <% end %>
      </tr>
    <% end %>
  </tbody>
</table>