mirror of
https://github.com/logos-co/open-law.git
synced 2025-02-05 03:24:15 +00:00
edit and delete interpretation UI
This commit is contained in:
parent
ff8c5f3ba3
commit
76c1273d81
File diff suppressed because one or more lines are too long
@ -6,7 +6,7 @@
|
||||
{% if not loop.index==breadcrumbs|length %}
|
||||
<a href="{{ breadcrumb.url }}" class="inline-flex items-center text-sm truncate w-24 font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
{% else %}
|
||||
<span class="inline-flex items-center text-sm truncate w-24 font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<span class="inline-flex items-center text-sm truncate w-40 font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
{% endif %}
|
||||
<!-- prettier-ignore -->
|
||||
<!--svg for all types of breadcrumb-->
|
||||
@ -14,7 +14,7 @@
|
||||
<svg aria-hidden="true" class="flex-shrink-0 w-4 h-4 mr-2 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"></path></svg>
|
||||
{% else %}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="flex-shrink-0 w-4 h-4 mr-2 text-gray-500 transition duration-75 dark:text-gray-400 group-hover:text-gray-900 dark:group-hover:text-white"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25" /> </svg>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<!-- prettier-ignore -->
|
||||
<span class="truncate">{{ breadcrumb.label }}</span>
|
||||
{% if not loop.index==breadcrumbs|length %}
|
||||
|
26
app/templates/book/delete_interpretation_modal.html
Normal file
26
app/templates/book/delete_interpretation_modal.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!-- prettier-ignore-->
|
||||
<div id="delete_interpretation_modal" tabindex="-1" aria-hidden="true" class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
||||
<div class="relative w-full max-w-2xl max-h-full">
|
||||
<!-- Modal content -->
|
||||
<form
|
||||
{% if sub_collection %}
|
||||
action="{{ url_for('book.interpretation_delete', book_id=book.id, collection_id=collection.id, sub_collection_id=sub_collection.id, section_id=section.id, interpretation_id=interpretation.id) }}"
|
||||
{% else %}
|
||||
action="{{ url_for('book.interpretation_delete', book_id=book.id, collection_id=collection.id, section_id=section.id, interpretation_id=interpretation.id) }}"
|
||||
{% endif %}
|
||||
method="post" class="relative bg-white rounded-lg shadow dark:bg-gray-700">
|
||||
{{ form_hidden_tag() }}
|
||||
<!-- Modal header -->
|
||||
<div class="flex items-start justify-between p-4 border-b rounded-t dark:border-gray-600">
|
||||
<h3 class="text-xl font-semibold text-gray-900 dark:text-white"> Delete Interpretation </h3>
|
||||
<button id="modalAddCloseButton" data-modal-hide="delete_interpretation_modal" type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"> <svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path> </svg> </button>
|
||||
</div>
|
||||
<!-- Modal body -->
|
||||
|
||||
<!-- Modal footer -->
|
||||
<div class="flex items-center p-6 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600">
|
||||
<button name="submit" type="submit" class="text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800">Confirm Deletion</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
45
app/templates/book/edit_interpretation_modal.html
Normal file
45
app/templates/book/edit_interpretation_modal.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!-- prettier-ignore-->
|
||||
<div id="edit_interpretation_modal" tabindex="-1" aria-hidden="true" class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
||||
<div class="relative w-full max-w-2xl max-h-full">
|
||||
<!-- Modal content -->
|
||||
<form
|
||||
{% if sub_collection %}
|
||||
action="{{ url_for('book.interpretation_edit', book_id=book.id, collection_id=collection.id, sub_collection_id=sub_collection.id, section_id=section.id, interpretation_id=interpretation.id) }}"
|
||||
{% else %}
|
||||
action="{{ url_for('book.interpretation_edit', book_id=book.id, collection_id=collection.id, section_id=section.id, interpretation_id=interpretation.id) }}"
|
||||
{% endif %}
|
||||
method="post" class="relative bg-white rounded-lg shadow dark:bg-gray-700">
|
||||
{{ form_hidden_tag() }}
|
||||
<input type="hidden" name="interpretation_id" id="interpretation_id" value="{{interpretation.id}}" />
|
||||
<input type="hidden" name="text" id="about" value={{interpretation.text}} />
|
||||
|
||||
<!-- Modal header -->
|
||||
<div class="flex items-start justify-between p-4 border-b rounded-t dark:border-gray-600">
|
||||
<h3 class="text-xl font-semibold text-gray-900 dark:text-white"> Edit Interpretation </h3>
|
||||
<button id="modalAddCloseButton" data-modal-hide="edit_interpretation_modal" type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"> <svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path> </svg> </button>
|
||||
</div>
|
||||
<!-- Modal body -->
|
||||
<div class="p-6 space-y-6">
|
||||
<div class="grid gap-6">
|
||||
<div class="col-span-6 sm:col-span-3">
|
||||
<label for="label" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white" >Label</label >
|
||||
<input value="{{interpretation.label}}" type="text" name="label" id="label" class="shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-600 focus:border-blue-600 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="Collection label" required />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-6 pt-0 space-y-6">
|
||||
<div class="w-full max-w-6xl mx-auto rounded-xl bg-gray-50 dark:bg-gray-600 shadow-lg text-white-900">
|
||||
<div class="overflow-hidden rounded-md bg-gray-50 [&>*]:dark:bg-gray-600 text-black [&>*]:!border-none [&>*]:!stroke-black dark:text-white dark:[&>*]:!stroke-white">
|
||||
<div id="editor" class="dark:text-white h-80">
|
||||
{{ interpretation.text|safe }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Modal footer -->
|
||||
<div class="flex items-center p-6 space-x-2 border-t border-gray-200 rounded-b dark:border-gray-600">
|
||||
<button name="submit" type="submit" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
@ -5,8 +5,7 @@
|
||||
{% include 'book/edit_section_modal.html' %}
|
||||
|
||||
<!-- show delete section btn on rightside bar -->
|
||||
{% set show_delete_section = True %}
|
||||
{% set show_edit_section = True %}
|
||||
{% set show_delete_section = True %} {% set show_edit_section = True %}
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
{% block right_sidebar %}
|
||||
@ -16,7 +15,9 @@
|
||||
{% block content %}
|
||||
<div class="relative overflow-x-auto shadow-md sm:rounded-lg mt-5 md:mr-64">
|
||||
{% include 'book/breadcrumbs_navigation.html'%}
|
||||
<h1 class="text-l font-extrabold dark:text-white ml-4"> Interpretations page </h1>
|
||||
<h1 class="text-l font-extrabold dark:text-white ml-4">
|
||||
Interpretations page
|
||||
</h1>
|
||||
<!-- prettier-ignore -->
|
||||
<div class="mb-1 border-b border-gray-200 dark:border-gray-700">
|
||||
<ul class="flex flex-wrap -mb-px text-sm font-medium text-center" id="myTab" data-tabs-toggle="#myTabContent" role="tablist">
|
||||
@ -36,8 +37,13 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div id="myTabContent">
|
||||
<div class="hidden p-4 rounded-lg bg-gray-50 dark:bg-gray-800" id="section-text" role="tabpanel" aria-labelledby="text-tab">
|
||||
<dl class="bg-white dark:bg-gray-900 max-w-full p-3 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">
|
||||
<div
|
||||
class="hidden p-4 rounded-lg bg-gray-50 dark:bg-gray-800"
|
||||
id="section-text"
|
||||
role="tabpanel"
|
||||
aria-labelledby="text-tab">
|
||||
<dl
|
||||
class="bg-white dark:bg-gray-900 max-w-full p-3 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">
|
||||
<div class="flex flex-col w-full">
|
||||
<!-- prettier-ignore -->
|
||||
<dt class="flex w-full mb-1 text-gray-500 md:text-lg dark:text-gray-400 flex-col">
|
||||
@ -51,9 +57,13 @@
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="hidden p-4 rounded-lg bg-gray-50 dark:bg-gray-800" id="interpretation" role="tabpanel" aria-labelledby="interpretation-tab">
|
||||
<div
|
||||
class="hidden p-4 rounded-lg bg-gray-50 dark:bg-gray-800"
|
||||
id="interpretation"
|
||||
role="tabpanel"
|
||||
aria-labelledby="interpretation-tab">
|
||||
<!-- prettier-ignore -->
|
||||
<form
|
||||
<form
|
||||
{% if sub_collection %}
|
||||
action="{{ url_for('book.interpretation_create', book_id=book.id, collection_id=collection.id, sub_collection_id=sub_collection.id,section_id=section.id) }}"
|
||||
{% else %}
|
||||
@ -63,7 +73,7 @@
|
||||
{{ form_hidden_tag() }}
|
||||
<input type="hidden" name="section_id" id="section_id" value="{{section.id}}" />
|
||||
<input type="hidden" name="label" id="label" value="{{section.label}}" />
|
||||
|
||||
|
||||
<input type="hidden" name="text" id="interpretation-text" />
|
||||
<!-- Form body -->
|
||||
<div class="p-6 space-y-6">
|
||||
@ -85,37 +95,57 @@
|
||||
<button name="submit" type="submit" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800 ml-auto">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
<dl class="w-md md:w-full text-gray-900 divide-y divide-gray-200 dark:text-white dark:divide-gray-700">
|
||||
<!-- prettier-ignore -->
|
||||
<dl class="w-md md:w-full text-gray-900 divide-y divide-gray-200 dark:text-white dark:divide-gray-700">
|
||||
<!-- prettier-ignore -->
|
||||
{% for interpretation in section.active_interpretations %}
|
||||
<dl class="bg-white dark:bg-gray-900 max-w-full p-3 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">
|
||||
<div class="flex flex-row pb-3 p-3 w-2/3 md:w-10/12">
|
||||
<div class="flex flex-col m-5 justify-center items-center"><a href="#"><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="M4.5 10.5L12 3m0 0l7.5 7.5M12 3v18" /> </svg></a>
|
||||
<span class="text-3xl">35</span>
|
||||
<a href="#"><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="M19.5 13.5L12 21m0 0l-7.5-7.5M12 21V3" /> </svg></a>
|
||||
<!-- prettier-ignore -->
|
||||
<dl class="bg-white dark:bg-gray-900 max-w-full p-3 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">
|
||||
<div class="flex flex-row pb-3 p-3 w-2/3 md:w-10/12">
|
||||
<div class="flex flex-col m-5 justify-center items-center">
|
||||
<div>
|
||||
<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="M4.5 10.5L12 3m0 0l7.5 7.5M12 3v18" /> </svg>
|
||||
</div>
|
||||
<span class="text-3xl">35</span>
|
||||
<div>
|
||||
<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="M19.5 13.5L12 21m0 0l-7.5-7.5M12 21V3" /> </svg>
|
||||
</div>
|
||||
</div>
|
||||
<!-- prettier-ignore -->
|
||||
<dt class="flex w-full mb-1 text-gray-500 md:text-lg dark:text-gray-400 flex-col">
|
||||
<div class="ql-snow truncate">
|
||||
<h1>{{ section.label }}</h1>
|
||||
<div class="dark:text-white h-80 ql-editor">
|
||||
<p>{{ interpretation.text|safe }}</p>
|
||||
</div>
|
||||
<!-- prettier-ignore -->
|
||||
<dt class="flex w-full mb-1 text-gray-500 md:text-lg dark:text-gray-400 flex-col">
|
||||
<div class="ql-snow truncate">
|
||||
<a
|
||||
class="flex space-x-2"
|
||||
{% if sub_collection %}
|
||||
href="{{ url_for('book.qa_view', book_id=book.id, collection_id=collection.id, sub_collection_id=sub_collection.id, section_id=section.id, interpretation_id=interpretation.id) }}"
|
||||
{% else %}
|
||||
href="{{ url_for('book.qa_view', book_id=book.id, collection_id=collection.id, section_id=section.id, interpretation_id=interpretation.id) }}"
|
||||
{% endif %}
|
||||
>
|
||||
<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="M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244" />
|
||||
</svg>
|
||||
<span>{{ section.label }}</span>
|
||||
</a>
|
||||
<div class="dark:text-white h-80 ql-editor">
|
||||
<p>{{ interpretation.text|safe }}</p>
|
||||
</div>
|
||||
<div class="flex mt-auto align-center justify-between space-x-3">
|
||||
<div>Interpretation by {{interpretation.user.username}} on {{interpretation.created_at.strftime('%B %d, %Y')}}</div>
|
||||
<div class="flex ml-auto justify-between w-24"><span class="space-x-0.5 flex items-center">
|
||||
</div>
|
||||
<div class="flex mt-auto align-center justify-between space-x-3">
|
||||
<div>Interpretation by {{interpretation.user.username}} on {{interpretation.created_at.strftime('%B %d, %Y')}}</div>
|
||||
<div class="flex ml-auto justify-between w-24">
|
||||
<span class="space-x-0.5 flex items-center">
|
||||
<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>
|
||||
</span>
|
||||
<a href='#' class="space-x-0.5 flex items-center">
|
||||
<div class="space-x-0.5 flex items-center">
|
||||
<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="M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 01-.825-.242m9.345-8.334a2.126 2.126 0 00-.476-.095 48.64 48.64 0 00-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0011.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155" /> </svg>
|
||||
<p>55</p>
|
||||
</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</dt>
|
||||
</div>
|
||||
</dl>
|
||||
</a>
|
||||
</div>
|
||||
</dt>
|
||||
</div>
|
||||
</dl>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
</div>
|
||||
|
25
app/templates/book/qa_view.html
Normal file
25
app/templates/book/qa_view.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!-- prettier-ignore -->
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% include 'book/delete_interpretation_modal.html' %}
|
||||
{% include 'book/edit_interpretation_modal.html' %}
|
||||
|
||||
<!-- show delete section btn on rightside bar -->
|
||||
{% set show_edit_interpretation = True %}
|
||||
<!-- prettier-ignore -->
|
||||
{% set show_delete_interpretation = True %}
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
{% block right_sidebar %}
|
||||
{% include 'book/right_sidebar.html' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="relative overflow-x-auto shadow-md sm:rounded-lg mt-5 md:mr-64">
|
||||
{% include 'book/breadcrumbs_navigation.html'%}
|
||||
<h1 class="text-l font-extrabold dark:text-white ml-4">
|
||||
{{ interpretation.label }}
|
||||
</h1>
|
||||
</div>
|
||||
<!-- prettier-ignore -->
|
||||
{% endblock %}
|
@ -52,6 +52,16 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if show_edit_interpretation %}
|
||||
<li>
|
||||
<!-- prettier-ignore -->
|
||||
<button type="button" data-modal-target="edit_interpretation_modal" data-modal-toggle="edit_interpretation_modal" class="space-x-3 text-white ml-2 w-11/12 bg-teal-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-teal-300 font-medium rounded-lg text-sm px-4 py-2.5 text-center inline-flex items-center dark:bg-teal-600 dark:hover:bg-teal-700 dark:focus:ring-teal-800">
|
||||
<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="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" /> </svg>
|
||||
<p>Edit Interpretation</p>
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if show_delete_collection %}
|
||||
<li>
|
||||
<!-- prettier-ignore -->
|
||||
@ -71,6 +81,16 @@
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if show_delete_interpretation %}
|
||||
<li>
|
||||
<!-- prettier-ignore -->
|
||||
<button type="button" data-modal-target="delete_interpretation_modal" data-modal-toggle="delete_interpretation_modal" class="space-x-3 text-white ml-2 w-11/12 bg-red-700 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm px-4 py-2.5 text-center inline-flex items-center dark:bg-red-600 dark:hover:bg-red-700 dark:focus:ring-red-800">
|
||||
<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="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /> </svg>
|
||||
<p>Delete Interpretation</p>
|
||||
</button>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</aside>
|
||||
|
@ -1005,11 +1005,12 @@ def interpretation_edit(
|
||||
)
|
||||
|
||||
redirect_url = url_for(
|
||||
"book.interpretation_view",
|
||||
"book.qa_view",
|
||||
book_id=book_id,
|
||||
collection_id=collection_id,
|
||||
sub_collection_id=sub_collection_id,
|
||||
section_id=section_id,
|
||||
interpretation_id=interpretation_id,
|
||||
)
|
||||
section: m.Section = db.session.get(m.Section, section_id)
|
||||
if not section or section.is_deleted:
|
||||
@ -1124,3 +1125,88 @@ def interpretation_delete(
|
||||
book_id=book_id,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@bp.route(
|
||||
"/<int:book_id>/<int:collection_id>/<int:section_id>/<int:interpretation_id>/preview",
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@bp.route(
|
||||
(
|
||||
"/<int:book_id>/<int:collection_id>/<int:sub_collection_id>/"
|
||||
"<int:section_id>/<int:interpretation_id>/preview"
|
||||
),
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
@login_required
|
||||
def qa_view(
|
||||
book_id: int,
|
||||
collection_id: int,
|
||||
section_id: int,
|
||||
interpretation_id: int,
|
||||
sub_collection_id: int | None = None,
|
||||
):
|
||||
book: m.Book = db.session.get(m.Book, book_id)
|
||||
if not book or book.owner != current_user or book.is_deleted:
|
||||
log(log.INFO, "User: [%s] is not owner of book: [%s]", current_user, book)
|
||||
flash("You are not owner of this book!", "danger")
|
||||
return redirect(url_for("book.my_books"))
|
||||
|
||||
collection: m.Collection = db.session.get(m.Collection, collection_id)
|
||||
if not collection or collection.is_deleted:
|
||||
log(log.WARNING, "Collection with id [%s] not found", collection_id)
|
||||
flash("Collection not found", "danger")
|
||||
return redirect(url_for("book.collection_view", book_id=book_id))
|
||||
|
||||
if sub_collection_id:
|
||||
sub_collection: m.Collection = db.session.get(m.Collection, sub_collection_id)
|
||||
if not sub_collection or sub_collection.is_deleted:
|
||||
log(log.WARNING, "Sub_collection with id [%s] not found", sub_collection_id)
|
||||
flash("SubCollection not found", "danger")
|
||||
return redirect(
|
||||
url_for(
|
||||
"book.sub_collection_view",
|
||||
book_id=book_id,
|
||||
collection_id=collection_id,
|
||||
)
|
||||
)
|
||||
|
||||
redirect_url = url_for(
|
||||
"book.interpretation_view",
|
||||
book_id=book_id,
|
||||
collection_id=collection_id,
|
||||
sub_collection_id=sub_collection_id,
|
||||
section_id=section_id,
|
||||
)
|
||||
section: m.Section = db.session.get(m.Section, section_id)
|
||||
if not section or section.is_deleted:
|
||||
log(log.WARNING, "Section with id [%s] not found", section_id)
|
||||
flash("Section not found", "danger")
|
||||
return redirect(redirect_url)
|
||||
|
||||
interpretation: m.Interpretation = db.session.get(
|
||||
m.Interpretation, interpretation_id
|
||||
)
|
||||
if not interpretation or interpretation.is_deleted:
|
||||
log(log.WARNING, "Interpretation with id [%s] not found", interpretation_id)
|
||||
flash("Interpretation not found", "danger")
|
||||
return redirect(redirect_url)
|
||||
|
||||
breadcrumbs = create_breadcrumbs(
|
||||
book_id=book_id,
|
||||
collection_path=(
|
||||
collection_id,
|
||||
sub_collection_id,
|
||||
),
|
||||
section_id=section_id,
|
||||
interpretation_id=interpretation.id,
|
||||
)
|
||||
return render_template(
|
||||
"book/qa_view.html",
|
||||
book=book,
|
||||
collection=collection,
|
||||
sub_collection=sub_collection if sub_collection_id else None,
|
||||
section=section,
|
||||
interpretation=interpretation,
|
||||
breadcrumbs=breadcrumbs,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user