mirror of
https://github.com/daniviga/django-ram.git
synced 2026-02-03 17:40:39 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
16bd82de39
|
|||
|
2ae7f2685d
|
|||
|
29f9a213b4
|
|||
|
884661d4e1
|
|||
|
c7cace96f7
|
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 6.0 on 2025-12-31 13:47
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bookshelf", "0030_tocentry"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="tocentry",
|
||||
name="authors",
|
||||
field=models.CharField(blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="tocentry",
|
||||
name="subtitle",
|
||||
field=models.CharField(blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="tocentry",
|
||||
name="title",
|
||||
field=models.CharField(),
|
||||
),
|
||||
]
|
||||
@@ -254,9 +254,9 @@ class TocEntry(BaseModel):
|
||||
book = models.ForeignKey(
|
||||
BaseBook, on_delete=models.CASCADE, related_name="toc"
|
||||
)
|
||||
title = models.CharField(max_length=200)
|
||||
subtitle = models.CharField(max_length=200, blank=True)
|
||||
authors = models.CharField(max_length=256, blank=True)
|
||||
title = models.CharField()
|
||||
subtitle = models.CharField(blank=True)
|
||||
authors = models.CharField(blank=True)
|
||||
page = models.SmallIntegerField()
|
||||
featured = models.BooleanField(
|
||||
default=False,
|
||||
@@ -268,9 +268,15 @@ class TocEntry(BaseModel):
|
||||
verbose_name_plural = "Table of Contents Entries"
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.title} (p. {self.page})"
|
||||
if self.subtitle:
|
||||
title = f"{self.title}: {self.subtitle}"
|
||||
else:
|
||||
title = self.title
|
||||
return f"{title} (p. {self.page})"
|
||||
|
||||
def clean(self):
|
||||
if self.page is None:
|
||||
raise ValidationError("Page number is required.")
|
||||
if self.page < 1:
|
||||
raise ValidationError("Page number is invalid.")
|
||||
try:
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="tab-pane" id="nav-toc" role="tabpanel" aria-labelledby="nav-toc-tab">
|
||||
<div class="tab-pane table-responsive" id="nav-toc" role="tabpanel" aria-labelledby="nav-toc-tab">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -216,22 +216,7 @@
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-pane" id="nav-documents" role="tabpanel" aria-labelledby="nav-documents-tab">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" scope="row">Documents</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-group-divider">
|
||||
{% for d in documents.all %}
|
||||
<tr>
|
||||
<td class="w-33">{{ d.description }}</td>
|
||||
<td><a href="{{ d.file.url }}" target="_blank">{{ d.filename }}</a></td>
|
||||
<td class="text-end">{{ d.file.size | filesizeformat }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% include "includes/documents.html" %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
<option value="nav-summary" selected>Summary</option>
|
||||
</select>
|
||||
<div class="tab-content" id="nav-tabContent">
|
||||
<div class="tab-pane show active" id="nav-summary" role="tabpanel" aria-labelledby="nav-summary-tab">
|
||||
<div class="tab-pane show active table-responsive" id="nav-summary" role="tabpanel" aria-labelledby="nav-summary-tab">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
26
ram/portal/templates/includes/documents.html
Normal file
26
ram/portal/templates/includes/documents.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{% if documents %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" scope="row">{{ header|default:"Documents" }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-group-divider">
|
||||
{% for d in documents.all %}
|
||||
<tr>
|
||||
<td class="w-33">{{ d.description }}</td>
|
||||
<td class="text-nowrap">
|
||||
{% if d.private %}
|
||||
<i class="bi bi-file-earmark-lock2"></i>
|
||||
{% else %}
|
||||
<i class="bi bi-file-earmark-text"></i>
|
||||
{% endif %}
|
||||
<a href="{{ d.file.url }}" target="_blank">{{ d.filename }}</a>
|
||||
</td>
|
||||
<td class="text-end">{{ d.file.size | filesizeformat }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
@@ -402,43 +402,9 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-pane" id="nav-documents" role="tabpanel" aria-labelledby="nav-documents-tab">
|
||||
{% if documents %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" scope="row">Documents</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-group-divider">
|
||||
{% for d in documents.all %}
|
||||
<tr>
|
||||
<td class="w-33">{{ d.description }}</td>
|
||||
<td><a href="{{ d.file.url }}" target="_blank">{{ d.filename }}</a></td>
|
||||
<td class="text-end">{{ d.file.size | filesizeformat }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
{% if decoder_documents %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" scope="row">Decoder documents</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-group-divider">
|
||||
{% for d in decoder_documents.all %}
|
||||
<tr>
|
||||
<td class="w-33">{{ d.description }}</td>
|
||||
<td><a href="{{ d.file.url }}" target="_blank">{{ d.filename }}</a></td>
|
||||
<td class="text-end">{{ d.file.size | filesizeformat }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
<div class="tab-pane table-responsive" id="nav-documents" role="tabpanel" aria-labelledby="nav-documents-tab">
|
||||
{% include "includes/documents.html" %}
|
||||
{% include "includes/documents.html" with documents=decoder_documents header="Decoder documents" %}
|
||||
</div>
|
||||
<div class="tab-pane" id="nav-journal" role="tabpanel" aria-labelledby="nav-journal-tab">
|
||||
<table class="table table-striped">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from ram.utils import git_suffix
|
||||
|
||||
__version__ = "0.19.3"
|
||||
__version__ = "0.19.5"
|
||||
__version__ += git_suffix(__file__)
|
||||
|
||||
Reference in New Issue
Block a user