2021-03-08 16:49:10 +00:00
|
|
|
""" non-interactive pages """
|
2021-01-12 18:44:17 +00:00
|
|
|
from django.template.response import TemplateResponse
|
|
|
|
from django.views import View
|
|
|
|
|
2022-01-06 17:51:38 +00:00
|
|
|
from bookwyrm import forms
|
2021-10-16 18:45:55 +00:00
|
|
|
from bookwyrm.views import helpers
|
|
|
|
from bookwyrm.views.feed import Feed
|
2021-01-12 18:44:17 +00:00
|
|
|
|
|
|
|
|
2022-01-06 05:42:41 +00:00
|
|
|
# pylint: disable= no-self-use
|
2021-01-12 18:44:17 +00:00
|
|
|
class Home(View):
|
2021-08-07 18:15:02 +00:00
|
|
|
"""landing page or home feed depending on auth"""
|
2021-03-08 16:49:10 +00:00
|
|
|
|
2021-01-12 18:44:17 +00:00
|
|
|
def get(self, request):
|
2021-04-26 16:15:42 +00:00
|
|
|
"""this is the same as the feed on the home tab"""
|
2021-01-12 18:44:17 +00:00
|
|
|
if request.user.is_authenticated:
|
|
|
|
feed_view = Feed.as_view()
|
2021-03-08 16:49:10 +00:00
|
|
|
return feed_view(request, "home")
|
2021-08-07 18:15:02 +00:00
|
|
|
landing_view = Landing.as_view()
|
|
|
|
return landing_view(request)
|
2021-01-12 18:44:17 +00:00
|
|
|
|
2021-03-08 16:49:10 +00:00
|
|
|
|
2021-08-07 18:15:02 +00:00
|
|
|
class Landing(View):
|
2021-04-26 16:15:42 +00:00
|
|
|
"""preview of recently reviewed books"""
|
2021-03-08 16:49:10 +00:00
|
|
|
|
2021-01-12 18:44:17 +00:00
|
|
|
def get(self, request):
|
2021-04-26 16:15:42 +00:00
|
|
|
"""tiled book activity page"""
|
2021-01-12 18:44:17 +00:00
|
|
|
data = {
|
2021-03-08 16:49:10 +00:00
|
|
|
"register_form": forms.RegisterForm(),
|
2021-03-21 02:14:41 +00:00
|
|
|
"request_form": forms.InviteRequestForm(),
|
2021-08-07 18:15:02 +00:00
|
|
|
"books": helpers.get_landing_books(),
|
2021-01-12 18:44:17 +00:00
|
|
|
}
|
2021-08-07 18:15:02 +00:00
|
|
|
return TemplateResponse(request, "landing/landing.html", data)
|