Skip to content

Commit

Permalink
Update admin and user views, add staffMember field to user table
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewstech committed Apr 26, 2024
1 parent bbb9d01 commit eeebcdb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions routes/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = async (req, res) => {
}
});
data = await response.json();
console.log(data)
res.render("admin", {user: user, users: data, message: ''})

} catch (error) {
Expand Down
2 changes: 2 additions & 0 deletions views/admin.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<tr>
<th class="py-2 px-4 bg-gray-200 text-left">ID</th>
<th class="py-2 px-4 bg-gray-200 text-left">Username</th>
<th class="py-2 px-4 bg-gray-200 text-left">Staff</th>
<th class="py-2 px-4 bg-gray-200"></th> <!-- Empty header for Edit button -->
</tr>
</thead>
Expand All @@ -154,6 +155,7 @@
<tr>
<td class="py-2 px-4 border border-gray-300"><%= user._id %></td>
<td class="py-2 px-4 border border-gray-300"><%= user.username %></td>
<td class="py-2 px-4 border border-gray-300"><%= user.staffMember %></td>
<td class="py-2 px-4 border border-gray-300">
<a href="/admin/users?id=<%= user._id %>" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-1 px-2 rounded focus:outline-none focus:shadow-outline">Edit</a>
<a href="/admin/del?id=<%= user._id %>" class="bg-red-500 hover:bg-red-700 text-white font-bold py-1 px-2 rounded focus:outline-none focus:shadow-outline">Delete</a>
Expand Down
5 changes: 4 additions & 1 deletion views/domain.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@
<a href="#" class="bg-gray-900 text-white block rounded-md px-3 py-2 text-base font-medium" aria-current="page">My domains</a>
<% if (user.staffMember) { %>
<a href="/staff/" class="text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md px-3 py-2 text-base font-medium">Staff</a>
<% } %>
<% } %>
<% if (user.admin) { %>
<a href="/admin/" class="text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md px-3 py-2 text-base font-medium">Admin</a>
<% } %>
<a href="https://www.buymeacoffee.com/andrewstech" class="text-gray-300 hover:bg-gray-700 hover:text-white block rounded-md px-3 py-2 text-base font-medium">Donate</a>
</div>
<div class="border-t border-gray-700 pb-3 pt-4">
Expand Down

0 comments on commit eeebcdb

Please sign in to comment.