From d2c6e0a5b242309187d9d494307afe767d5a9c29 Mon Sep 17 00:00:00 2001 From: winet Date: Thu, 7 Mar 2024 16:18:21 +1000 Subject: [PATCH] tabs --- app/blueprints/frontend/static/tabs.js | 35 +++++ app/blueprints/frontend/templates/parse.j2 | 175 +++++++++++---------- 2 files changed, 123 insertions(+), 87 deletions(-) create mode 100644 app/blueprints/frontend/static/tabs.js diff --git a/app/blueprints/frontend/static/tabs.js b/app/blueprints/frontend/static/tabs.js new file mode 100644 index 0000000..dee11f5 --- /dev/null +++ b/app/blueprints/frontend/static/tabs.js @@ -0,0 +1,35 @@ +const tabs_lists = document.querySelectorAll('.nav-tabs[role="tablist"]'); +let tabs = []; + +tabs_lists.forEach((tabs_list) => { + tabs = [...tabs, ...tabs_list.querySelectorAll('[role="tab"]')]; +}) + +tabs.forEach((tab) => { + tab.addEventListener('hide.bs.tab', event => { + const id_content_hide = event.target.getAttribute('data-bs-target'); + const id_content_show = event.relatedTarget.getAttribute('data-bs-target'); + + console.log('==== Hide ===='); + const content_hide = document.querySelector(id_content_hide); + content_hide.querySelectorAll('input, textarea, button').forEach((el) => { + console.log(el); + el.disabled = true; + }); + + console.log('==== Show ===='); + const content_show = document.querySelector(id_content_show); + content_show.querySelectorAll('input, textarea, button').forEach((el) => { + console.log(el); + el.disabled = false; + }); + }); + + if (!tab.getAttribute('aria-selected')) { + const id_content_hide = tab.getAttribute('data-bs-target') + const content_hide = document.querySelector(`#${id_content_hide}`); + content_hide.querySelectorAll('input, textarea, button').forEach((el) => { + el.disabled = true; + }); + } +}) \ No newline at end of file diff --git a/app/blueprints/frontend/templates/parse.j2 b/app/blueprints/frontend/templates/parse.j2 index bbdc5d5..2a633dd 100644 --- a/app/blueprints/frontend/templates/parse.j2 +++ b/app/blueprints/frontend/templates/parse.j2 @@ -1,101 +1,102 @@ {% extends "base.j2" %} {% block title %} -PaperParser: Парсинг +Парсинг {% endblock title %} {% block main %} -
- -
-
-

Действия

-
-
-
- -
-
-
+ +
+ +
+
+

Действия

+
+
+ + -
-
-
- - +
+ +
+
+ + +
+
+ + +
+
+
+ +
+
+ + +
- - -
+
-
-
- -
-
-
- -
-
-
-
- - -
-
- -
-
-
-
-
- - - -
-
-
-
-

Пользователи

-
-
- Loading... -
-
-
-
- - -
- +
+
+

Настройки

+
-
-
-
- {{ users_template }} -
-
- -{% endblock main %} \ No newline at end of file + +
+ + +
+ +
+
+
+ + +
+ +
+ + +
+ + + + +{% endblock main %} + +{% block scripts %} + +{% endblock scripts %} \ No newline at end of file