mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-03 06:46:39 +00:00
identify group manager
This commit is contained in:
parent
b645d75303
commit
62a5ed7a9e
2 changed files with 19 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
|||
{% load i18n %}
|
||||
{% load utilities %}
|
||||
{% load humanize %}
|
||||
{% load bookwyrm_tags %}
|
||||
<!-- TODO: do we need this? -->
|
||||
{% if request.GET.updated %}
|
||||
<div class="notification is-primary">
|
||||
|
@ -29,11 +30,9 @@
|
|||
</div>
|
||||
{% endblock %}
|
||||
|
||||
<ul start="{{ members.start_index }}" class="ordered-list">
|
||||
|
||||
<div class="column is-flex is-flex-grow-0">
|
||||
{% for member in group.members.all %}
|
||||
<span class="box has-text-centered is-shadowless has-background-white-bis m-0">
|
||||
<div class="box has-text-centered is-shadowless has-background-white-bis my-0 mx-2">
|
||||
<a href="{{ member.local_path }}" class="has-text-black">
|
||||
{% include 'snippets/avatar.html' with user=member large=True %}
|
||||
<span title="{{ member.display_name }}" class="is-block is-6 has-text-weight-bold">{{ member.display_name|truncatechars:10 }}</span>
|
||||
|
@ -60,7 +59,7 @@
|
|||
{% trans "Follows you" %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% identify_manager %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
|
@ -1,6 +1,7 @@
|
|||
""" template filters """
|
||||
from django import template
|
||||
from django.db.models import Avg
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
from bookwyrm import models, views
|
||||
|
||||
|
@ -98,3 +99,15 @@ def mutuals_count(context, user):
|
|||
if not viewer.is_authenticated:
|
||||
return None
|
||||
return user.followers.filter(followers=viewer).count()
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def identify_manager(context):
|
||||
"""boolean for whether user is group manager"""
|
||||
group = context['group']
|
||||
member = context['member']
|
||||
snippet = mark_safe('')
|
||||
|
||||
if group.manager == member:
|
||||
snippet = mark_safe('<span class="icon icon-star-full" title="Manager"><span class="is-sr-only">Manager</span></span>')
|
||||
|
||||
return snippet
|
Loading…
Reference in a new issue