Merge branch 'main' into production

This commit is contained in:
Mouse Reeve 2021-03-19 16:07:57 -07:00
commit 08cf9b5b40
19 changed files with 2917 additions and 1075 deletions

View file

@ -0,0 +1,30 @@
# Generated by Django 3.1.6 on 2021-03-19 19:13
import bookwyrm.models.fields
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0052_user_show_goal"),
]
operations = [
migrations.AlterField(
model_name="review",
name="rating",
field=bookwyrm.models.fields.DecimalField(
blank=True,
decimal_places=2,
default=None,
max_digits=3,
null=True,
validators=[
django.core.validators.MinValueValidator(1),
django.core.validators.MaxValueValidator(5),
],
),
),
]

View file

@ -0,0 +1,25 @@
# Generated by Django 3.1.6 on 2021-03-19 19:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0053_auto_20210319_1913"),
]
operations = [
migrations.AlterField(
model_name="importitem",
name="data",
field=models.JSONField(),
),
migrations.AlterField(
model_name="user",
name="first_name",
field=models.CharField(
blank=True, max_length=150, verbose_name="first name"
),
),
]

View file

@ -444,3 +444,7 @@ class BooleanField(ActivitypubFieldMixin, models.BooleanField):
class IntegerField(ActivitypubFieldMixin, models.IntegerField):
""" activitypub-aware boolean field """
class DecimalField(ActivitypubFieldMixin, models.DecimalField):
""" activitypub-aware boolean field """

View file

@ -3,7 +3,6 @@ import re
import dateutil.parser
from django.apps import apps
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.utils import timezone
@ -70,7 +69,7 @@ class ImportItem(models.Model):
job = models.ForeignKey(ImportJob, on_delete=models.CASCADE, related_name="items")
index = models.IntegerField()
data = JSONField()
data = models.JSONField()
book = models.ForeignKey(Book, on_delete=models.SET_NULL, null=True, blank=True)
fail_reason = models.TextField(null=True)

View file

@ -273,11 +273,13 @@ class Review(Status):
book = fields.ForeignKey(
"Edition", on_delete=models.PROTECT, activitypub_field="inReplyToBook"
)
rating = fields.IntegerField(
rating = fields.DecimalField(
default=None,
null=True,
blank=True,
validators=[MinValueValidator(1), MaxValueValidator(5)],
decimal_places=2,
max_digits=3,
)
@property

View file

@ -1,11 +1,4 @@
// Toggle all checkboxes.
window.onload = function() {
document
.querySelectorAll('[data-action="toggle-all"]')
.forEach(input => {
input.addEventListener('change', toggleAllCheckboxes);
});
};
/**
* Toggle all descendant checkboxes of a target.

View file

@ -1,14 +1,4 @@
// set javascript listeners
window.onload = function() {
// display based on localstorage vars
document.querySelectorAll('[data-hide]')
.forEach(t => setDisplay(t));
// update localstorage
Array.from(document.getElementsByClassName('set-display'))
.forEach(t => t.onclick = updateDisplay);
};
function updateDisplay(e) {
// used in set reading goal
var key = e.target.getAttribute('data-id');

View file

@ -23,6 +23,24 @@ window.onload = function() {
// browser back behavior
document.querySelectorAll('[data-back]')
.forEach(t => t.onclick = back);
Array.from(document.getElementsByClassName('tab-group'))
.forEach(t => new TabGroup(t));
// display based on localstorage vars
document.querySelectorAll('[data-hide]')
.forEach(t => setDisplay(t));
// update localstorage
Array.from(document.getElementsByClassName('set-display'))
.forEach(t => t.onclick = updateDisplay);
// Toggle all checkboxes.
document
.querySelectorAll('[data-action="toggle-all"]')
.forEach(input => {
input.addEventListener('change', toggleAllCheckboxes);
});
};
function back(e) {

View file

@ -1,10 +1,3 @@
// tab groups
window.onload = function() {
Array.from(document.getElementsByClassName('tab-group'))
.forEach(t => new TabGroup(t));
};
/*
* The content below is licensed according to the W3C Software License at
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document

View file

@ -22,7 +22,7 @@
</div>
</div>
{% if readthrough.progress_mode == 'PG' and book.pages %}
<p class="help">{% blocktrans %}of {{ book.pages }} pages{% endblocktrans %}</p>
<p class="help">{% blocktrans with pages=book.pages %}of {{ pages }} pages{% endblocktrans %}</p>
{% endif %}
</div>
</form>

Binary file not shown.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff