The URL driven index view specification mechanism of roundup is great.
Using this one can design a set of hard coded specifiers as links (in page.html) each of which which specify *part* of an index view (eg, some links for sort order, others for grouping, yet others on state etc).
Clicking a sequence of these links then allows very quick manipulation of the prevailing index, typically starting with "All Tracker Issues" and then narrowing down on various fields, choosing the columns to display, sorting and possibly grouping the index.
What one ends up with is a URL that precisely specifies some view of interest.
Now what one needs is a mechanism to save this view as a query, preferably via a single input field and associated button in the sidebar (eg, similar to the "Show Issue:" button). This would give it a name and save it (overwriting any previous query of the same name).
One can of course recreate the query via the search page manually and save that, but this form based method is not as flexible as the URL itself (one cannot specify "-1" for title, or sort on two fields for example) and one has precisely the desired index on the display already. Alternatively one can save the view to a browser bookmark, but that's not much help when you're on your home PC after work and vice versa.
A solution to all this is "Roundup Bookmarks" - simply a modified usage of roundup's saved query mechanism.
(1) near the top of page.html add a tal:define as::
- queryname request/form/@queryname/value |
- request/form/@old-queryname/value | string:;
(2) next add a form with one button and text input::
<form method="GET" action="issue">
<tal:block replace="structure request/indexargs_form"/> <input type="submit" class="form-small" value="Save"
i18n:attributes="value">
<input class="form-small" size="16" type="text" name="@queryname"
tal:attributes="value queryname" />
<input type="hidden" name="@old-queryname"
tal:attributes="value queryname" />
<input type="hidden" name="@type" value="issue"> <input type="hidden" name="@action" value="search"> <a href="#" tal:attributes="href python:request.indexargs_url('issue',
{})" i18n:translate="">X</a>
</form>
(3) for the TAL generated list of bookmarks modify the generating <a> tags as follows::
<a href="#"
tal:attributes="href string:${qs/klass}?${qs/url}&@dispname=${qs/name}&@queryname=${qs/name}&@old-queryname=${qs/name}" tal:content="qs/name">link</a><br>
(4) for every other indexargs_url driven "canned link" in page.html add an additional argument"::
- '@old-queryname': queryname
to keep track of the most recently selected bookmark (ie, query).
Clicking a bookmark (ie, saved query link) now interpolates the queryname into the URL (as @old-queryname). This name is also shown in the bookmark input field on the home page so one always knows which bookmark we've most recently used.
Making changes to the query (by clicking other canned links as I described above) can now be saved to this "current bookmark" by clicking the new "Save" button.
This updates the current bookmark, it does not create a new one.
To create a *new* bookmark one clicks the "X" link to the right of the new bookmark input tag. This clears the @old-queryname variable and the new name one then enters is saved to a *new* bookmark even if it has the same name as an existing one
Another nice addition is the insertion of a second <a> tag just ahead of the one described to generate the bookmarks in step (3) as::
<a id="searchbox" href="#"
- tal:condition="qs/is_edit_ok"
tal:attributes="href string:${qs/klass}?@template=search&${qs/url}&@dispname=${qs/name}&@queryname=${qs/name}&@old-queryname=${qs/name}">(edit)</a>
- tal:condition="qs/is_edit_ok"
which places an (edit) link to the right of each bookmark allowing you to edit it (via the search page) directly (note: I've commandeered the searchbox CSS spec to float this to the right right, one really should define its own CSS name).
The sidebar in my tracker with this feature installed looks like:
<img src="sidebar.png">
-Bruce Tulloch