remove label from interpretation views

This commit is contained in:
SvyatoslavArtymovych 2023-05-18 11:48:25 +03:00
parent b4fd7b2003
commit 96808a9d16
5 changed files with 31 additions and 28 deletions

View File

@ -4,17 +4,16 @@ from wtforms.validators import DataRequired, Length
class BaseInterpretationForm(FlaskForm):
label = StringField("Label", [DataRequired(), Length(3, 256)])
about = StringField("About")
text = StringField("Text")
class CreateInterpretationForm(BaseInterpretationForm):
label = StringField("Label", [DataRequired(), Length(3, 256)])
section_id = StringField("Interpretation ID", [DataRequired()])
text = StringField("Text")
submit = SubmitField("Create")
class EditInterpretationForm(BaseInterpretationForm):
interpretation_id = StringField("Interpretation ID", [DataRequired()])
text = StringField("Text")
submit = SubmitField("Edit")

View File

@ -1660,6 +1660,10 @@ input:checked + .toggle-bg {
cursor: pointer;
}
.\!cursor-pointer {
cursor: pointer !important;
}
.select-none {
-webkit-user-select: none;
-moz-user-select: none;
@ -2211,6 +2215,11 @@ input:checked + .toggle-bg {
padding-bottom: 1rem;
}
.\!px-0 {
padding-left: 0px !important;
padding-right: 0px !important;
}
.pb-3 {
padding-bottom: 0.75rem;
}
@ -2259,6 +2268,10 @@ input:checked + .toggle-bg {
padding-top: 1.5rem;
}
.pt-4 {
padding-top: 1rem;
}
.text-left {
text-align: left;
}

View File

@ -19,15 +19,7 @@
<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="p-5">
<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="interpretation-text" class="quill-editor dark:text-white h-80">

View File

@ -105,7 +105,7 @@
{% for interpretation in section.active_interpretations %}
<!-- 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-full">
<div class="flex flex-row pb-3 p-3 pt-0 w-2/3 md:w-full">
<div class="vote-block flex flex-col m-5 mr-8 justify-center items-center">
{% if interpretation.user_id != current_user.id %}
<div class="vote-button cursor-pointer" data-vote-for="interpretation" data-entity-id="{{ interpretation.id }}" data-positive="true">
@ -156,25 +156,26 @@
</div>
<!-- prettier-ignore -->
<dt class="flex justify-center w-full mb-1 text-gray-500 md:text-lg dark:text-gray-400 flex-col">
<div class="ql-snow truncate md:max-w-xl">
<div class="flex justify-end">
<a
class="flex space-x-2"
class="!cursor-pointer text-no-underline flex items-center"
{% 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>
<span class="text-sm">View Interpretation</span>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5"> <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" /> </svg>
</a>
<div class="dark:text-white h-30 ql-editor-readonly">
<p>{{ interpretation.text|safe }}</p>
</div>
</div>
<div class="flex border-t-2 pt-3 mt-6 align-center justify-between md:w-full">
<div class="ql-snow mb-2 truncate md:max-w-xl">
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
<p>{{ interpretation.text|safe }}</p>
</div>
</div>
<div class="flex border-t-2 pt-3 align-center justify-between md:w-full">
<div>
<span class="hidden md:inline-block">Interpretation by</span>
<a href="{{url_for('user.profile',user_id=interpretation.user.id)}}" class=" text-blue-500 {% if interpretation.user.is_deleted %}line-through{% endif %}">{{interpretation.user.username}}</a> on {{interpretation.created_at.strftime('%B %d, %Y')}}

View File

@ -79,7 +79,9 @@ def my_library():
def create():
form = f.CreateBookForm()
if form.validate_on_submit():
book: m.Book = m.Book(label=form.label.data, user_id=current_user.id)
book: m.Book = m.Book(
label=form.label.data, about=form.about.data, user_id=current_user.id
)
log(log.INFO, "Form submitted. Book: [%s]", book)
book.save()
version = m.BookVersion(semver="1.0.0", book_id=book.id).save()
@ -870,10 +872,6 @@ def interpretation_edit(
)
if form.validate_on_submit():
label = form.label.data
if label:
interpretation.label = label
interpretation.text = form.text.data
log(log.INFO, "Edit interpretation [%s]", interpretation.id)