Show progress on status

This commit is contained in:
Mouse Reeve 2021-03-20 18:03:20 -07:00
parent 17489f002f
commit d3a4282f11
5 changed files with 32 additions and 36 deletions

View file

@ -84,7 +84,7 @@ class CommentForm(CustomForm):
"sensitive",
"privacy",
"progress",
"mode",
"progress_mode",
]

View file

@ -1,34 +0,0 @@
# Generated by Django 3.1.6 on 2021-03-21 00:25
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0054_auto_20210319_1942"),
]
operations = [
migrations.AddField(
model_name="comment",
name="mode",
field=models.CharField(
blank=True,
choices=[("PG", "page"), ("PCT", "percent")],
default="PG",
max_length=3,
null=True,
),
),
migrations.AddField(
model_name="comment",
name="progress",
field=models.IntegerField(
blank=True,
null=True,
validators=[django.core.validators.MinValueValidator(0)],
),
),
]

View file

@ -0,0 +1,24 @@
# Generated by Django 3.1.6 on 2021-03-21 01:01
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0054_auto_20210319_1942'),
]
operations = [
migrations.AddField(
model_name='comment',
name='progress',
field=models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)]),
),
migrations.AddField(
model_name='comment',
name='progress_mode',
field=models.CharField(blank=True, choices=[('PG', 'page'), ('PCT', 'percent')], default='PG', max_length=3, null=True),
),
]

View file

@ -235,7 +235,7 @@ class Comment(Status):
progress = models.IntegerField(
validators=[MinValueValidator(0)], null=True, blank=True
)
mode = models.CharField(
progress_mode = models.CharField(
max_length=3,
choices=ProgressMode.choices,
default=ProgressMode.PAGE,

View file

@ -35,3 +35,9 @@
{% elif status.mention_books %}
<a href="/book/{{ status.mention_books.first.id }}">{{ status.mention_books.first.title }}</a>
{% endif %}
{% if status.progress %}
<p class="help">
({% if status.progress_mode == 'PG' %}page {{ status.progress }}{%else %}{{ status.progress }}%{% endif %})
</p>
{% endif %}