mirror of
https://github.com/daniviga/django-ram.git
synced 2026-02-04 18:10:38 +01:00
Compare commits
5 Commits
d3c099c05b
...
v0.19.5
| 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(
|
book = models.ForeignKey(
|
||||||
BaseBook, on_delete=models.CASCADE, related_name="toc"
|
BaseBook, on_delete=models.CASCADE, related_name="toc"
|
||||||
)
|
)
|
||||||
title = models.CharField(max_length=200)
|
title = models.CharField()
|
||||||
subtitle = models.CharField(max_length=200, blank=True)
|
subtitle = models.CharField(blank=True)
|
||||||
authors = models.CharField(max_length=256, blank=True)
|
authors = models.CharField(blank=True)
|
||||||
page = models.SmallIntegerField()
|
page = models.SmallIntegerField()
|
||||||
featured = models.BooleanField(
|
featured = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
@@ -268,9 +268,15 @@ class TocEntry(BaseModel):
|
|||||||
verbose_name_plural = "Table of Contents Entries"
|
verbose_name_plural = "Table of Contents Entries"
|
||||||
|
|
||||||
def __str__(self):
|
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):
|
def clean(self):
|
||||||
|
if self.page is None:
|
||||||
|
raise ValidationError("Page number is required.")
|
||||||
if self.page < 1:
|
if self.page < 1:
|
||||||
raise ValidationError("Page number is invalid.")
|
raise ValidationError("Page number is invalid.")
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -191,7 +191,7 @@
|
|||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</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">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -216,22 +216,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="nav-documents" role="tabpanel" aria-labelledby="nav-documents-tab">
|
<div class="tab-pane" id="nav-documents" role="tabpanel" aria-labelledby="nav-documents-tab">
|
||||||
<table class="table table-striped">
|
{% include "includes/documents.html" %}
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
|
<div class="d-grid gap-2 d-md-flex justify-content-md-end">
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
<option value="nav-summary" selected>Summary</option>
|
<option value="nav-summary" selected>Summary</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="tab-content" id="nav-tabContent">
|
<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">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<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>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="nav-documents" role="tabpanel" aria-labelledby="nav-documents-tab">
|
<div class="tab-pane table-responsive" id="nav-documents" role="tabpanel" aria-labelledby="nav-documents-tab">
|
||||||
{% if documents %}
|
{% include "includes/documents.html" %}
|
||||||
<table class="table table-striped">
|
{% include "includes/documents.html" with documents=decoder_documents header="Decoder documents" %}
|
||||||
<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>
|
</div>
|
||||||
<div class="tab-pane" id="nav-journal" role="tabpanel" aria-labelledby="nav-journal-tab">
|
<div class="tab-pane" id="nav-journal" role="tabpanel" aria-labelledby="nav-journal-tab">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from ram.utils import git_suffix
|
from ram.utils import git_suffix
|
||||||
|
|
||||||
__version__ = "0.19.3"
|
__version__ = "0.19.5"
|
||||||
__version__ += git_suffix(__file__)
|
__version__ += git_suffix(__file__)
|
||||||
|
|||||||
Reference in New Issue
Block a user