From 712a3395d6adb775b214e092a69804f4b16f06b4 Mon Sep 17 00:00:00 2001 From: Horilla Date: Mon, 25 Nov 2024 14:51:22 +0530 Subject: [PATCH] [UPDT] HORILLA VIEWS: htmxLoadIndicator updates --- horilla_views/generic/cbv/views.py | 3 + .../templates/generic/horilla_card.html | 9 +- .../generic/horilla_detailed_view.html | 177 ++++++++---------- .../templates/generic/horilla_form.html | 1 + .../templates/generic/horilla_list_table.html | 4 +- horilla_views/views.py | 3 + static/build/css/style.min.css | 2 +- static/images/ui/no_records.svg | 2 +- static/index/index.js | 64 ++++++- templates/dashboard_tile_container.html | 2 +- 10 files changed, 156 insertions(+), 111 deletions(-) diff --git a/horilla_views/generic/cbv/views.py b/horilla_views/generic/cbv/views.py index 1973a776f..e0cc25114 100644 --- a/horilla_views/generic/cbv/views.py +++ b/horilla_views/generic/cbv/views.py @@ -961,6 +961,9 @@ class HorillaFormView(FormView): label=form.fields[field].label, required=form.fields[field].required, ) + form.fields[field].widget.option_template_name = ( + "horilla_widgets/select_option.html", + ) form.fields[field].widget.attrs = attrs form.initial[field] = value if pk: diff --git a/horilla_views/templates/generic/horilla_card.html b/horilla_views/templates/generic/horilla_card.html index a27006f4b..a36861150 100644 --- a/horilla_views/templates/generic/horilla_card.html +++ b/horilla_views/templates/generic/horilla_card.html @@ -2,7 +2,7 @@
@@ -66,7 +66,7 @@ {% endif %}
{{details.title|format:instance|selected_format:request.user.employee_get.employee_work_info.company_id|safe}} - {{details.subtitle|format:instance|selected_format:request.user.employee_get.employee_work_info.company_id|safe}} +
{{details.subtitle|format:instance|selected_format:request.user.employee_get.employee_work_info.company_id|safe}}
{% if actions %}
@@ -121,6 +121,7 @@ hx-get="{{search_url}}?{{request.GET.urlencode}}&filter_applied=on" hx-swap="outerHTML" hx-target="#{{view_id|safe}}" + hx-on-htmx-before-request="htmxLoadIndicator(this);" /> {% trans "of" %} {{queryset.paginator.num_pages}}{% trans "First" %} @@ -143,6 +145,7 @@ hx-get="{{search_url}}?{{request.GET.urlencode}}&page={{ queryset.previous_page_number }}&filter_applied=on" hx-swap="outerHTML" hx-target="#{{view_id|safe}}" + hx-on:click="htmxLoadIndicator(this);" class="oh-pagination__link" >{% trans "Previous" %} @@ -153,6 +156,7 @@ hx-get="{{search_url}}?{{request.GET.urlencode}}&page={{ queryset.next_page_number }}&filter_applied=on" hx-swap="outerHTML" hx-target="#{{view_id|safe}}" + hx-on:click="htmxLoadIndicator(this);" class="oh-pagination__link" >{% trans "Next" %} @@ -162,6 +166,7 @@ hx-get="{{search_url}}?{{request.GET.urlencode}}&page={{ queryset.paginator.num_pages }}&filter_applied=on" hx-swap="outerHTML" hx-target="#{{view_id|safe}}" + hx-on:click="htmxLoadIndicator(this);" class="oh-pagination__link" >{% trans "Last" %} diff --git a/horilla_views/templates/generic/horilla_detailed_view.html b/horilla_views/templates/generic/horilla_detailed_view.html index 5f92dfd69..c039118f9 100644 --- a/horilla_views/templates/generic/horilla_detailed_view.html +++ b/horilla_views/templates/generic/horilla_detailed_view.html @@ -1,109 +1,92 @@ {% load generic_template_filters %}
- - {{title}} - - + + {{title}} + +
-
- {% if instance_ids %} -
- +
+ {% if instance_ids %} +
+ - -
- {% endif %} -
-
-
- {% if header %} - -
-
- -
-
- - {{object|getattribute:header.title|selected_format:request.user.employee_get.employee_work_info.company_id}} - - - {{object|getattribute:header.subtitle|selected_format:request.user.employee_get.employee_work_info.company_id}} -
-
-
- {% endif %} - + {% endif %} +
+
+
+ {% if header %} + +
+
+ +
+
+ + {{object|getattribute:header.title|selected_format:request.user.employee_get.employee_work_info.company_id}} + + + {{object|getattribute:header.subtitle|selected_format:request.user.employee_get.employee_work_info.company_id}} + +
+
+
+ {% endif %} + +
+ +
-
-
-
-
- diff --git a/horilla_views/templates/generic/horilla_form.html b/horilla_views/templates/generic/horilla_form.html index c30552810..3399c6e25 100644 --- a/horilla_views/templates/generic/horilla_form.html +++ b/horilla_views/templates/generic/horilla_form.html @@ -43,6 +43,7 @@ values = $(this).val(); if (values == "dynamic_create") { $("#modalButton{{field_tuple.0}}").click() + $(this).val("") }else if (values.includes("dynamic_create")) { let index = values.indexOf("dynamic_create"); values.splice(index, 1); diff --git a/horilla_views/templates/generic/horilla_list_table.html b/horilla_views/templates/generic/horilla_list_table.html index 805562d36..9db721cb3 100644 --- a/horilla_views/templates/generic/horilla_list_table.html +++ b/horilla_views/templates/generic/horilla_list_table.html @@ -12,7 +12,7 @@ {% include "generic/export_fields_modal.html" %}