Cześć,
Posiadam stronę "ranking" w której wyświetla się lista użytkowników i chciałbym aby pierwsze 3 były pokolorowane na zielono ( przy pomocy bootstrap class success ).
Generalnie napisałem to i działa, ale jak patrze na ten kod to mam odruchy wymiotne. Pomóżcie mi to jakoś uprościć prosze, jestem newbie w bootstrapie i thymeleaf.
Mój kod:
<table class="table table-bordered">
<thead>
<tr>
<th>id</th>
<th>username</th>
<th>score</th>
</tr>
</thead>
<tbody>
<div th:each="userFromBase, iterator : ${RegisteredUsersFromBase}">
<tr th:if="${iterator.index < 3} " class="success" >
<td th:text="${iterator.index+1}"></td>
<td th:text="${userFromBase.username}"></td>
<td th:text="${userFromBase.score}"></td>
</tr>
<tr th:if="${iterator.index >= 3} " >
<td th:text="${iterator.index+1}"></td>
<td th:text="${userFromBase.username}"></td>
<td th:text="${userFromBase.score}"></td>
</tr>
</div>
</tbody>
</table>