mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-03 23:06:40 +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 i18n %}
|
||||||
{% load utilities %}
|
{% load utilities %}
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
|
{% load bookwyrm_tags %}
|
||||||
<!-- TODO: do we need this? -->
|
<!-- TODO: do we need this? -->
|
||||||
{% if request.GET.updated %}
|
{% if request.GET.updated %}
|
||||||
<div class="notification is-primary">
|
<div class="notification is-primary">
|
||||||
|
@ -29,11 +30,9 @@
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<ul start="{{ members.start_index }}" class="ordered-list">
|
|
||||||
|
|
||||||
<div class="column is-flex is-flex-grow-0">
|
<div class="column is-flex is-flex-grow-0">
|
||||||
{% for member in group.members.all %}
|
{% 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">
|
<a href="{{ member.local_path }}" class="has-text-black">
|
||||||
{% include 'snippets/avatar.html' with user=member large=True %}
|
{% 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>
|
<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" %}
|
{% trans "Follows you" %}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
{% identify_manager %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</div>
|
|
@ -1,6 +1,7 @@
|
||||||
""" template filters """
|
""" template filters """
|
||||||
from django import template
|
from django import template
|
||||||
from django.db.models import Avg
|
from django.db.models import Avg
|
||||||
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
from bookwyrm import models, views
|
from bookwyrm import models, views
|
||||||
|
|
||||||
|
@ -98,3 +99,15 @@ def mutuals_count(context, user):
|
||||||
if not viewer.is_authenticated:
|
if not viewer.is_authenticated:
|
||||||
return None
|
return None
|
||||||
return user.followers.filter(followers=viewer).count()
|
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