Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix that search result tr classes are applied on NEWLINE in Row callback #273

Conversation

dnsmichi
Copy link
Contributor

Context

I'm writing an extension which highlights search result rows on specific conditions. This can be handled with using the Row callback and setting the $Classes reference, resulting in an additional CSS class for e.g. adding a background color.

Sample code:

$ vim html/Callbacks/RT-Extension-SearchResult/Elements/CollectionList/EachRow
...
my $BGColorClass = $Record->getHighlight("rowclass");

if (defined($BGColorClass)) {
  push @additionalClasses, $BGColorClass;
}

$$Classes = join(' ', @additionalClasses);

Version

RT 4.4.3 4df308e

Problem

This works for the first line. When the search result is split up with NEWLINE in between, the secondary list-item is printed without the overridden class.

http://192.168.56.10/Search/Results.html?Format=%27%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__id__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3A%23%27%2C%0A%27%3Cb%3E%3Ca%20href%3D%22__WebPath__%2FTicket%2FDisplay.html%3Fid%3D__id__%22%3E__Subject__%3C%2Fa%3E%3C%2Fb%3E%2FTITLE%3ASubject%27%2C%0AStatus%2C%0AQueueName%2C%0AOwner%2C%0APriority%2C%0A%27__NEWLINE__%27%2C%0A%27__NBSP__%27%2C%0A%27%3Csmall%3E__Requestors__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__CreatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__ToldRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__LastUpdatedRelative__%3C%2Fsmall%3E%27%2C%0A%27%3Csmall%3E__TimeLeft__%3C%2Fsmall%3E%27%2C%0A%27__Icon__%27%2C%0A%27__LastUpdatedBy__%27&Order=DESC%7CASC%7CASC%7CASC&OrderBy=LastUpdated%7C%7C%7C&Query=Status%20!%3D%20%27resolved%27&RowsPerPage=50&SavedChartSearchId=new&SavedSearchId=RT%3A%3AUser-14-SavedSearch-13

screen shot 2018-11-23 at 14 10 28

Fix

Add the Classes variable into the condition for newlines too.

screen shot 2018-11-23 at 14 11 23

@sunnavy
Copy link
Member

sunnavy commented Nov 26, 2018

Merged it into 4.4-trunk, thanks!

@sunnavy sunnavy closed this Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants