mirror of
https://github.com/logos-co/open-law.git
synced 2025-02-20 18:48:07 +00:00
logic to work with
multiple-input-block
This commit is contained in:
parent
0946a73129
commit
0666a29de6
File diff suppressed because one or more lines are too long
@ -18,7 +18,7 @@
|
|||||||
<label for="label" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white" >Label</label >
|
<label for="label" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white" >Label</label >
|
||||||
<input 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="Name" required />
|
<input 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="Name" required />
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-6">
|
<div class="multiple-input-block mb-6">
|
||||||
<label for="tags-input" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
<label for="tags-input" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||||
Tags
|
Tags
|
||||||
</label>
|
</label>
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="multiple-input-block">
|
||||||
<label for="tags-input" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
<label for="tags-input" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||||
Tags
|
Tags
|
||||||
</label>
|
</label>
|
||||||
|
@ -90,7 +90,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-6 pt-0 space-y-6">
|
<div class="multiple-input-block 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="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 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-64"></div>
|
<div id="interpretation-text" class="quill-editor dark:text-white h-64"></div>
|
||||||
|
@ -29,14 +29,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="p-1">
|
<div class="p-1">
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
<form {% if sub_collection %}
|
<form
|
||||||
|
{% if sub_collection %}
|
||||||
action="{{ url_for('book.create_comment', book_id=book.id, collection_id=collection.id, sub_collection_id=sub_collection.id,section_id=section.id,interpretation_id=interpretation.id) }}"
|
action="{{ url_for('book.create_comment', book_id=book.id, collection_id=collection.id, sub_collection_id=sub_collection.id,section_id=section.id,interpretation_id=interpretation.id) }}"
|
||||||
{% else %}
|
{% else %}
|
||||||
action="{{ url_for('book.create_comment', book_id=book.id, collection_id=collection.id,section_id=section.id,interpretation_id=interpretation.id) }}"
|
action="{{ url_for('book.create_comment', book_id=book.id, collection_id=collection.id,section_id=section.id,interpretation_id=interpretation.id) }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
method="post" class="prevent-submit-on-enter flex flex-col 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">
|
method="post"
|
||||||
|
class="prevent-submit-on-enter flex flex-col 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"
|
||||||
|
>
|
||||||
{{ form_hidden_tag() }}
|
{{ form_hidden_tag() }}
|
||||||
<div class="relative z-0 w-full mb-6 group">
|
<div class="relative z-0 w-full group">
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
<label for="tags-input" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
<label for="tags-input" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||||
Comment
|
Comment
|
||||||
@ -52,7 +55,7 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-6">
|
<div class="multiple-input-block mb-6">
|
||||||
<label for="tags-input" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
<label for="tags-input" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||||
Tags
|
Tags
|
||||||
</label>
|
</label>
|
||||||
@ -199,12 +202,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="accordion-collapse-body-{{loop.index}}" class="hidden" aria-labelledby="accordion-collapse-heading-1">
|
<div id="accordion-collapse-body-{{loop.index}}" class="hidden" aria-labelledby="accordion-collapse-heading-1">
|
||||||
<div class="p-5 border-t border-gray-200 dark:border-gray-700 dark:bg-gray-900">
|
<div class="p-5 border-t border-gray-200 dark:border-gray-700 dark:bg-gray-900">
|
||||||
<form {% if sub_collection %}
|
<form
|
||||||
|
{% if sub_collection %}
|
||||||
action="{{ url_for('book.create_comment', book_id=book.id, collection_id=collection.id, sub_collection_id=sub_collection.id,section_id=section.id,interpretation_id=interpretation.id) }}"
|
action="{{ url_for('book.create_comment', book_id=book.id, collection_id=collection.id, sub_collection_id=sub_collection.id,section_id=section.id,interpretation_id=interpretation.id) }}"
|
||||||
{% else %}
|
{% else %}
|
||||||
action="{{ url_for('book.create_comment', book_id=book.id, collection_id=collection.id,section_id=section.id,interpretation_id=interpretation.id) }}"
|
action="{{ url_for('book.create_comment', book_id=book.id, collection_id=collection.id,section_id=section.id,interpretation_id=interpretation.id) }}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
method="post" class="flex flex-col bg-white dark:bg-gray-900 max-w-full p-3 text-gray-900 dark:text-white dark:divide-gray-700 m-3 border-2 border-gray-200 border-solid rounded-lg dark:border-gray-700">
|
method="post"
|
||||||
|
class="prevent-submit-on-enter flex flex-col bg-white dark:bg-gray-900 max-w-full p-3 text-gray-900 dark:text-white dark:divide-gray-700 m-3 border-2 border-gray-200 border-solid rounded-lg dark:border-gray-700"
|
||||||
|
>
|
||||||
{{ form_hidden_tag() }}
|
{{ form_hidden_tag() }}
|
||||||
<input type="hidden" name="parent_id" id="parent_id" value="{{comment.id}}" />
|
<input type="hidden" name="parent_id" id="parent_id" value="{{comment.id}}" />
|
||||||
<div class="relative z-0 w-full mb-6 group">
|
<div class="relative z-0 w-full mb-6 group">
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
{{book.about if not book.about==None}}
|
{{book.about if not book.about==None}}
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-6">
|
<div class="multiple-input-block mb-6">
|
||||||
<label for="tags-input" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
<label for="tags-input" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||||
Tags
|
Tags
|
||||||
</label>
|
</label>
|
||||||
|
@ -18,18 +18,23 @@ const handleClickOnTag = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
const multipleInputJs = () => {
|
const multipleInputJs = () => {
|
||||||
const form = document.querySelector('.prevent-submit-on-enter');
|
const forms = document.querySelectorAll('.prevent-submit-on-enter');
|
||||||
if (!form) {
|
if (!forms.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
forms.forEach(form => {
|
||||||
form.addEventListener('keypress', (e: any) => {
|
form.addEventListener('keypress', (e: any) => {
|
||||||
if (e.keyCode === 13) {
|
if (e.keyCode === 13) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const multipleInputBlock = document.querySelectorAll('.multiple-input-block');
|
||||||
|
|
||||||
|
multipleInputBlock.forEach((multipleInputBlock: any) => {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
const multipleInput: any = document.querySelector('.multiple-input');
|
const multipleInput: any = multipleInputBlock.querySelector('.multiple-input');
|
||||||
const tagsToSubmitInputClassName = multipleInput.getAttribute(
|
const tagsToSubmitInputClassName = multipleInput.getAttribute(
|
||||||
'data-save-results-to',
|
'data-save-results-to',
|
||||||
);
|
);
|
||||||
@ -40,11 +45,10 @@ const multipleInputJs = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tagsToSubmitInput: HTMLInputElement = document.querySelector(
|
const tagsToSubmitInput: HTMLInputElement =
|
||||||
'.' + tagsToSubmitInputClassName,
|
multipleInputBlock.querySelector('.' + tagsToSubmitInputClassName);
|
||||||
);
|
|
||||||
|
|
||||||
const wordsBlock: HTMLDivElement = document.querySelector(
|
const wordsBlock: HTMLDivElement = multipleInputBlock.querySelector(
|
||||||
'.multiple-input-items',
|
'.multiple-input-items',
|
||||||
);
|
);
|
||||||
const wordDivs = wordsBlock.querySelectorAll('.multiple-input-word');
|
const wordDivs = wordsBlock.querySelectorAll('.multiple-input-word');
|
||||||
@ -126,6 +130,7 @@ const multipleInputJs = () => {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export function initMultipleInput() {
|
export function initMultipleInput() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user