Persisting custom parameters in /query

34 views
Skip to first unread message

Florian Berger

unread,
Feb 6, 2024, 10:15:57 AM2/6/24
to trac-...@googlegroups.com
When a user adjusts the parameters of a query to get a tailored list of tickets, the respective POST
request is apparently handled by QueryModule.process_request() im module ticket.query . In line 982
of the current version, a check for 'update' in req.args is performed, and if present, the redirect
req.redirect(query.get_href(req.href)) is triggered.

I am working on a plugin which uses JavaScript to alter the display of the result list based on
parameters in the URL, for example /query?status=accepted&myview=compact . The script will detect
the myview=compact in the URL and act accordingly.

The rationale is that that way, users can bookmark a combination of the filter parameters and the
view settings of my plugin, since it's all in the query string. Also, I do not have to alter the
generated HTML on Trac's server side.

I would like my parameters to persist in the URL when the user changes filter settings and hits the
'update' button. According to my current understanding, I would have to hook into the above redirect
to basically achieve something like req.redirect(query.get_href(req.href) + '&myview=compact') in
QueryModule.process_request() .

I do not quite understand how I would achieve that using the plugin APIs. I have toyed a little with
IRequestFilter, but that did not get me anywhere.

Any hints, or sources achieving a similar effect, would be greatly appreciated.

Kind regards

Florian

Florian Berger

unread,
Feb 7, 2024, 5:25:38 AM2/7/24
to trac-...@googlegroups.com
I realize this is more fitting for trac-dev, so I'll ask there.

Florian
Reply all
Reply to author
Forward
0 new messages