forked from mirrors/bookwyrm
Renames "discover"
This commit is contained in:
parent
1dea2b307b
commit
040758c833
10 changed files with 44 additions and 21 deletions
|
@ -1,4 +1,4 @@
|
|||
{% extends 'discover/landing_layout.html' %}
|
||||
{% extends 'landing/landing_layout.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block panel %}
|
|
@ -1,4 +1,4 @@
|
|||
{% extends 'discover/landing_layout.html' %}
|
||||
{% extends 'landing/landing_layout.html' %}
|
||||
{% load i18n %}
|
||||
{% block panel %}
|
||||
|
||||
|
@ -10,18 +10,18 @@
|
|||
<div class="tile is-vertical">
|
||||
<div class="tile is-parent">
|
||||
<div class="tile is-child box has-background-white-ter">
|
||||
{% include 'discover/large-book.html' with book=books.0 %}
|
||||
{% include 'landing/large-book.html' with book=books.0 %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tile">
|
||||
<div class="tile is-parent is-6">
|
||||
<div class="tile is-child box has-background-white-ter">
|
||||
{% include 'discover/small-book.html' with book=books.1 %}
|
||||
{% include 'landing/small-book.html' with book=books.1 %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tile is-parent is-6">
|
||||
<div class="tile is-child box has-background-white-ter">
|
||||
{% include 'discover/small-book.html' with book=books.2 %}
|
||||
{% include 'landing/small-book.html' with book=books.2 %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -30,18 +30,18 @@
|
|||
<div class="tile">
|
||||
<div class="tile is-parent is-6">
|
||||
<div class="tile is-child box has-background-white-ter">
|
||||
{% include 'discover/small-book.html' with book=books.3 %}
|
||||
{% include 'landing/small-book.html' with book=books.3 %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tile is-parent is-6">
|
||||
<div class="tile is-child box has-background-white-ter">
|
||||
{% include 'discover/small-book.html' with book=books.4 %}
|
||||
{% include 'landing/small-book.html' with book=books.4 %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tile is-parent">
|
||||
<div class="tile is-child box has-background-white-ter">
|
||||
{% include 'discover/large-book.html' with book=books.5 %}
|
||||
{% include 'landing/large-book.html' with book=books.5 %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
{% load bookwyrm_tags %}
|
||||
{% load i18n %}
|
||||
|
|
@ -54,9 +54,9 @@ class LandingViews(TestCase):
|
|||
result.render()
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_discover(self):
|
||||
def test_landing(self):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.Discover.as_view()
|
||||
view = views.Landing.as_view()
|
||||
request = self.factory.get("")
|
||||
result = view(request)
|
||||
self.assertIsInstance(result, TemplateResponse)
|
||||
|
|
|
@ -7,6 +7,7 @@ from .block import Block, unblock
|
|||
from .books import Book, EditBook, ConfirmEditBook, Editions
|
||||
from .books import upload_cover, add_description, switch_edition, resolve_book
|
||||
from .directory import Directory
|
||||
from .discover import Discover
|
||||
from .edit_user import EditUser, DeleteUser
|
||||
from .federation import Federation, FederatedServer
|
||||
from .federation import AddFederatedServer, ImportServerBlocklist
|
||||
|
@ -22,7 +23,7 @@ from .interaction import Favorite, Unfavorite, Boost, Unboost
|
|||
from .invite import ManageInvites, Invite, InviteRequest
|
||||
from .invite import ManageInviteRequests, ignore_invite_request
|
||||
from .isbn import Isbn
|
||||
from .landing import About, Home, Discover
|
||||
from .landing import About, Home, Landing
|
||||
from .list import Lists, List, Curate, UserLists
|
||||
from .notifications import Notifications
|
||||
from .outbox import Outbox
|
||||
|
|
23
bookwyrm/views/discover.py
Normal file
23
bookwyrm/views/discover.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
""" What's up locally """
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.template.response import TemplateResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views import View
|
||||
|
||||
from bookwyrm import forms
|
||||
from . import helpers
|
||||
|
||||
|
||||
# pylint: disable= no-self-use
|
||||
@method_decorator(login_required, name="dispatch")
|
||||
class Discover(View):
|
||||
"""preview of recently reviewed books"""
|
||||
|
||||
def get(self, request):
|
||||
"""tiled book activity page"""
|
||||
data = {
|
||||
"register_form": forms.RegisterForm(),
|
||||
"request_form": forms.InviteRequestForm(),
|
||||
"books": helpers.get_landing_books(),
|
||||
}
|
||||
return TemplateResponse(request, "landing/landing.html", data)
|
|
@ -162,8 +162,8 @@ def is_blocked(viewer, user):
|
|||
return False
|
||||
|
||||
|
||||
def get_discover_books():
|
||||
"""list of books for the discover page"""
|
||||
def get_landing_books():
|
||||
"""list of books for the landing page"""
|
||||
return list(
|
||||
set(
|
||||
models.Edition.objects.filter(
|
||||
|
|
|
@ -13,22 +13,22 @@ class About(View):
|
|||
|
||||
def get(self, request):
|
||||
"""more information about the instance"""
|
||||
return TemplateResponse(request, "discover/about.html")
|
||||
return TemplateResponse(request, "landing/about.html")
|
||||
|
||||
|
||||
class Home(View):
|
||||
"""discover page or home feed depending on auth"""
|
||||
"""landing page or home feed depending on auth"""
|
||||
|
||||
def get(self, request):
|
||||
"""this is the same as the feed on the home tab"""
|
||||
if request.user.is_authenticated:
|
||||
feed_view = Feed.as_view()
|
||||
return feed_view(request, "home")
|
||||
discover_view = Discover.as_view()
|
||||
return discover_view(request)
|
||||
landing_view = Landing.as_view()
|
||||
return landing_view(request)
|
||||
|
||||
|
||||
class Discover(View):
|
||||
class Landing(View):
|
||||
"""preview of recently reviewed books"""
|
||||
|
||||
def get(self, request):
|
||||
|
@ -36,6 +36,6 @@ class Discover(View):
|
|||
data = {
|
||||
"register_form": forms.RegisterForm(),
|
||||
"request_form": forms.InviteRequestForm(),
|
||||
"books": helpers.get_discover_books(),
|
||||
"books": helpers.get_landing_books(),
|
||||
}
|
||||
return TemplateResponse(request, "discover/discover.html", data)
|
||||
return TemplateResponse(request, "landing/landing.html", data)
|
||||
|
|
Loading…
Reference in a new issue