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 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"> <table class="table">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>
<th>Name</th>
<th>Email</th> <th>Email</th>
<th>Admin</th> <th>Company</th>
<th>Permissions</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @users.each do |user| %> <% @users.each do |user| %>
<tr> <tr>
<td><%= user.first_name %> <%= user.last_name %></td>
<td><%= user.email %></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> <td>
<%= link_to edit_user_path(user), class: 'btn btn-info btn-sm' do %> <%= link_to edit_user_path(user), class: 'btn btn-info btn-sm' do %>
<i class="bi bi-pencil-fill" style="color: white;"></i> <i class="bi bi-pencil-fill" style="color: white;"></i>