mirror of https://github.com/logos-co/open-law.git
hotfix: contributing books in my library
This commit is contained in:
parent
4cf5e2a2a2
commit
da831670c3
File diff suppressed because one or more lines are too long
|
@ -28,22 +28,29 @@
|
|||
<!-- prettier-ignore -->
|
||||
<div class="flex flex-col w-4/5">
|
||||
{% for book in books if not book.is_deleted%}
|
||||
{% if loop.index==1 %}
|
||||
<h1 class=" text-lg font-extrabold dark:text-white ml-4">My library</h1>
|
||||
{% endif %}
|
||||
<!-- prettier-ignore -->
|
||||
<dl class="bg-white dark:bg-gray-900 h-max w-full p-5 text-gray-900 divide-y divide-gray-200 dark:text-white dark:divide-gray-700 m-3 border-2 border-gray-200 border-solid rounded-lg dark:border-gray-700">
|
||||
<dt class="mb-2"><a class="flex flex-col pb-4" href="{{url_for('book.collection_view',book_id=book.id)}}">{{book.label}}</a></dt>
|
||||
{% if loop.index==1 %}
|
||||
<h1 class=" text-lg font-extrabold dark:text-white ml-4">My library</h1>
|
||||
{% endif %}
|
||||
<!-- prettier-ignore -->
|
||||
<dl class="bg-white dark:bg-gray-900 h-max w-full p-5 text-gray-900 divide-y divide-gray-200 dark:text-white dark:divide-gray-700 m-3 border-2 border-gray-200 border-solid rounded-lg dark:border-gray-700">
|
||||
<dt class="mb-2">
|
||||
<a class="flex pb-4" href="{{url_for('book.collection_view',book_id=book.id)}}">
|
||||
{% if book.user_id != current_user.id %}
|
||||
<span class="mr-2 bg-blue-400 border border-sky-900 dark:!text-black rounded text-center px-1">Contributing</span>
|
||||
{% endif %}
|
||||
{{book.label}}
|
||||
</a>
|
||||
</dt>
|
||||
<dd class="flex flex-col md:flex-row text-lg font-semibold text-gray-500 md:text-lg dark:text-gray-400">
|
||||
{% if book.versions %}
|
||||
<p>
|
||||
Last updated on {{book.versions[-1].updated_at.strftime('%B %d, %Y')}}
|
||||
</p>
|
||||
<p>
|
||||
Last updated on {{book.versions[-1].updated_at.strftime('%B %d, %Y')}}
|
||||
</p>
|
||||
{% endif %}
|
||||
<div class="flex ml-auto align-center justify-center space-x-3">
|
||||
<span class="book-star-block space-x-0.5 flex items-center">
|
||||
<svg class="star-btn cursor-pointer w-4 h-4 inline-flex mr-1 {% if book.current_user_has_star %}fill-yellow-300{% endif %}" data-book-id={{ book.id }} xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 22 22" stroke-width="1" stroke="currentColor"> <path stroke-linecap="round" stroke-linejoin="round" d="M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z" /> </svg>
|
||||
<a href={{ url_for('book.statistic_view', book_id=book.id ) }} class="total-stars">{{ book.stars|length }}</a>
|
||||
<a href='{{ url_for("book.statistic_view", book_id=book.id ) }}' class="total-stars">{{ book.stars|length }}</a>
|
||||
</span>
|
||||
<span class="space-x-0.5 flex items-center">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 22 22" stroke-width="1" stroke="currentColor" class="w-4 h-4 inline-flex mr-1"> <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" /> </svg>
|
||||
|
@ -55,7 +62,7 @@
|
|||
</span>
|
||||
</div>
|
||||
</dd>
|
||||
</dl>
|
||||
</dl>
|
||||
{% endfor %}
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
|
|
|
@ -55,7 +55,10 @@ def my_library():
|
|||
db.session.query(m.Book)
|
||||
.join(m.BookContributor, m.BookContributor.book_id == m.Book.id, full=True)
|
||||
.filter(
|
||||
m.Book.user_id == current_user.id,
|
||||
or_(
|
||||
m.Book.user_id == current_user.id,
|
||||
m.BookContributor.user_id == current_user.id,
|
||||
),
|
||||
m.Book.is_deleted == False, # noqa: E712
|
||||
)
|
||||
.group_by(m.Book.id)
|
||||
|
|
Loading…
Reference in New Issue