Skip to content

Commit

Permalink
Conditionally render label distribution table bodies
Browse files Browse the repository at this point in the history
Will now only be rendered if the project has instances or reviewers
respectively. If that is not the case, a placeholder is rendered.
  • Loading branch information
dabico committed Jan 26, 2024
1 parent 091505a commit 42decac
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions views/label.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@
</tr>
</thead>
<tbody class="table-group-divider">
<% categories.forEach((category) => { %>
<% if (!categories.length) { %>
<tr>
<th scope="row" colspan="3" class="text-center p-3">
This project has no instances.
</th>
</tr>
<%
}
categories.forEach((category) => {
%>
<tr>
<th scope="row"><%- category.category %></th>
<td class="text-end"><%- category.count %></td>
Expand Down Expand Up @@ -74,7 +83,16 @@
</tr>
</thead>
<tbody class="table-group-divider">
<% reviewers.forEach((reviewer) => { %>
<% if (!reviewers.length) { %>
<tr>
<th scope="row" colspan="3" class="text-center p-3">
This project has no reviewers.
</th>
</tr>
<%
}
reviewers.forEach((reviewer) => {
%>
<tr>
<th scope="row"><%- reviewer.name %></th>
<td class="text-end"><%- reviewer.count %></td>
Expand Down

0 comments on commit 42decac

Please sign in to comment.