forked from mirrors/bookwyrm
Adds more info to the about page
This commit is contained in:
parent
b855464396
commit
4caa68200f
4 changed files with 68 additions and 29 deletions
|
@ -1,4 +1,5 @@
|
|||
{% extends 'about/layout.html' %}
|
||||
{% load humanize %}
|
||||
{% load i18n %}
|
||||
{% load utilities %}
|
||||
|
||||
|
@ -7,10 +8,14 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block about_content %}
|
||||
<section class="block content pb-4">
|
||||
<section class="content pb-4">
|
||||
<h2>
|
||||
{% blocktrans with site_name=site.name %}Welcome to {{ site_name }}!{% endblocktrans %}
|
||||
</h2>
|
||||
|
||||
<p class="subtitle notification has-background-primary-light">
|
||||
{% blocktrans trimmed with site_name=site.name %}
|
||||
{{ site_name }} is part of BookWyrm, a network of independent, self-directed communites for readers.
|
||||
{{ site_name }} is part of <em>BookWyrm</em>, a network of independent, self-directed communities for readers.
|
||||
While you can interact seemlessly with users anywhere in the <a href="https://joinbookwyrm.com/instances/" target="_blank">BookWyrm network</a>, this community is unique.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
|
@ -61,7 +66,7 @@
|
|||
</div>
|
||||
|
||||
<p>
|
||||
Join/request an invite to track your reading, share your thoughts, and discover what to read next on {{ site.name }}.
|
||||
{% trans "Track your reading, talk about books, write reviews, and discover what to read next. Always ad-free, anti-corporate, and community-oriented, BookWyrm is human-scale software, designed to stay small and personal. If you have feature requests, bug reports, or grand dreams, <a href='https://joinbookwyrm.com/get-involved' target='_blank'>reach out</a> and make yourself heard." %}
|
||||
</p>
|
||||
|
||||
</section>
|
||||
|
|
|
@ -1,7 +1,27 @@
|
|||
{% extends 'landing/layout.html' %}
|
||||
{% load humanize %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block about_panel %}
|
||||
<div class="box">
|
||||
{% include "snippets/about.html" with size="m" %}
|
||||
{% if active_users %}
|
||||
<ul>
|
||||
<li class="tag is-size-6">
|
||||
<span class="mr-1">{% trans "Active users:" %}</span>
|
||||
<strong>{{ active_users|intcomma }}</strong>
|
||||
</li>
|
||||
<li class="tag is-size-6">
|
||||
<span class="mr-1">{% trans "Statuses posted:" %}</span>
|
||||
<strong>{{ status_count|intcomma }}</strong>
|
||||
</li>
|
||||
<li class="tag is-size-6">
|
||||
<span class="mr-1">{% trans "Software version:" %}</span>
|
||||
<strong>{{ version }}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
|
|
|
@ -21,23 +21,23 @@
|
|||
<p><a href="{{ user.remote_id }}">{{ user.username }}</a></p>
|
||||
<p>{% blocktrans with date=user.created_date|naturaltime %}Joined {{ date }}{% endblocktrans %}</p>
|
||||
<p>
|
||||
{% if is_self %}
|
||||
{% if request.user.id == user.id %}
|
||||
|
||||
<a href="{% url 'user-followers' user|username %}">{% blocktrans count counter=user.followers.count %}{{ counter }} follower{% plural %}{{ counter }} followers{% endblocktrans %}</a>,
|
||||
<a href="{% url 'user-following' user|username %}">{% blocktrans with counter=user.following.count %}{{ counter }} following{% endblocktrans %}</a>
|
||||
<a href="{% url 'user-followers' user|username %}">{% blocktrans count counter=user.followers.count %}{{ counter }} follower{% plural %}{{ counter }} followers{% endblocktrans %}</a>,
|
||||
<a href="{% url 'user-following' user|username %}">{% blocktrans with counter=user.following.count %}{{ counter }} following{% endblocktrans %}</a>
|
||||
|
||||
{% elif request.user.is_authenticated %}
|
||||
|
||||
{% mutuals_count user as mutuals %}
|
||||
<a href="{% url 'user-followers' user|username %}">
|
||||
{% if mutuals %}
|
||||
{% blocktrans with mutuals_display=mutuals|intcomma count counter=mutuals %}{{ mutuals_display }} follower you follow{% plural %}{{ mutuals_display }} followers you follow{% endblocktrans %}
|
||||
{% elif request.user in user.following.all %}
|
||||
{% trans "Follows you" %}
|
||||
{% else %}
|
||||
{% trans "No followers you follow" %}
|
||||
{% endif %}
|
||||
</a>
|
||||
{% mutuals_count user as mutuals %}
|
||||
<a href="{% url 'user-followers' user|username %}">
|
||||
{% if mutuals %}
|
||||
{% blocktrans with mutuals_display=mutuals|intcomma count counter=mutuals %}{{ mutuals_display }} follower you follow{% plural %}{{ mutuals_display }} followers you follow{% endblocktrans %}
|
||||
{% elif request.user in user.following.all %}
|
||||
{% trans "Follows you" %}
|
||||
{% else %}
|
||||
{% trans "No followers you follow" %}
|
||||
{% endif %}
|
||||
</a>
|
||||
|
||||
{% endif %}
|
||||
</p>
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
""" non-interactive pages """
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from django.db.models import Avg, StdDev, Count, Q
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils import timezone
|
||||
from django.views import View
|
||||
from django.views.decorators.http import require_GET
|
||||
|
||||
from bookwyrm import forms, models
|
||||
from bookwyrm import forms, models, settings
|
||||
from bookwyrm.views import helpers
|
||||
from bookwyrm.views.feed import Feed
|
||||
|
||||
|
@ -12,21 +14,33 @@ from bookwyrm.views.feed import Feed
|
|||
@require_GET
|
||||
def about(request):
|
||||
"""more information about the instance"""
|
||||
|
||||
books = models.Edition.objects.exclude(
|
||||
cover__exact=""
|
||||
).annotate(
|
||||
rating=Avg("review__rating"),
|
||||
deviation=StdDev("review__rating"),
|
||||
shelf_count=Count("shelves", filter=Q(shelves__identifier="to-read")),
|
||||
)
|
||||
|
||||
six_months_ago = timezone.now() - relativedelta(months=6)
|
||||
six_month_count = models.User.objects.filter(
|
||||
is_active=True, local=True, last_active_date__gt=six_months_ago
|
||||
).count()
|
||||
data = {
|
||||
"active_users": six_month_count,
|
||||
"status_count": models.Status.objects.filter(
|
||||
user__local=True, deleted=False
|
||||
).count(),
|
||||
"admins": models.User.objects.filter(groups__name__in=["admin", "moderator"]),
|
||||
"top_rated": books.order_by("rating").first(),
|
||||
"controversial": books.order_by("deviation").first(),
|
||||
"wanted": books.order_by("shelf_count").first(),
|
||||
"version": settings.VERSION,
|
||||
}
|
||||
|
||||
books = models.Edition.objects.exclude(cover__exact="")
|
||||
|
||||
data["top_rated"] = books.annotate(
|
||||
rating=Avg("review__rating")
|
||||
).order_by("rating").first()
|
||||
|
||||
data["controversial"] = books.annotate(
|
||||
deviation=StdDev("review__rating")
|
||||
).order_by("deviation").first()
|
||||
|
||||
data["wanted"] = books.annotate(
|
||||
shelf_count=Count("shelves", filter=Q(shelves__identifier="to-read"))
|
||||
).order_by("shelf_count").first()
|
||||
|
||||
return TemplateResponse(request, "about/about.html", data)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue