Merge pull request #474 from mouse-reeve/join-button

Hide join button when registration is closed
This commit is contained in:
Mouse Reeve 2021-01-03 15:47:00 -08:00 committed by GitHub
commit 5c1884d22d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 11 deletions

View file

@ -8,7 +8,7 @@
<section class="tile is-ancestor">
<div class="tile is-7 is-parent">
<div class="tile is-child block">
<div class="tile is-child box">
{% include 'snippets/about.html' %}
</div>
</div>

View file

@ -117,8 +117,9 @@
</div>
</a>
</div>
{% elif request.path != '/login' and request.path != '/login/' %}
{% else %}
<div class="navbar-item">
{% if request.path != '/login' and request.path != '/login/' %}
<div class="columns">
<div class="column">
<form name="login" method="post" action="/user-login">
@ -137,19 +138,17 @@
</div>
</form>
</div>
{% if site.allow_registration and request.path != '' and request.path != '/' %}
<div class="column is-narrow">
<a href="/login" class="button is-link">
<a href="/" class="button is-link">
Join
</a>
</div>
{% endif %}
</div>
{% endif %}
</div>
{% else %}
<div class="navbar-item">
<a href="/login" class="button is-link">
Join
</a>
{% endif %}
{% endif %}
</div>
</div>
</nav>

View file

@ -10,7 +10,9 @@
{% if book.authors %}
<p class="subtitle is-5">by {% include 'snippets/authors.html' with book=book %}</p>
{% endif %}
{% if book|book_description %}
<blockquote class="content">{{ book|book_description|to_markdown|safe|truncatewords_html:50 }}</blockquote>
{% endif %}
</div>
</div>
{% endif %}

View file

@ -4,7 +4,7 @@ import re
from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.postgres.search import TrigramSimilarity
from django.core.paginator import Paginator
from django.db.models import Avg, F, Q, Max
from django.db.models import Avg, Q, Max
from django.db.models.functions import Greatest
from django.http import HttpResponseNotFound, JsonResponse
from django.core.exceptions import PermissionDenied
@ -137,7 +137,8 @@ def discover_page(request):
''' tiled book activity page '''
books = models.Edition.objects.filter(
review__published_date__isnull=False,
review__user__local=True
review__user__local=True,
review__privacy__in=['public', 'unlisted'],
).exclude(
cover__exact=''
).annotate(