[Rt-commit] rt branch 5.0/improve-article-search-result-formatting created. rt-5.0.2-84-gb7a1187984

BPS Git Server git at git.bestpractical.com
Fri Feb 25 16:27:45 UTC 2022


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".

The branch, 5.0/improve-article-search-result-formatting has been created
        at  b7a1187984fadde7dad4c1f5648a107dee50c7bc (commit)

- Log -----------------------------------------------------------------
commit b7a1187984fadde7dad4c1f5648a107dee50c7bc
Author: Jason Crome <jcrome at bestpractical.com>
Date:   Fri Feb 25 11:24:54 2022 -0500

    Improve formatting of article results in self service
    
    Used CollectionList as the base for results so that we can provide a
    familiar experience with a minimal amount of work.

diff --git a/share/html/SelfService/Article/Search.html b/share/html/SelfService/Article/Search.html
index d3b75e4a9d..5876e7a47f 100644
--- a/share/html/SelfService/Article/Search.html
+++ b/share/html/SelfService/Article/Search.html
@@ -62,10 +62,10 @@
 </form>
 
   <div class="form-row">
-    <span class="label col-auto">
+    <span class="label col-auto font-weight-bold">
 % if ($Articles_Content) {
-%   if ($articles_basics->Count || $articles_content->Count) {
-<&|/l,$Articles_Content&>Articles matching [_1]</&>
+%   if ($articles->Count) {
+<% $articles->Count %> <&|/l,$Articles_Content&>Articles matching [_1]</&>
 %   } else {
 <&|/l,$Articles_Content&>No Articles match [_1]</&>
 %   }
@@ -73,48 +73,51 @@
     </span>
   </div>
 
-% my %dedupe_articles;
-% while (my $article = $articles_content->Next) {
-%   $dedupe_articles{$article->Id}++;
-  <div class="form-row">
-    <span class="value col-auto">
-      <a href="Display.html?id=<%$article->Id%>"><%$article->Name || loc('(no name)')%>: <%$article->Summary%></a>
-    </span>
-  </div>
-% }
 
-% while (my $article = $articles_basics->Next) {
-%   next if $dedupe_articles{$article->Id};
-  <div class="form-row">
-    <span class="value col-auto">
-      <a href="Display.html?id=<%$article->Id%>"><%$article->Name || loc('(no name)')%>: <%$article->Summary%></a>
-    </span>
-  </div>
+% if ($articles->BuildSelectCountQuery =~ /WHERE/i) {
+<& /Elements/CollectionList,
+    Collection => $articles,
+    AllowSorting => 1,
+    OrderBy => \@OrderBy,
+    Order => \@Order,
+    Format => $format,
+    GenericQueryArgs => { Articles_Content => $Articles_Content, },
+    &>
 % }
-</div>
+
 <%init>
 use RT::Articles;
 
-my $articles_content = RT::Articles->new( $session{'CurrentUser'} );
-my $articles_basics = RT::Articles->new( $session{'CurrentUser'} );
+my $articles = RT::Articles->new( $session{'CurrentUser'} );
 if ( $ARGS{'Articles_Content'} ) {
-    $articles_content->LimitCustomField( VALUE => $ARGS{'Articles_Content'},
-                                                OPERATOR => 'LIKE' );
-
-    $articles_basics->Limit( SUBCLAUSE       => 'all',
-                             FIELD           => 'Name',
-                             OPERATOR        => 'LIKE',
-                             VALUE           => $ARGS{'Articles_Content'},
-                             ENTRYAGGREGATOR => "OR" );
-    $articles_basics->Limit( SUBCLAUSE       => 'all',
-                             FIELD           => 'Summary',
-                             OPERATOR        => 'LIKE',
-                             VALUE           => $ARGS{'Articles_Content'},
-                             ENTRYAGGREGATOR => "OR" );
+    $articles->LimitCustomField( VALUE           => $ARGS{'Articles_Content'},
+                                 OPERATOR        => 'LIKE',
+                                 ENTRYAGGREGATOR => "OR",
+                                 SUBCLAUSE       => 'all' );
+    $articles->Limit( SUBCLAUSE       => 'all',
+                      FIELD           => 'Name',
+                      OPERATOR        => 'LIKE',
+                      VALUE           => $ARGS{'Articles_Content'},
+                      ENTRYAGGREGATOR => "OR" );
+    $articles->Limit( SUBCLAUSE       => 'all',
+                      FIELD           => 'Summary',
+                      OPERATOR        => 'LIKE',
+                      VALUE           => $ARGS{'Articles_Content'},
+                      ENTRYAGGREGATOR => "OR" );
 }
 
+my $format = q{
+    '<a href="__WebPath__/Articles/Article/Display.html?id=__id__">__id__</a>/TITLE:#',
+    '<a href="__WebPath__/Articles/Article/Display.html?id=__id__">__Name__</a>/TITLE:Name',
+    '__ClassName__',
+    '__CreatedRelative__',
+    '__LastUpdatedRelative__',
+    '__Summary__',
+    '__Topics__', };
 
 </%init>
 <%args>
 $Articles_Content => ''
+ at OrderBy => ()
+ at Order   => ()
 </%args>

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list