[FIX] HORILLA VIEWS: Initial filter not working issue

This commit is contained in:
Horilla
2024-10-29 10:14:02 +05:30
parent 0b9dce6125
commit ec2cf6b014

View File

@@ -15,7 +15,14 @@
</a> </a>
</div> </div>
{% if search_url %} {% if search_url %}
<form autocomplete="off" id="filterForm" onsubmit="event.preventDefault()" hx-get="{{search_url}}?&referrer={{request.META.HTTP_REFERER}}&{{request.GET.urlencode}}" hx-replace-url="true" hx-target="{{search_swap_target}}" class="oh-main__titlebar oh-main__titlebar--right"> <form autocomplete="off"
id="filterForm"
onsubmit="event.preventDefault()"
hx-get="{{search_url}}?&referrer={{request.META.HTTP_REFERER}}&{{request.GET.urlencode}}"
hx-replace-url="false"
hx-target="{{search_swap_target}}"
class="oh-main__titlebar oh-main__titlebar--right"
>
<div class="oh-input-group oh-input__search-group" id="searchGroup"> <div class="oh-input-group oh-input__search-group" id="searchGroup">
<ion-icon <ion-icon
name="search-outline" name="search-outline"
@@ -82,10 +89,8 @@
{% if active_view.type == type.type %} {% if active_view.type == type.type %}
<script> <script>
$("form#filterForm.oh-main__titlebar oh-main__titlebar--right").attr('hx-get','{{type.url}}?&referrer={{request.META.HTTP_REFERER}}&{{request.GET.urlencode}}'); $("form#filterForm.oh-main__titlebar oh-main__titlebar--right").attr('hx-get','{{type.url}}?&referrer={{request.META.HTTP_REFERER}}&{{request.GET.urlencode}}');
setTimeout(() => { $(".oh-view-types .oh-view-type[data-type={{type.type}}] a").addClass("oh-btn--view-active")
$(".oh-view-types .oh-view-type[data-type={{type.type}}]").click()
$(".oh-view-types .oh-view-type[data-type={{type.type}}] a").addClass("oh-btn--view-active")
}, 10);
</script> </script>
{% endif %} {% endif %}
</li> </li>
@@ -202,6 +207,12 @@
</div> </div>
<script> <script>
setTimeout(() => {
$(".oh-btn--view-active").click();
if (!$(".oh-btn--view-active").length) {
$("#applyFilter").click()
}
}, 100);
$(".oh-btn--view").click(function (e) { $(".oh-btn--view").click(function (e) {
e.preventDefault(); e.preventDefault();
$(".oh-btn--view-active").removeClass("oh-btn--view-active"); $(".oh-btn--view-active").removeClass("oh-btn--view-active");
@@ -227,7 +238,6 @@
<script> <script>
filterCountUpdate("filterForm") filterCountUpdate("filterForm")
$(document).ready(function () { $(document).ready(function () {
$("#filterForm select").select2("destroy")
$("#filterForm select").parent().find("span").remove() $("#filterForm select").parent().find("span").remove()
$("#filterForm select").select2() $("#filterForm select").select2()
}); });