Merge pull request #156 from Simple2B/kostia/fix/fix_issues

Kostia/fix/fix issues
This commit is contained in:
Костя Столярский 2023-06-16 11:35:53 +03:00 committed by GitHub
commit 8b68e6d091
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 226 additions and 248 deletions

View File

@ -17,6 +17,7 @@
"CLEANR",
"CUDA",
"Divs",
"favorited",
"flowbite",
"indeterminated",
"jsonify",

View File

@ -267,14 +267,14 @@ def contributor_notification(
book: m.Book = db.session.get(m.Book, entity_id)
match action:
case m.Notification.Actions.CONTRIBUTING:
text = f"You've been added to {book.label} as an Editor/Moderator"
text = f"You've been added to {book.label} as an Contributor"
link = url_for(
"book.collection_view",
book_id=book.id,
)
case m.Notification.Actions.DELETE:
text = f"You've been removed from {book.label} as an Editor/Moderator"
text = f"You've been removed from {book.label} as an Contributor"
link = url_for(
"book.collection_view",
book_id=book.id,

View File

@ -5,7 +5,7 @@ from app.controllers import create_pagination
def sort_by(query, sort: str):
match sort:
case "favored":
case "favorited":
query = query.order_by(text("stars_count DESC"))
case "upvoted":
query = query.order_by(text("score DESC"))

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,12 @@
<div class="bg-white dark:bg-gray-800 mr-5">
<ul class="flex font-medium">
<li>
{% if not selected_tab=='my_contributions' %}
<!-- prettier-ignore -->
<button type="button" data-modal-target="add-book-modal" data-modal-toggle="add-book-modal" class="text-white ml-2 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2.5 text-center inline-flex items-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4"> <path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" /> </svg>
New book
</button>
{% endif %}
</li>
<li>
<!-- prettier-ignore -->
@ -30,8 +32,8 @@
{% if selected_tab=='my_library' or selected_tab=='favorite_books' or selected_tab=='explore_books'%}
<li>
<a href="?sort=favored" class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white" >
Most favored
<a href="?sort=favorited" class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white" >
Most favorited
</a>
</li>
{% endif %}

View File

@ -1,169 +1,48 @@
{% if not collection.active_sections %}
<!-- if collection has sub_collection make for loop for it -->
<!-- prettier-ignore -->
{% for sub_collection in collection.active_children if not sub_collection.is_deleted%}
<p class="my-3" id="collection-{{sub_collection.label}}">
##{{sub_collection.label}}
</p>
<!-- prettier-ignore -->
{% if not sub_collection.active_sections and not sub_collection.active_children%}
<p class="ml-3 my-3 italic text-sm">This sub collection is empty</p>
{% endif %}
<!-- prettier-ignore -->
{% if sub_collection.active_children %}
<!-- if collection has sub_collection make for loop for it -->
<!-- prettier-ignore -->
{% for sub_collection in collection.active_children if not sub_collection.is_deleted%}
<p class="my-3" id="collection-{{sub_collection.label}}">
##{{sub_collection.label}}
</p>
<!-- prettier-ignore -->
{% if not sub_collection.active_sections and not sub_collection.active_children%}
<p class="ml-3 my-3 italic text-sm">This sub collection is empty</p>
{% endif %}
<!-- prettier-ignore -->
{% if sub_collection.active_children %}
{{recursive_render("book/components/sub_collection_preview_content.html",sub_collection,book)|safe}}
{% else %}
<!-- prettier-ignore -->
{% for section in sub_collection.active_sections %}
<div class="bg-inherit max-w-full text-gray-900 dark:text-white mt-1">
<div class="flex flex-col pb-3 w-full">
<div class="flex w-full mb-1 dark:text-gray-100 flex-col">
<!-- prettier-ignore -->
<a href="{{url_for('book.interpretation_view', book_id=book.id, section_id=section.copy_of or section.id)}}">
<!-- prettier-ignore -->
{% for section in sub_collection.active_sections %}
<div class="bg-inherit max-w-full text-gray-900 dark:text-white mt-1">
<div class="flex flex-col pb-3 w-full">
<div class="flex w-full mb-1 dark:text-gray-100 flex-col">
<!-- prettier-ignore -->
<a href="{{url_for('book.interpretation_view', book_id=book.id, section_id=section.copy_of or section.id)}}">
<p id="section-{{section.label}}" class="my-3">{{ section.label }}</p></a>
{% if not section.active_interpretations %}
<p class="ml-3 my-3 italic text-sm">This section is empty</p>
{% else %}
<div class="ql-snow">
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
<p> {{display_inline_elements(section.approved_interpretation.text)|safe }} </p>
</div>
</div>
<div
class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3">
<span class="text-sm">
Interpretation by
<a
href="{{url_for('user.profile', user_id=section.approved_interpretation.user.id)}}"
class="text-blue-500 {% if section.approved_interpretation.user.is_deleted %}line-through{% endif %}"
>
{{section.approved_interpretation.user.username}}
</a >
on {{section.approved_interpretation.created_at.strftime('%B %d, %Y')}}
</span>
<button
data-tooltip-target="tooltip-click"
data-tooltip-trigger="click"
id="copyLinkButton"
type="button"
class="hover:dark:text-white hover:text-black focus:ring-2 rounded-full font-medium text-sm p-2.5 text-center inline-flex items-center dark:hover:text-white"
data-link="{{ build_qa_url(section.approved_interpretation) }}"
>
<!-- prettier-ignore -->
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15m0-3l-3-3m0 0l-3 3m3-3V15" /> </svg>
</button>
<div
id="tooltip-click"
role="tooltip"
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700"
>
Link copied!
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
</div>
<!--Comments-->
{% if not section.approved_comments %}
<p>No comments for current section</p>
{% else %}
<div
id="accordion-comments-collapse-{{loop.index}}"
data-accordion="collapse">
<h2
id="accordion-comments-collapse-{{loop.index}}-heading-{{loop.index}}">
<button
type="button"
class="flex items-center bg-inherit justify-start w-full p-5 font-medium text-left"
data-accordion-target="#accordion-comments-collapse-{{loop.index}}-body-{{loop.index}}"
aria-expanded="false"
aria-controls="accordion-collapse-body-1"
>
<!-- prettier-ignore -->
<svg data-accordion-icon class="w-6 h-6 rotate-180 shrink-0" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path> </svg>
<span><i>Comments:</i></span>
</button>
</h2>
<div
id="accordion-comments-collapse-{{loop.index}}-body-{{loop.index}}"
class="hidden"
aria-labelledby="accordion-collapse-heading-{{loop.index}}"
>
{% for comment in section.approved_comments %}
<div class="p-5 ml-6">
<div class="dark:text-white h-30">
<div class="ql-snow mb-2">
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
<p>{{ display_inline_elements(comment.text)|safe }}</p>
</div>
</div>
</div>
<div
class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3"
>
<span class="text-sm">
Created by
<a href="{{ url_for('user.profile', user_id=comment.user.id) }}" class="text-blue-500 {% if comment.user.is_deleted %}line-through{% endif %}" >
{{comment.user.username}}
</a>
on {{comment.created_at.strftime('%B %d, %Y')}}
</span>
<button
data-tooltip-target="tooltip-click"
data-tooltip-trigger="click"
id="copyLinkButton"
type="button"
class="hover:dark:text-white hover:text-black focus:ring-2 rounded-full font-medium text-sm p-2.5 text-center inline-flex items-center dark:hover:text-white"
data-link="{{ build_qa_url(section.approved_interpretation) }}">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> <path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15m0-3l-3-3m0 0l-3 3m3-3V15" /> </svg>
</button>
<div
id="tooltip-click"
role="tooltip"
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700"
>
Link copied!
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
<!-- prettier-ignore -->
{% endfor %}
{% endif %}
{% endfor %}
{% else %}
{% for section in collection.active_sections %}
<a href="{{url_for('book.interpretation_view', book_id=book.id, section_id=section.copy_of or section.id)}}">
<p id="section-{{section.label}}" class="my-3">
{{ section.label }}
</p>
</a>
{% if not section.active_interpretations %}
{% if not section.active_interpretations %}
<p class="ml-3 my-3 italic text-sm">This section is empty</p>
{% else %}
<div class="ql-snow mb-3">
{% else %}
<div class="ql-snow">
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
<p>
{{ display_inline_elements(section.approved_interpretation.text)|safe }}
{{display_inline_elements(section.approved_interpretation.text)|safe
}}
</p>
</div>
</div>
<div class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3">
<span class="text-sm" >
<div
class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3">
<span class="text-sm">
Interpretation by
<a
href="{{url_for('user.profile',user_id=section.approved_interpretation.user.id)}}"
class="text-blue-500 {% if section.approved_interpretation.user.is_deleted %}line-through{% endif %}"
>
href="{{url_for('user.profile', user_id=section.approved_interpretation.user.id)}}"
class="text-blue-500 {% if section.approved_interpretation.user.is_deleted %}line-through{% endif %}">
{{section.approved_interpretation.user.username}}
</a>
on {{section.approved_interpretation.created_at.strftime('%B %d, %Y')}}
on {{section.approved_interpretation.created_at.strftime('%B %d,
%Y')}}
</span>
<button
data-tooltip-target="tooltip-click"
@ -171,92 +50,188 @@
id="copyLinkButton"
type="button"
class="hover:dark:text-white hover:text-black focus:ring-2 rounded-full font-medium text-sm p-2.5 text-center inline-flex items-center dark:hover:text-white"
data-link="{{ build_qa_url(section.approved_interpretation) }}"
>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> <path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15m0-3l-3-3m0 0l-3 3m3-3V15" /> </svg>
data-link="{{ build_qa_url(section.approved_interpretation) }}">
<!-- prettier-ignore -->
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15m0-3l-3-3m0 0l-3 3m3-3V15" /> </svg>
</button>
<div
id="tooltip-click"
role="tooltip"
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700"
>
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
Link copied!
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
</div>
<!--Comments-->
{% if not section.approved_comments %}
<div class="mb-3">
<p>No comments for current section</p>
</div>
<p>No comments for current section</p>
{% else %}
<div
id="accordion-comments-collapse-{{loop.index}}"
data-accordion="collapse">
<h2
id="accordion-comments-collapse-{{loop.index}}-heading-{{loop.index}}">
<button
type="button"
class="flex items-center bg-inherit justify-start w-full p-5 font-medium text-left"
data-accordion-target="#accordion-comments-collapse-{{loop.index}}-body-{{loop.index}}"
aria-expanded="false"
aria-controls="accordion-collapse-body-1">
<!-- prettier-ignore -->
<svg data-accordion-icon class="w-6 h-6 rotate-180 shrink-0" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path> </svg>
<span><i>Comments:</i></span>
</button>
</h2>
<div
id="accordion-comments-collapse-nest{{loop.index}}"
data-accordion="collapse"
class="mb-3"
>
<h2 id="accordion-comments-collapse-nest{{loop.index}}-heading-{{loop.index}}">
<button
type="button"
class="flex items-center bg-inherit justify-start w-full p-5 font-medium text-left"
data-accordion-target="#accordion-comments-collapse-nest{{loop.index}}-body-{{loop.index}}"
aria-expanded="false"
aria-controls="accordion-collapse-body-1"
>
<svg data-accordion-icon class="w-6 h-6 rotate-180 shrink-0" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path> </svg>
<span><i>Comments:</i> </span>
</button>
</h2>
<div
id="accordion-comments-collapse-nest{{loop.index}}-body-{{loop.index}}"
class="hidden"
aria-labelledby="accordion-collapse-heading-1"
>
{% for comment in section.approved_comments %}
<div class="p-5 ml-6">
<div class="dark:text-white h-30">
<div class="ql-snow mb-2">
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
<p>{{ display_inline_elements(comment.text)|safe }}</p>
</div>
</div>
</div>
<div
class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3">
<span class="text-sm" >
Created by
<a
href="{{url_for('user.profile',user_id=comment.user.id)}}"
class="text-blue-500 {% if comment.user.is_deleted %}line-through{% endif %}"
>{{comment.user.username}}
</a >
on {{comment.created_at.strftime('%B %d, %Y')}}
</span >
<button
data-tooltip-target="tooltip-click"
data-tooltip-trigger="click"
id="copyLinkButton"
type="button"
class="hover:dark:text-white hover:text-black focus:ring-2 rounded-full font-medium text-sm p-2.5 text-center inline-flex items-center dark:hover:text-white"
data-link="{{ build_qa_url(section.approved_interpretation) }}"
>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> <path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15m0-3l-3-3m0 0l-3 3m3-3V15" /> </svg>
</button>
<div
id="tooltip-click"
role="tooltip"
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700"
>
Link copied!
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
id="accordion-comments-collapse-{{loop.index}}-body-{{loop.index}}"
class="hidden"
aria-labelledby="accordion-collapse-heading-{{loop.index}}">
{% for comment in section.approved_comments %}
<div class="p-5 ml-6">
<div class="dark:text-white h-30">
<div class="ql-snow mb-2">
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
<p>{{ display_inline_elements(comment.text)|safe }}</p>
</div>
</div>
{% endfor %}
</div>
<div
class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3">
<span class="text-sm">
Created by
<a
href="{{ url_for('user.profile', user_id=comment.user.id) }}"
class="text-blue-500 {% if comment.user.is_deleted %}line-through{% endif %}">
{{comment.user.username}}
</a>
on {{comment.created_at.strftime('%B %d, %Y')}}
</span>
<div>
<!-- prettier-ignore -->
<a class="hover:dark:text-white hover:text-black focus:ring-2 rounded-full font-medium text-sm p-2.5 text-center inline-flex items-center dark:hover:text-white" href="{{ build_qa_url(section.approved_interpretation) }}">
<!-- prettier-ignore -->
<button data-tooltip-target="tooltip-click" data-tooltip-trigger="click" id="copyLinkButton" type="button" class="hover:dark:text-white hover:text-black focus:ring-2 rounded-full font-medium text-sm p-2.5 text-center inline-flex items-center dark:hover:text-white" data-link="{{ build_qa_url(section.approved_interpretation) }}">
<!-- prettier-ignore -->
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> <path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15m0-3l-3-3m0 0l-3 3m3-3V15" /> </svg>
</button>
<div id="tooltip-click" role="tooltip" class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700"> Link copied! <div class="tooltip-arrow" data-popper-arrow></div> </div>
</div>
</div>
</div>
{% endfor %}
</div>
{% endif %}
</div>
{% endif %} {% endif %}
</div>
</div>
</div>
<!-- prettier-ignore -->
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% else %}
{% for section in collection.active_sections %}
<a
href="{{url_for('book.interpretation_view', book_id=book.id, section_id=section.copy_of or section.id)}}">
<p id="section-{{section.label}}" class="my-3">{{ section.label }}</p>
</a>
{% if not section.active_interpretations %}
<p class="ml-3 my-3 italic text-sm">This section is empty</p>
{% else %}
<div class="ql-snow mb-3">
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
<p>
{{ display_inline_elements(section.approved_interpretation.text)|safe }}
</p>
</div>
</div>
<div
class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3">
<span class="text-sm">
Interpretation by
<a
href="{{url_for('user.profile',user_id=section.approved_interpretation.user.id)}}"
class="text-blue-500 {% if section.approved_interpretation.user.is_deleted %}line-through{% endif %}">
{{section.approved_interpretation.user.username}}
</a>
on {{section.approved_interpretation.created_at.strftime('%B %d, %Y')}}
</span>
<div>
<!-- prettier-ignore -->
<a class="hover:dark:text-white hover:text-black focus:ring-2 rounded-full font-medium text-sm p-2.5 text-center inline-flex items-center dark:hover:text-white" href="{{ build_qa_url(section.approved_interpretation) }}">
<!-- prettier-ignore -->
<button
data-tooltip-target="tooltip-click"
data-tooltip-trigger="click"
id="copyLinkButton"
type="button"
class="hover:dark:text-white hover:text-black focus:ring-2 rounded-full font-medium text-sm p-2.5 text-center inline-flex items-center dark:hover:text-white"
data-link="{{ build_qa_url(section.approved_interpretation) }}">
<!-- prettier-ignore -->
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> <path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15m0-3l-3-3m0 0l-3 3m3-3V15" /> </svg>
</button>
<div id="tooltip-click" role="tooltip" class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700"> Link copied! <div class="tooltip-arrow" data-popper-arrow></div> </div> </div>
</div>
<!--Comments-->
{% if not section.approved_comments %}
<div class="mb-3">
<p>No comments for current section</p>
</div>
{% else %}
<!-- prettier-ignore -->
<div id="accordion-comments-collapse-nest{{loop.index}}" data-accordion="collapse" class="mb-3">
<h2 id="accordion-comments-collapse-nest{{loop.index}}-heading-{{loop.index}}">
<!-- prettier-ignore -->
<button type="button" class="flex items-center bg-inherit justify-start w-full p-5 font-medium text-left" data-accordion-target="#accordion-comments-collapse-nest{{loop.index}}-body-{{loop.index}}" aria-expanded="false" aria-controls="accordion-collapse-body-1">
<!-- prettier-ignore -->
<svg data-accordion-icon class="w-6 h-6 rotate-180 shrink-0" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path> </svg>
<span><i>Comments:</i> </span>
</button>
</h2>
<!-- prettier-ignore -->
<div id="accordion-comments-collapse-nest{{loop.index}}-body-{{loop.index}}" class="hidden" aria-labelledby="accordion-collapse-heading-1">
{% for comment in section.approved_comments %}
<div class="p-5 ml-6">
<div class="dark:text-white h-30">
<div class="ql-snow mb-2">
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
<p>{{ display_inline_elements(comment.text)|safe }}</p>
</div>
</div>
</div>
<div
class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3">
<span class="text-sm">
Created by
<a
href="{{url_for('user.profile',user_id=comment.user.id)}}"
class="text-blue-500 {% if comment.user.is_deleted %}line-through{% endif %}"
>{{comment.user.username}}
</a>
on {{comment.created_at.strftime('%B %d, %Y')}}
</span>
<div>
<!-- prettier-ignore -->
<a class="hover:dark:text-white hover:text-black focus:ring-2 rounded-full font-medium text-sm p-2.5 text-center inline-flex items-center dark:hover:text-white" href="{{ build_qa_url(section.approved_interpretation) }}">
<!-- prettier-ignore -->
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> <path stroke-linecap="round" stroke-linejoin="round" d="M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 01.865-.501 48.172 48.172 0 003.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0012 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z" /> </svg>
</a>
<button
data-tooltip-target="tooltip-click"
data-tooltip-trigger="click"
id="copyLinkButton"
type="button"
class="hover:dark:text-white hover:text-black focus:ring-2 rounded-full font-medium text-sm p-2.5 text-center inline-flex items-center dark:hover:text-white"
data-link="{{ build_qa_url(section.approved_interpretation) }}">
<!-- prettier-ignore -->
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> <path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15m0-3l-3-3m0 0l-3 3m3-3V15" /> </svg>
</button>
<div id="tooltip-click" role="tooltip" class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700"> Link copied! <div class="tooltip-arrow" data-popper-arrow></div> </div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %} {% endif %} {% endfor %} {% endif %}

View File

@ -65,6 +65,7 @@
<div class="ql-snow">
{% set local_breadcrumbs = interpretation.section.breadcrumbs_path %}
{% include 'book/local_breadcrumbs_navigation.html'%}
<a href="{{url_for('book.interpretation_view', book_id=interpretation.book.id, section_id=interpretation.section.id)}}">
<p>{{ interpretation.section.label }}</p>
</a>
<div class="dark:text-white h-30 ql-editor-readonly">

View File

@ -13,26 +13,25 @@ export function initWallet() {
// protocol, hostname and port number of the URL
const origin = window.location.origin;
// connect to ethereum network and sign transactions with Metamask
const showExtensionAlert = localStorage.getItem('showExtensionAlert');
if (!window.hasOwnProperty('ethereum') && showExtensionAlert != 'false') {
let result = confirm(
"You don't have needed extension! Do you want to install it?",
);
localStorage.setItem('showExtensionAlert', 'false');
if (result) {
window.open('https://metamask.io/', '_blank');
}
return;
}
if (showExtensionAlert == 'false' && !window.hasOwnProperty('ethereum')) {
console.error('Required extension not found');
return;
}
const eOwner: IEthereumOwner = window as any;
const provider = new ethers.providers.Web3Provider(eOwner.ethereum);
const signer = provider.getSigner();
async function signInWithEthereum() {
if (!window.hasOwnProperty('ethereum')) {
let result = confirm(
"You don't have needed extension! Do you want to install it?",
);
localStorage.setItem('showExtensionAlert', 'false');
if (result) {
window.open('https://metamask.io/', '_blank');
}
return;
}
if (!window.hasOwnProperty('ethereum')) {
console.error('Required extension not found');
return;
}
const eOwner: IEthereumOwner = window as any;
const provider = new ethers.providers.Web3Provider(eOwner.ethereum);
const signer = provider.getSigner();
// create siwe message and call backend to get a nonce
const res1 = await fetch('/nonce', {
credentials: 'include',

View File

@ -57,7 +57,7 @@ def test_notifications(client: FlaskClient):
)
assert response.status_code == 200
# check that user_2 have notification about he was added, deleted as Editor/Moderator and his comment was approved
# check that user_2 have notification about he was added, deleted as Contributor and his comment was approved
assert len(user_2.active_notifications) == 3
response: Response = client.post(