[PATCH v2 4/5] toaster: Generalize detail table controls

Paolo Wattebled <[email protected]>
Newsgroups org.openembedded.lists.bitbake-devel
Message-ID <[email protected]>
Allow detail tables to provide their validated page size and default
ordering while preserving existing defaults for current users.

AI-Generated: Uses GitHub Copilot and OpenCode with GPT-5.6 Sol
Signed-off-by: Paolo Wattebled <[email protected]>
---
 .../toastergui/templates/detail_pagination_bottom.html        | 4 ++--
 lib/toaster/toastergui/templates/detail_search_header.html    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/toaster/toastergui/templates/detail_pagination_bottom.html b/lib/toaster/toastergui/templates/detail_pagination_bottom.html
index 15adfbc91..ddcba133e 100644
--- a/lib/toaster/toastergui/templates/detail_pagination_bottom.html
+++ b/lib/toaster/toastergui/templates/detail_pagination_bottom.html
@@ -41,8 +41,8 @@
 <script>
  $(document).ready(function() {
     // load data for number of entries to be displayed on page
-    if ({{request.GET.count}} != "") {
-      pagesize = {{request.GET.count}};
+    if ({{validated_pagesize|default:request.GET.count}} != "") {
+      pagesize = {{validated_pagesize|default:request.GET.count}};
     }
     $('.pagesize option').prop('selected', false)
                          .filter('[value="' + pagesize + '"]')
diff --git a/lib/toaster/toastergui/templates/detail_search_header.html b/lib/toaster/toastergui/templates/detail_search_header.html
index 7a9865908..0205b88f6 100644
--- a/lib/toaster/toastergui/templates/detail_search_header.html
+++ b/lib/toaster/toastergui/templates/detail_search_header.html
@@ -31,7 +31,7 @@ $(document).ready(function() {
         <div class="form-group">
           <div class="btn-group">
             <input id="search" class="form-control" type="text" placeholder="Search {{search_what}}" name="search" value="{% if request.GET.search %}{{request.GET.search}}{% endif %}">
-            <input type="hidden" value="name:+" name="orderby">
+            <input type="hidden" value="{{search_orderby|default:'name:+'}}" name="orderby">
             <input type="hidden" value="l" name="page">
             {% if request.GET.search %}
             <span class="remove-search-btn-detail-search search-clear glyphicon glyphicon-remove-circle"></span>
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.