mirror of
https://github.com/logos-co/open-law.git
synced 2025-02-12 23:06:30 +00:00
fix UI
This commit is contained in:
parent
4a14ede66c
commit
de536841bd
@ -43,7 +43,7 @@ class Book(BaseModel):
|
||||
raise ValueError("No active version found")
|
||||
|
||||
@property
|
||||
def actual_version(self):
|
||||
def actual_versions(self):
|
||||
versions = (
|
||||
m.BookVersion.query.filter_by(is_deleted=False, book_id=self.id)
|
||||
.order_by(m.BookVersion.created_at.asc())
|
||||
|
@ -178,6 +178,9 @@
|
||||
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||
<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3">
|
||||
#
|
||||
</th>
|
||||
<th scope="col" class="px-6 py-3">
|
||||
Name
|
||||
</th>
|
||||
@ -189,10 +192,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for version in book.versions if not version.is_deleted and not version.is_active %}
|
||||
{% for version in book.actual_versions if not version.is_active %}
|
||||
<tr class="bg-white border-b dark:bg-gray-900 dark:border-gray-700">
|
||||
<td class="px-6 truncate max-w-[280]">{{ loop.index }}</td>
|
||||
<td class="px-6 truncate max-w-[280]">{{ version.semver }}</td>
|
||||
<td class="px-6"> {{ version.created_at }} </td>
|
||||
<td class="px-6"> {{ version.created_at.strftime('%B %d, %Y') }} </td>
|
||||
<td class="px-4 py-4">
|
||||
<button type="button" data-version-id="{{ version.id }}" data-version-semver="{{ version.semver }}" data-modal-target="edit-version-label-modal" data-modal-toggle="edit-version-label-modal" class="edit-version-label-btns text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-1 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700">
|
||||
Edit
|
||||
|
@ -21,10 +21,10 @@ def collection_view(book_id: int, version_index: int = None):
|
||||
breadcrumbs = create_breadcrumbs(book_id=book_id)
|
||||
version = None
|
||||
if version_index is not None:
|
||||
actual_version = book.actual_version
|
||||
if version_index == 0 or len(actual_version) < version_index:
|
||||
actual_versions = book.actual_versions
|
||||
if version_index == 0 or len(actual_versions) < version_index:
|
||||
return redirect(url_for("book.collection_view", book_id=book_id))
|
||||
version = actual_version[version_index]
|
||||
version = actual_versions[version_index]
|
||||
if not book or book.is_deleted:
|
||||
log(log.WARNING, "Book with id [%s] not found", book_id)
|
||||
flash("Book not found", "danger")
|
||||
|
Loading…
x
Reference in New Issue
Block a user