Mailing List Archive

rt branch, 4.4/config-option-search-results-navigation-links, created. rt-4.4.4-1-g97934b5728
The branch, 4.4/config-option-search-results-navigation-links has been created
at 97934b57281ecb73b5aa524dd1ae5718cb69dee7 (commit)

- Log -----------------------------------------------------------------
commit 97934b57281ecb73b5aa524dd1ae5718cb69dee7
Author: craig kaiser <craig@bestpractical.com>
Date: Tue Jun 23 10:17:15 2020 -0400

Add config option to disable search results navigation links

Generating these links requires re-running the current tickets search
which results in the loading of ticket display page taking slightly longer.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 54e5949e7a..7e4a14b5cf 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1506,6 +1506,17 @@ ticket display page automatically.

Set($SearchResultsAutoRedirect, 0);

+
+=item C<$SearchResultsNavigationLinks>
+
+Option to build the search navigation options in the RT menu ( First, Last, Prev, Next ).
+This feature requires the re-running of the current search in order to accuratly create
+the menu links, disabling it can speed up ticket load time.
+
+=cut
+
+Set($SearchResultsNavigationLinks, 1);
+
=back


diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 755c8d219e..8fdd725715 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -875,21 +875,23 @@ my $build_main_nav = sub {
$session{"tickets"}->PrepForSerialization();
}

- my $search = Menu()->child('search')->child('tickets');
- # Don't display prev links if we're on the first ticket
- if ( $item_map->{$id}->{prev} ) {
- $search->child( first =>
- title => '<< ' . loc('First'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{first});
- $search->child( prev =>
- title => '< ' . loc('Prev'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{prev});
- }
- # Don't display next links if we're on the last ticket
- if ( $item_map->{$id}->{next} ) {
- $search->child( next =>
- title => loc('Next') . ' >', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{next});
- if ( $item_map->{last} ) {
- $search->child( last =>
- title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
+ if ( RT::Config->Get( 'SearchResultsNavigationLinks' ) ) {
+ my $search = Menu()->child('search')->child('tickets');
+ # Don't display prev links if we're on the first ticket
+ if ( $item_map->{$id}->{prev} ) {
+ $search->child( first =>
+ title => '<< ' . loc('First'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{first});
+ $search->child( prev =>
+ title => '< ' . loc('Prev'), class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{prev});
+ }
+ # Don't display next links if we're on the last ticket
+ if ( $item_map->{$id}->{next} ) {
+ $search->child( next =>
+ title => loc('Next') . ' >', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{$id}->{next});
+ if ( $item_map->{last} ) {
+ $search->child( last =>
+ title => loc('Last') . ' >>', class => "nav", path => "/Ticket/Display.html?id=" . $item_map->{last});
+ }
}
}
}

-----------------------------------------------------------------------
_______________________________________________
rt-commit mailing list
rt-commit@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit