Almost done with User edit view. Still need to update styling and change the access start and end date fields.

This commit is contained in:
Ben 2024-04-09 18:55:52 -05:00
parent 26a7821e11
commit bdc5c406c7
2 changed files with 11 additions and 3 deletions

View File

@ -1,2 +1,6 @@
module UsersHelper
end
def display_user_role(user)
user.roles.first&.name&.capitalize || "None"
end
end

View File

@ -7,16 +7,20 @@
<table class="table">
<thead class="table-light">
<tr>
<th>Name</th>
<th>Email</th>
<th>Admin</th>
<th>Company</th>
<th>Permissions</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.first_name %> <%= user.last_name %></td>
<td><%= user.email %></td>
<td><%= user.has_role?(:admin) ? 'Yes' : 'No' %></td> <!-- Assuming you're using Rolify for role management -->
<td><%= user.company %></td>
<td><%= display_user_role(user) %></td>
<td>
<%= link_to edit_user_path(user), class: 'btn btn-info btn-sm' do %>
<i class="bi bi-pencil-fill" style="color: white;"></i>