Adds standalone modal views for reading steps

This commit is contained in:
Mouse Reeve
2021-06-08 11:55:18 -07:00
parent b5d0a9e0b4
commit 3356c652ee
4 changed files with 45 additions and 1 deletions

View File

@ -7,6 +7,7 @@ from dateutil.parser import ParserError
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseBadRequest, HttpResponseNotFound
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from django.views import View
from django.views.decorators.http import require_POST
@ -20,6 +21,11 @@ from .helpers import get_edition, handle_reading_status
class WantToRead(View):
"""consider reading a book"""
def get(self, request, book_id):
"""modal page"""
book = get_edition(book_id)
return TemplateResponse(request, "reading_progress/want.html", {"book": book})
def post(self, request, book_id):
"""desire a book"""
desired_shelf = models.Shelf.objects.filter(
@ -33,6 +39,11 @@ class WantToRead(View):
class StartReading(View):
"""begin a book"""
def get(self, request, book_id):
"""modal page"""
book = get_edition(book_id)
return TemplateResponse(request, "reading_progress/start.html", {"book": book})
def post(self, request, book_id):
"""begin reading a book"""
desired_shelf = models.Shelf.objects.filter(
@ -46,6 +57,11 @@ class StartReading(View):
class FinishReading(View):
"""finish a book"""
def get(self, request, book_id):
"""modal page"""
book = get_edition(book_id)
return TemplateResponse(request, "reading_progress/finish.html", {"book": book})
def post(self, request, book_id):
"""a user completed a book, yay"""
desired_shelf = models.Shelf.objects.filter(