Skip to content

Commit

Permalink
#160 - fixed dashboard's buddy box (#186)
Browse files Browse the repository at this point in the history
* button to get buddy if you do not have one

* [pre-commit.ci] auto fixes from pre-commit.com hooks

---------

Co-authored-by: Josef Kolář <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 26, 2023
1 parent 39409d4 commit 36baac4
Showing 1 changed file with 34 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,45 @@
{% if request.membership.is_local %}
<div class="Dashboard__tile bg-gray-200">
<div class="Dashboard__tile__title">My Buddies</div>
<div class="Dashboard__tile__value">
<div class="avatar-group -space-x-12 justify-center p-2">
{% get_matched_buddy_requests as matched_requests %}
{% for br in matched_requests|slice:":3" %}
{% get_user_picture br.issuer as buddy_picture %}

{% if buddy_picture %}
<div class="avatar hover:scale-105 transition-transform">
<div class="w-24">
<img src="{% url "buddy_system:serve-issuer-profile-picture" buddy_picture %}"
width="{{ buddy_picture.width }}"
height="{{ buddy_picture.height }}"
alt="{{ br.issuer }}"
title="{{ br.issuer }}" />
{% get_matched_buddy_requests as matched_requests %}
{% if not matched_requests.exists %}
<div class="Dashboard__tile__value">So empty here :(</div>
<div class="Dashboard__tile__actions text-right">
<a href="{% url "buddy_system:matching-requests" %}"
class="btn btn-lg btn-outline">get your first buddy</a>
</div>
{% else %}
<div class="Dashboard__tile__value">
<div class="avatar-group -space-x-12 justify-center p-2">
{% for br in matched_requests|slice:":3" %}
{% get_user_picture br.issuer as buddy_picture %}

{% if buddy_picture %}
<div class="avatar hover:scale-105 transition-transform">
<div class="w-24">
<img src="{% url "buddy_system:serve-issuer-profile-picture" buddy_picture %}"
width="{{ buddy_picture.width }}"
height="{{ buddy_picture.height }}"
alt="{{ br.issuer }}"
title="{{ br.issuer }}" />
</div>
</div>
{% else %}
{# TODO placeholder avatar #}
{% endif %}
{% endfor %}
{% if matched_requests|length > 3 %}
<div class="avatar placeholder">
<a class="w-24 bg-neutral-focus text-neutral-content text-3xl flex justify-center items-center"
href="{% url "buddy_system:my-buddies" %}">
<span>+{{ matched_requests|length|add:"-3" }}</span>
</a>
</div>
{% else %}
{# TODO placeholder avatar #}
{% endif %}
{% endfor %}
{% if matched_requests|length > 3 %}
<div class="avatar placeholder">
<a class="w-24 bg-neutral-focus text-neutral-content text-3xl flex justify-center items-center"
href="{% url "buddy_system:my-buddies" %}">
<span>+{{ matched_requests|length|add:"-3" }}</span>
</a>
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
</div>
{% endif %}
</div>

0 comments on commit 36baac4

Please sign in to comment.