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

@ -0,0 +1,14 @@
{% extends 'layout.html' %}
{% load i18n %}
{% block title %}
{% blocktrans trimmed with book_title=book.title %}
Finish "{{ book_title }}"
{% endblocktrans %}
{% endblock %}
{% block content %}
{% include "snippets/shelve_button/finish_reading_modal.html" with book=book active=True %}
{% endblock %}

View file

@ -9,6 +9,6 @@ Start "{{ book_title }}"
{% block content %}
{% include "snippets/shelve_button/start_reading_modal.html" active=True %}
{% include "snippets/shelve_button/start_reading_modal.html" with book=book active=True %}
{% endblock %}

View file

@ -0,0 +1,14 @@
{% extends 'layout.html' %}
{% load i18n %}
{% block title %}
{% blocktrans trimmed with book_title=book.title %}
Want to Read "{{ book_title }}"
{% endblocktrans %}
{% endblock %}
{% block content %}
{% include "snippets/shelve_button/want_to_read_modal.html" with book=book active=True no_body=True %}
{% endblock %}

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(