forked from mirrors/bookwyrm
Makes pages/percents toggle-able in sidebar
This commit is contained in:
parent
6c52afeae0
commit
3db0de3dd4
2 changed files with 49 additions and 13 deletions
36
bookwyrm/migrations/0040_auto_20210122_0057.py
Normal file
36
bookwyrm/migrations/0040_auto_20210122_0057.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
# Generated by Django 3.0.7 on 2021-01-22 00:57
|
||||
|
||||
import bookwyrm.models.fields
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('bookwyrm', '0039_merge_20210120_0753'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='progressupdate',
|
||||
name='progress',
|
||||
field=models.IntegerField(validators=[django.core.validators.MinValueValidator(0)]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='progressupdate',
|
||||
name='readthrough',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='bookwyrm.ReadThrough'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='progressupdate',
|
||||
name='remote_id',
|
||||
field=bookwyrm.models.fields.RemoteIdField(max_length=255, null=True, validators=[bookwyrm.models.fields.validate_remote_id]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='readthrough',
|
||||
name='progress',
|
||||
field=models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)]),
|
||||
),
|
||||
]
|
|
@ -1,27 +1,27 @@
|
|||
<form class="field is-grouped is-small" action="/edit-readthrough" method="POST">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="id" value="{{ readthrough.id }}"/>
|
||||
<label class="label is-align-self-center mb-0 pr-2" for="progress">Currently at</label>
|
||||
<div class="control">
|
||||
<div class="field has-addons">
|
||||
<div class="field">
|
||||
<label class="label is-align-self-center mb-0 pr-2" for="progress">Progress:</label>
|
||||
<div class="field has-addons mb-0">
|
||||
<div class="control">
|
||||
<input
|
||||
aria-label="{% if readthrough.progress_mode == 'PG' %}Current page{% else %}Percent read{% endif %}"
|
||||
class="input is-small" type="number"
|
||||
name="progress" size="3" value="{{ readthrough.progress|default:'' }}">
|
||||
</div>
|
||||
<div class="control select is-small">
|
||||
<select name="progress_mode" aria-label="Progress mode">
|
||||
<option value="PG" {% if readthrough.progress_mode == 'PG' %}selected{% endif %}>pages</option>
|
||||
<option value="PCT" {% if readthrough.progress_mode == 'PCT' %}selected{% endif %}>percent</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="control">
|
||||
<a class="button is-small is-static">
|
||||
{% if readthrough.progress_mode == 'PG' %}
|
||||
pages
|
||||
{% else %}
|
||||
%
|
||||
{% endif %}
|
||||
</a>
|
||||
<button class="button is-small px-2 is-primary" type="submit">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control">
|
||||
<button class="button is-small px-2" type="submit">Save</button>
|
||||
{% if readthrough.progress_mode == 'PG' and book.pages %}
|
||||
<p class="help">of {{ book.pages }} pages</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue