[Bps-public-commit] rt-extension-spamfilter branch add-checkbox-selection updated. a0d4bcd0734a142eb764f99acb06b5389cd7c1c1

BPS Git Server git at git.bestpractical.com
Fri Jul 7 21:02:56 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-spamfilter".

The branch, add-checkbox-selection has been updated
       via  a0d4bcd0734a142eb764f99acb06b5389cd7c1c1 (commit)
      from  abf63551071ed6322c8af8c22aff1e8b59ee5c15 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a0d4bcd0734a142eb764f99acb06b5389cd7c1c1
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Fri Jul 7 18:02:34 2023 -0300

    Add Rows Per Page selection to the Spam Filter List page

diff --git a/html/Tools/SpamFilter/List.html b/html/Tools/SpamFilter/List.html
index 2468ffe..440ac96 100644
--- a/html/Tools/SpamFilter/List.html
+++ b/html/Tools/SpamFilter/List.html
@@ -123,13 +123,26 @@
                     lastDeleteSelected = this;
                 }
         });
+      // Submit form on Rows change
+      jQuery('select[name="Rows"]').change( function () {
+          jQuery('#SpamUpdate').submit();
+      });
     });
 </script>
 
+<form method="post" enctype="multipart/form-data" name="SpamUpdate" id="SpamUpdate">
 <& /Elements/ListActions, actions => \@results &>
 
+<div class="col-12 form-row justify-content-center">
+  <div class="label col-auto">
+      <&|/l&>Rows per page</&>:
+  </div>
+  <div class="value col-2">
+      <& /Elements/SelectResultsPerPage, Name => "Rows", Default => $Rows &>
+  </div>
+</div>
+<hr/>
 <div class="spams">
-<form method="post" enctype="multipart/form-data" name="SpamUpdate" id="SpamUpdate">
 <& /Elements/CollectionList, 
     Collection => $emails,
     AllowSorting => 1,
@@ -138,7 +151,7 @@
     Rows => $Rows,
     Page => $Page,
     Format => $Format,
-    PassArguments => ['Status'],
+    PassArguments => ['Status','Rows','OrderBy','Order'],
     Status => $Status,
    &>
 </div>
@@ -183,8 +196,8 @@ if (!$Status || $Status eq 'new') {
 
 $Order    ||= 'ASC';
 $OrderBy  ||= 'id';
-
-$Rows ||= 50;
+# Normalize Rows variable if we got 2 or more values
+$Rows = $Rows->[0] if ref $Rows eq 'ARRAY';
 $Page = 1 unless $Page && $Page > 0;
 
 use RT::Spams;
@@ -229,8 +242,6 @@ if ($Release) {
 my $emails = RT::Spams->new($session{'CurrentUser'}) ;
 $emails->Limit(FIELD => 'Status', VALUE => $Status );
 $emails->OrderBy( FIELD => $OrderBy, ORDER => $Order );
-$emails->RowsPerPage( $Rows );
-$emails->GotoPage( $Page - 1 );
 
 my $title;
 if ( $Status eq 'new' ) {
@@ -245,7 +256,7 @@ else {
 </%init>
 <%ARGS>
 $Format => undef 
-$Rows => undef
+$Rows => 50
 $Page => 1
 $OrderBy => undef
 $Order => undef

-----------------------------------------------------------------------

Summary of changes:
 html/Tools/SpamFilter/List.html | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
rt-extension-spamfilter


More information about the Bps-public-commit mailing list