[Rt-commit] rt branch 5.0/improve-adding-action-links-to-search-results created. rt-5.0.3-513-g65ca8ca440
BPS Git Server
git at git.bestpractical.com
Tue Apr 25 00:58:46 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".
The branch, 5.0/improve-adding-action-links-to-search-results has been created
at 65ca8ca4405f7e8aeab647dfe558b262c82cdbd0 (commit)
- Log -----------------------------------------------------------------
commit 65ca8ca4405f7e8aeab647dfe558b262c82cdbd0
Author: Jason Crome <jcrome at bestpractical.com>
Date: Mon Apr 24 20:51:38 2023 -0400
Improve adding of action links to search results
This is streamlining existing functionality; previously, you'd need to
select a column, a link, and maybe a column title to add an action link
to search results. The user would end up with either a column title they
picked or the name of the field, and the clickable action would be the
value of that field. The user could then make changes to the format to
replace the header with a space (therefore removing the header) and
replacing the field value with the name of the action to take.
This commit assumes that users prefer the latter as the default
functionality, and treats the action link as other columns. Users can
then edit the format if they want to revert to the original format (or
something different, of course).
diff --git a/share/html/Search/Elements/BuildFormatString b/share/html/Search/Elements/BuildFormatString
index d3bb241e6d..8f83be861e 100644
--- a/share/html/Search/Elements/BuildFormatString
+++ b/share/html/Search/Elements/BuildFormatString
@@ -279,14 +279,17 @@ if ( $RemoveCol ) {
}
}
elsif ( $AddCol ) {
- if ( defined $SelectDisplayColumns ) {
- my $selected = $SelectDisplayColumns;
+ # Add links directly as clickable actions in the search results; to do so
+ # we need to put them on an even footing with columns containing data.
+ if ( defined $SelectDisplayColumns or defined $Link ) {
+ my $selected = $SelectDisplayColumns // [];
my @columns;
if (ref($selected) eq 'ARRAY') {
@columns = @$selected;
} else {
push @columns, $selected;
}
+ push @columns, 'loc(' . $Link . ')' if defined $Link;
foreach my $col (@columns) {
my %column = ();
$column{Column} = $col;
@@ -325,24 +328,23 @@ elsif ( $AddCol ) {
elsif ( $Class eq 'RT::Tickets' ) {
if ( $Link eq "Display" ) {
$column{Prefix} .= q{<a HREF="__WebPath__/Ticket/Display.html?id=__id__">};
- $column{Suffix} .= "</a>";
}
elsif ( $Link eq "Take" ) {
$column{Prefix} .= q{<a HREF="__WebPath__/Ticket/Display.html?Action=Take&id=__id__">};
- $column{Suffix} .= "</a>";
}
elsif ( $Link eq "Respond" ) {
$column{Prefix} .= q{<a HREF="__WebPath__/Ticket/Update.html?Action=Respond&id=__id__">};
- $column{Suffix} .= "</a>";
}
elsif ( $Link eq "Comment" ) {
$column{Prefix} .= q{<a HREF="__WebPath__/Ticket/Update.html?Action=Comment&id=__id__">};
- $column{Suffix} .= "</a>";
}
elsif ( $Link eq "Resolve" ) {
$column{Prefix} .= q{<a HREF="__WebPath__/Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=__id__">};
- $column{Suffix} .= "</a>";
}
+ $column{Suffix} .= "</a>";
+
+ # Links are always last; use a space for the title if one wasn't provided
+ $Title = 'NBSP' unless $Title;
}
if ($Title) {
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list