"List" macro in templates
Bug #240432 reported by
Jeroen T. Vermeulen
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Triaged
|
Low
|
Unassigned |
Bug Description
We sometimes need to list items in the UI that are short enough to render as running text, but have enough templating in them not to belong in browser code.
A single macro ought to let us generate comma-separated lists of things that each take fmt:url and such to render.
Advanced versions could do things like add an "and" where appropriate ("x and y" but also "x, y, and z"); cut the list short with an ellipsis if it gets too long ("alpha, beta, gamma, delta, epsilon, zeta, ..."); let the user "fold" long lists; or provide other navigation aids.
mpt has been using "tal:comma" for cases where he'd want a macro like this, so if we ever implement this, grep the templates for that.
Changed in launchpad: | |
status: | New → Confirmed |
Changed in launchpad-foundations: | |
importance: | Undecided → Low |
status: | Confirmed → Triaged |
affects: | launchpad-foundations → launchpad-web |
To post a comment you must log in.
This TAL pattern produces "X" or "X, and Y" or "X, Y, and Z" etc:
<!-- (suppress whitespace) "repeat/ item/index" >, "repeat/ item/end" > and </tal:end>
--><tal:loop repeat="item view/items"><!-- (suppress whitespace)
--><tal:comma condition=
<tal:and condition=
</tal:comma>
Item text<!-- (suppress whitespace)
--></tal:loop>
That's not ideal for the X/Y case if the text for X is brief and simple, because there will be a comma for that case. It does work well for more complex X though.