From bedc1f0d320ea3012a457c2c1dea2c3b89dd2c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=9D=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Thu, 20 Nov 2025 09:28:28 +0300 Subject: [PATCH] Integrate page_header component across all list pages - Fix bug in page_header.html: add # to data-bs-target for card create button - Integrate page_header in department_list.html with search and create card - Integrate page_header in feed_list.html (no search, staff-only create button) - Integrate page_header in document_list.html with Mine/All scope toggle - Integrate page_header in request_list_full.html with filters and scope toggle - Integrate page_header in chat_list.html with search - Create _filters.html template for requests_app - Add page-header.css to all integrated templates for consistent styling --- .../templates/communications/chat_list.html | 25 ++----- .../templates/documents/document_list.html | 35 +--------- .../templates/employees/department_list.html | 29 ++------ backend/templates/feed/feed_list.html | 14 ++-- .../includes/components/page_header.html | 2 +- backend/templates/requests_app/_filters.html | 34 +++++++++ .../requests_app/request_list_full.html | 69 ++----------------- 7 files changed, 54 insertions(+), 154 deletions(-) create mode 100644 backend/templates/requests_app/_filters.html diff --git a/backend/templates/communications/chat_list.html b/backend/templates/communications/chat_list.html index 8ee6f5fb..999e919f 100644 --- a/backend/templates/communications/chat_list.html +++ b/backend/templates/communications/chat_list.html @@ -7,6 +7,7 @@ {% block extra_css %} + {% endblock %} {% block content %} @@ -14,28 +15,10 @@
- {# Заголовок + ПОИСК (iOS-стиль) #} -
- -

Мои чаты

+ {# ===== НОВАЯ ШАПКА С КОМПОНЕНТОМ ===== #} + {% include "includes/components/page_header.html" with icon="bi-chat-dots" title="Мои чаты" search_id="chatSearch" search_placeholder="Поиск по названию или участникам" no_create=True %} - -
- - {# Сегментированный фильтр + КНОПКА справа #} + {# Сегментированный фильтр #}
diff --git a/backend/templates/documents/document_list.html b/backend/templates/documents/document_list.html index af36b5a3..87326ffc 100644 --- a/backend/templates/documents/document_list.html +++ b/backend/templates/documents/document_list.html @@ -7,44 +7,15 @@ + {% endblock %} {% block content %}
- {# ===== Шапка страницы ===== #} -
- -

Документы

- - {% if can_manage_documents or user.is_staff or user.is_superuser %} -
- - - - {% if perms.documents.add_document %} - - {% endif %} -
- {% else %} - Показаны ваши документы - {% endif %} -
+ {# ===== НОВАЯ ШАПКА С КОМПОНЕНТОМ ===== #} + {% include "includes/components/page_header.html" with icon="bi-file-earmark-text" title="Документы" no_search=True scope_urls=scope_urls scope=scope create_modal=perms.documents.add_document|yesno:"#docCreateModal," create_text="Создать документ" create_icon="bi-plus-lg" %} {# ===== Карточка со списком ===== #}
diff --git a/backend/templates/employees/department_list.html b/backend/templates/employees/department_list.html index f2738363..51bfc422 100644 --- a/backend/templates/employees/department_list.html +++ b/backend/templates/employees/department_list.html @@ -7,6 +7,7 @@ + {% endblock %} @@ -15,31 +16,9 @@
-
- -

Отделы

- Всего: {{ departments|length }} - -
- {% if can_create_departments or perms.employees.add_department or request.user.is_staff or request.user.is_superuser %} - - {% endif %} + {# ===== НОВАЯ ШАПКА С КОМПОНЕНТОМ ===== #} + {% include "includes/components/page_header.html" with icon="bi-diagram-3" title="Отделы" count=departments|length count_label="Всего:" search_id="deptFilter" search_placeholder="Поиск по названию или руководителю" create_as_card=True create_url=can_create_departments|yesno:"{% url 'employees:department_create' %}," create_text="Создать отдел" %} +
{# поддержка обоих форматов: dict(results) или list #} diff --git a/backend/templates/feed/feed_list.html b/backend/templates/feed/feed_list.html index c82c861a..ca515abf 100644 --- a/backend/templates/feed/feed_list.html +++ b/backend/templates/feed/feed_list.html @@ -5,6 +5,8 @@ {% block extra_css %} + + {% endblock %} {% block content %} @@ -12,16 +14,8 @@
-
- -

Лента

- - {% if user.is_authenticated and user.is_staff %} - - Новая публикация - - {% endif %} -
+ {# ===== НОВАЯ ШАПКА С КОМПОНЕНТОМ ===== #} + {% include "includes/components/page_header.html" with icon="bi-megaphone" title="Лента" no_search=True create_url=user.is_authenticated|yesno:"{% if user.is_staff %}{% url 'feed:post_create' %}?type=company{% endif %}," create_text="Новая публикация" create_icon="bi-plus-circle" %} {% if new_employees %}
diff --git a/backend/templates/includes/components/page_header.html b/backend/templates/includes/components/page_header.html index 058c6ecf..c965953e 100644 --- a/backend/templates/includes/components/page_header.html +++ b/backend/templates/includes/components/page_header.html @@ -109,7 +109,7 @@ + + + +
+ diff --git a/backend/templates/requests_app/request_list_full.html b/backend/templates/requests_app/request_list_full.html index 020da488..f56a5c83 100644 --- a/backend/templates/requests_app/request_list_full.html +++ b/backend/templates/requests_app/request_list_full.html @@ -6,76 +6,15 @@ {% block extra_css %} + + {% endblock %} {% block content %}
- {# ===== Шапка страницы ===== #} -
- -

Заявления

- -
- {% if can_process or user.is_staff or user.is_superuser %} - - - {% endif %} - - -
-
- - {# ===== Фильтры ===== #} -
-
-
- - -
-
- - -
-
- - - - - -
-
-
+ {# ===== НОВАЯ ШАПКА С КОМПОНЕНТОМ ===== #} + {% include "includes/components/page_header.html" with icon="bi-clipboard-check" title="Заявления" no_search=True scope_urls=can_process|yesno:"{ 'mine': '?view=mine'|add:filters.type|yesno:'&type='|add:filters.type|add:filters.status|yesno:'&status='|add:filters.status, 'all': '?view=all'|add:filters.type|yesno:'&type='|add:filters.type|add:filters.status|yesno:'&status='|add:filters.status }," scope=scope has_filters=True filters_target="reqFilters" filters_template="requests_app/_filters.html" create_modal="#reqCreateModal" create_text="Новое заявление" create_icon="bi-plus-lg" %} {# ===== Список ===== #}