mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-25 09:30:33 +00:00
Rename 'Partially Read' to 'Stopped Reading'
This commit is contained in:
parent
bc89dd7041
commit
c88b34814f
17 changed files with 105 additions and 72 deletions
|
@ -1,29 +0,0 @@
|
|||
# Generated by Django 3.2.11 on 2022-02-11 13:19
|
||||
|
||||
import bookwyrm.models.fields
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bookwyrm', '0133_alter_listitem_notes'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='comment',
|
||||
name='reading_status',
|
||||
field=bookwyrm.models.fields.CharField(blank=True, choices=[('to-read', 'To-Read'), ('reading', 'Reading'), ('read', 'Read'), ('partially-read', 'Partially-Read')], max_length=255, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='quotation',
|
||||
name='reading_status',
|
||||
field=bookwyrm.models.fields.CharField(blank=True, choices=[('to-read', 'To-Read'), ('reading', 'Reading'), ('read', 'Read'), ('partially-read', 'Partially-Read')], max_length=255, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='review',
|
||||
name='reading_status',
|
||||
field=bookwyrm.models.fields.CharField(blank=True, choices=[('to-read', 'To-Read'), ('reading', 'Reading'), ('read', 'Read'), ('partially-read', 'Partially-Read')], max_length=255, null=True),
|
||||
),
|
||||
]
|
59
bookwyrm/migrations/0134_alter_stopped_reading.py
Normal file
59
bookwyrm/migrations/0134_alter_stopped_reading.py
Normal file
|
@ -0,0 +1,59 @@
|
|||
# Generated by Django 3.2.11 on 2022-02-11 13:19
|
||||
|
||||
import bookwyrm.models.fields
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bookwyrm", "0133_alter_listitem_notes"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="comment",
|
||||
name="reading_status",
|
||||
field=bookwyrm.models.fields.CharField(
|
||||
blank=True,
|
||||
choices=[
|
||||
("to-read", "To-Read"),
|
||||
("reading", "Reading"),
|
||||
("read", "Read"),
|
||||
("stopped-reading", "Stopped-Reading"),
|
||||
],
|
||||
max_length=255,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="quotation",
|
||||
name="reading_status",
|
||||
field=bookwyrm.models.fields.CharField(
|
||||
blank=True,
|
||||
choices=[
|
||||
("to-read", "To-Read"),
|
||||
("reading", "Reading"),
|
||||
("read", "Read"),
|
||||
("stopped-reading", "Stopped-Reading"),
|
||||
],
|
||||
max_length=255,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="review",
|
||||
name="reading_status",
|
||||
field=bookwyrm.models.fields.CharField(
|
||||
blank=True,
|
||||
choices=[
|
||||
("to-read", "To-Read"),
|
||||
("reading", "Reading"),
|
||||
("read", "Read"),
|
||||
("stopped-reading", "Stopped-Reading"),
|
||||
],
|
||||
max_length=255,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
|
@ -17,9 +17,9 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
|
|||
TO_READ = "to-read"
|
||||
READING = "reading"
|
||||
READ_FINISHED = "read"
|
||||
PARTIALLY_READ = "partially-read"
|
||||
STOPPED_READING = "stopped-reading"
|
||||
|
||||
READ_STATUS_IDENTIFIERS = (TO_READ, READING, READ_FINISHED, PARTIALLY_READ)
|
||||
READ_STATUS_IDENTIFIERS = (TO_READ, READING, READ_FINISHED, STOPPED_READING)
|
||||
|
||||
name = fields.CharField(max_length=100)
|
||||
identifier = models.CharField(max_length=100)
|
||||
|
|
|
@ -265,7 +265,7 @@ class GeneratedNote(Status):
|
|||
|
||||
|
||||
ReadingStatusChoices = models.TextChoices(
|
||||
"ReadingStatusChoices", ["to-read", "reading", "read", "partially-read"]
|
||||
"ReadingStatusChoices", ["to-read", "reading", "read", "stopped-reading"]
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -373,8 +373,8 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
|||
"identifier": "read",
|
||||
},
|
||||
{
|
||||
"name": "Partially Read",
|
||||
"identifier": "partially-read",
|
||||
"name": "Stopped Reading",
|
||||
"identifier": "stopped-reading",
|
||||
},
|
||||
]
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{% if shelf.identifier == 'to-read' %}{% trans "To Read" %}
|
||||
{% elif shelf.identifier == 'reading' %}{% trans "Currently Reading" %}
|
||||
{% elif shelf.identifier == 'read' %}{% trans "Read" %}
|
||||
{% elif shelf.identifier == 'partially-read' %}{% trans "Partially Read" %}
|
||||
{% elif shelf.identifier == 'stopped-reading' %}{% trans "Stopped Reading" %}
|
||||
{% else %}{{ shelf.name }}{% endif %}
|
||||
</option>
|
||||
{% endfor %}
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
{% if shelf.identifier == 'to-read' %}{% trans "To Read" %}
|
||||
{% elif shelf.identifier == 'reading' %}{% trans "Currently Reading" %}
|
||||
{% elif shelf.identifier == 'read' %}{% trans "Read" %}
|
||||
{% elif shelf.identifier == 'partially-read' %}{% trans "Partially Read" %}
|
||||
{% elif shelf.identifier == 'stopped-reading' %}{% trans "Stopped Reading" %}
|
||||
{% else %}{{ shelf.name }}{% endif %}
|
||||
<span class="subtitle">
|
||||
{% include 'snippets/privacy-icons.html' with item=shelf %}
|
||||
|
@ -151,7 +151,7 @@
|
|||
{% if is_self %}
|
||||
<th>{% trans "Shelved" as text %}{% include 'snippets/table-sort-header.html' with field="shelved_date" sort=sort text=text %}</th>
|
||||
<th>{% trans "Started" as text %}{% include 'snippets/table-sort-header.html' with field="start_date" sort=sort text=text %}</th>
|
||||
<th>{% if shelf.identifier == 'read' %}{% trans "Finished" as text %}{% else %}{% trans "Until" as text %}{% endif %}{% include 'snippets/table-sort-header.html' with field="finish_date" sort=sort text=text %}</th>
|
||||
<th>{% if shelf.identifier == 'read' %}{% trans "Finished" as text %}{% else %}{% trans "Until" as text %}{% endif %}{% include 'snippets/table-sort-header.html' with field="finish_date" sort=sort text=text %}</th>
|
||||
{% endif %}
|
||||
<th>{% trans "Rating" as text %}{% include 'snippets/table-sort-header.html' with field="rating" sort=sort text=text %}</th>
|
||||
{% endif %}
|
||||
|
@ -181,7 +181,7 @@
|
|||
<td data-title="{% trans "Started" %}">
|
||||
{{ book.start_date|naturalday|default_if_none:""}}
|
||||
</td>
|
||||
<td data-title="{% if shelf.identifier == 'read' %}{% trans "Finished" as text %}{% else %}{% trans "Until" as text %}{% endif %}">
|
||||
<td data-title="{% if shelf.identifier == 'read' %}{% trans "Finished" as text %}{% else %}{% trans "Until" as text %}{% endif %}">
|
||||
{{ book.finish_date|naturalday|default_if_none:""}}
|
||||
</td>
|
||||
{% endif %}
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
|
||||
{% block modal-title %}
|
||||
{% blocktrans trimmed with book_title=book|book_title %}
|
||||
Partially Read "<em>{{ book_title }}</em>"
|
||||
Stop Reading "<em>{{ book_title }}</em>"
|
||||
{% endblocktrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-form-open %}
|
||||
<form name="partially-read-{{ uuid }}" action="{% url 'reading-status' 'stop' book.id %}" method="post" {% if not refresh %}class="submit-status"{% endif %}>
|
||||
<form name="stop-reading-{{ uuid }}" action="{% url 'reading-status' 'stop' book.id %}" method="post" {% if not refresh %}class="submit-status"{% endif %}>
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="id" value="{{ readthrough.id }}">
|
||||
<input type="hidden" name="reading_status" value="stop">
|
||||
|
@ -38,5 +38,5 @@ Partially Read "<em>{{ book_title }}</em>"
|
|||
{% endblock %}
|
||||
|
||||
{% block form %}
|
||||
{% include "snippets/reading_modals/form.html" with optional=True type="partially_read_model" %}
|
||||
{% include "snippets/reading_modals/form.html" with optional=True type="stop_modal" %}
|
||||
{% endblock %}
|
|
@ -49,11 +49,11 @@
|
|||
{% join "finish_reading" uuid as modal_id %}
|
||||
{% include 'snippets/shelve_button/modal_button.html' with class=button_class fallback_url=fallback_url %}
|
||||
|
||||
{% elif shelf.identifier == 'partially-read' %}
|
||||
{% elif shelf.identifier == 'stopped-reading' %}
|
||||
|
||||
{% trans "Partially read" as button_text %}
|
||||
{% trans "Stopped reading" as button_text %}
|
||||
{% url 'reading-status' 'stop' book.id as fallback_url %}
|
||||
{% join "partially_read" uuid as modal_id %}
|
||||
{% join "stop_reading" uuid as modal_id %}
|
||||
{% include 'snippets/shelve_button/modal_button.html' with class=button_class fallback_url=fallback_url %}
|
||||
|
||||
{% elif shelf.identifier == 'to-read' %}
|
||||
|
@ -104,8 +104,8 @@
|
|||
{% join "finish_reading" uuid as modal_id %}
|
||||
{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf.book id=modal_id move_from=current.id readthrough=readthrough refresh=True class="" %}
|
||||
|
||||
{% join "partially_read" uuid as modal_id %}
|
||||
{% include 'snippets/reading_modals/partially_read_modal.html' with book=active_shelf.book id=modal_id move_from=current.id readthrough=readthrough refresh=True class="" %}
|
||||
{% join "stop_reading" uuid as modal_id %}
|
||||
{% include 'snippets/reading_modals/stop_reading_modal.html' with book=active_shelf.book id=modal_id move_from=current.id readthrough=readthrough refresh=True class="" %}
|
||||
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
{% join "finish_reading" uuid as modal_id %}
|
||||
{% include 'snippets/reading_modals/finish_reading_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %}
|
||||
|
||||
{% join "partially_read" uuid as modal_id %}
|
||||
{% include 'snippets/reading_modals/partially_read_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %}
|
||||
{% join "stop_reading" uuid as modal_id %}
|
||||
{% include 'snippets/reading_modals/stop_reading_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %}
|
||||
|
||||
{% join "progress_update" uuid as modal_id %}
|
||||
{% include 'snippets/reading_modals/progress_update_modal.html' with book=active_shelf_book id=modal_id readthrough=readthrough class="" %}
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
{% join "finish_reading" button_uuid as modal_id %}
|
||||
{% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %}
|
||||
|
||||
{% elif shelf.identifier == 'partially-read' %}
|
||||
{% elif shelf.identifier == 'stopped-reading' %}
|
||||
|
||||
{% trans "Partially read" as button_text %}
|
||||
{% trans "Stop reading" as button_text %}
|
||||
{% url 'reading-status' 'stop' book.id as fallback_url %}
|
||||
{% join "partially_read" button_uuid as modal_id %}
|
||||
{% join "stop_reading" button_uuid as modal_id %}
|
||||
{% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %}
|
||||
|
||||
{% elif shelf.identifier == 'to-read' %}
|
||||
|
|
|
@ -33,11 +33,11 @@
|
|||
{% join "finish_reading" button_uuid as modal_id %}
|
||||
{% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %}
|
||||
|
||||
{% elif shelf.identifier == 'partially-read' %}
|
||||
{% elif shelf.identifier == 'stopped-reading' %}
|
||||
|
||||
{% trans "Stop reading" as button_text %}
|
||||
{% url 'reading-status' 'stop' book.id as fallback_url %}
|
||||
{% join "partially_read" button_uuid as modal_id %}
|
||||
{% join "stop_reading" button_uuid as modal_id %}
|
||||
{% include 'snippets/shelve_button/modal_button.html' with class=class fallback_url=fallback_url %}
|
||||
|
||||
{% elif shelf.identifier == 'to-read' %}
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
{% trans "Currently Reading" %}
|
||||
{% elif shelf.identifier == 'read' %}
|
||||
{% trans "Read" %}
|
||||
{% elif shelf.identifier == 'partially-read' %}
|
||||
{% trans "Partially Read" %}
|
||||
{% elif shelf.identifier == 'stopped-reading' %}
|
||||
{% trans "Stopped Reading" %}
|
||||
{% else %}
|
||||
{{ shelf.name }}
|
||||
{% endif %}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
{% if shelf.name == 'To Read' %}{% trans "To Read" %}
|
||||
{% elif shelf.name == 'Currently Reading' %}{% trans "Currently Reading" %}
|
||||
{% elif shelf.name == 'Read' %}{% trans "Read" %}
|
||||
{% elif shelf.name == 'Partially Read' %}{% trans "Partially Read" %}
|
||||
{% elif shelf.name == 'Stopped Reading' %}{% trans "Stopped Reading" %}
|
||||
{% else %}{{ shelf.name }}{% endif %}
|
||||
{% if shelf.size > 4 %}<small>(<a href="{{ shelf.local_path }}">{% blocktrans with size=shelf.size %}View all {{ size }}{% endblocktrans %}</a>)</small>{% endif %}
|
||||
</h3>
|
||||
|
|
|
@ -36,19 +36,22 @@ def get_next_shelf(current_shelf):
|
|||
def active_shelf(context, book):
|
||||
"""check what shelf a user has a book on, if any"""
|
||||
user = context["request"].user
|
||||
return cache.get_or_set(
|
||||
f"active_shelf-{user.id}-{book.id}",
|
||||
lambda u, b: (
|
||||
models.ShelfBook.objects.filter(
|
||||
shelf__user=u,
|
||||
book__parent_work__editions=b,
|
||||
).first()
|
||||
or False
|
||||
),
|
||||
user,
|
||||
book,
|
||||
timeout=15552000,
|
||||
) or {"book": book}
|
||||
return (
|
||||
cache.get_or_set(
|
||||
f"active_shelf-{user.id}-{book.id}",
|
||||
lambda u, b: (
|
||||
models.ShelfBook.objects.filter(
|
||||
shelf__user=u,
|
||||
book__parent_work__editions=b,
|
||||
).first()
|
||||
or False
|
||||
),
|
||||
user,
|
||||
book,
|
||||
timeout=15552000,
|
||||
)
|
||||
or {"book": book}
|
||||
)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=False)
|
||||
|
|
|
@ -58,12 +58,12 @@ class User(TestCase):
|
|||
self.assertTrue("To Read" in names)
|
||||
self.assertTrue("Currently Reading" in names)
|
||||
self.assertTrue("Read" in names)
|
||||
self.assertTrue("Partially Read" in names)
|
||||
self.assertTrue("Stopped Reading" in names)
|
||||
ids = [s.identifier for s in shelves]
|
||||
self.assertTrue("to-read" in ids)
|
||||
self.assertTrue("reading" in ids)
|
||||
self.assertTrue("read" in ids)
|
||||
self.assertTrue("partially-read" in ids)
|
||||
self.assertTrue("stopped-reading" in ids)
|
||||
|
||||
def test_activitypub_serialize(self):
|
||||
activity = self.user.to_activity()
|
||||
|
|
|
@ -42,7 +42,7 @@ class ReadingStatus(View):
|
|||
"want": models.Shelf.TO_READ,
|
||||
"start": models.Shelf.READING,
|
||||
"finish": models.Shelf.READ_FINISHED,
|
||||
"stop": models.Shelf.PARTIALLY_READ,
|
||||
"stop": models.Shelf.STOPPED_READING,
|
||||
}.get(status)
|
||||
if not identifier:
|
||||
return HttpResponseBadRequest()
|
||||
|
|
Loading…
Reference in a new issue