Show user ranks in raid details.

This commit is contained in:
Casper V. Kristensen 2020-01-02 04:27:24 +01:00
parent 2bda918954
commit 7820021864
Signed by: caspervk
GPG key ID: 289CA03790535054
2 changed files with 17 additions and 9 deletions

View file

@ -93,7 +93,7 @@ class RaidResponse(models.Model):
) )
class Meta: class Meta:
ordering = ["-status", "role", "character__klass", "character__name"] ordering = ["-status", "role", "character__klass", "character__user__rank", "character__name"]
constraints = [ constraints = [
models.UniqueConstraint(fields=["raid", "character"], name="unique_character_raid_signup") models.UniqueConstraint(fields=["raid", "character"], name="unique_character_raid_signup")
] ]

View file

@ -70,14 +70,22 @@
{% regroup role_responses by character.klass as class_responses_list %} {% regroup role_responses by character.klass as class_responses_list %}
{% for class, class_responses in class_responses_list %} {% for class, class_responses in class_responses_list %}
<div class="d-flex flex-column mr-2 mb-4"> <div class="d-flex flex-column mr-2 mb-4">
{% for response in class_responses %} {% regroup class_responses by character.user.rank as rank_responses_list %}
<a class="btn response-character-button mb-1 btn-class-{{ response.character.klass }}" role="button" href="#"> {% for rank, rank_responses in rank_responses_list %}
{% if response.character != response.character.user.main %} <div class="d-flex justify-content-center align-items-center">
<abbr title="{{ response.character.user.main }}">{{ response.character.name }}</abbr> <hr class="flex-grow-1 my-0">
{% else %} <div class="mx-2 my-0 font-weight-light text-muted small">{{ rank }}</div>
{{ response.character.name }} <hr class="flex-grow-1 my-0">
{% endif %} </div>
</a> {% for response in rank_responses %}
<a class="btn response-character-button mb-1 btn-class-{{ response.character.klass }}" role="button" href="#">
{% if response.character != response.character.user.main %}
<abbr title="{{ response.character.user.main }}">{{ response.character.name }}</abbr>
{% else %}
{{ response.character.name }}
{% endif %}
</a>
{% endfor %}
{% endfor %} {% endfor %}
</div> </div>
{% endfor %} {% endfor %}