#3293 closed defect (fixed)
Add "No Tickets" Result to TicketQuery macro
Reported by: | brian | Owned by: | Jonas Borgström |
---|---|---|---|
Priority: | high | Milestone: | 0.11 |
Component: | ticket system | Version: | 0.9.5 |
Severity: | normal | Keywords: | query |
Cc: | bpelton@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I think the TicketQuery macro should display "No results" or "No tickets" or something to indicate the query worked, but that there are no tickets.
For instance, I have some pages the describe the modules of the program. Each page lists the open tickets for that module (yes, I know this is available elsewhere, but sometimes it is helpful to have in the wiki too) The heading says "Open Tickets" and if there aren't any, it just has whitespace under it. This hints that there are no open tickets, but it isn't concrete.
I modified query.py to write "No open tickets" so it would be clear.
This isn't the best way, because not all TicketQuery usage will be looking for open tickets. It would be nice to have a parameter of the TicketQuery macro be "message if none found". So you could write:
[[TicketQuery(status=new,"No new tickets")]]
This would list all the new tickets, or if there aren't any, it would display "No new tickets"
Attachments (2)
Change History (10)
comment:1 by , 18 years ago
by , 18 years ago
Modified query.py to allow param for no results message
comment:3 by , 18 years ago
Keywords: | custom ticket query added |
---|
comment:4 by , 18 years ago
Keywords: | TracQuery custom ticket removed |
---|
Or why not something even simpler (based on trunk / r4326):
-
trac/ticket/query.py
782 782 return html.DL([(html.DT(ticket_anchor(ticket)), 783 783 html.DD(ticket['summary'])) 784 784 for ticket in tickets], class_='wiki compact') 785 else: 786 return html.P('No tickets found.')
comment:5 by , 18 years ago
There might be some cases when no query results should be blank. Or the text might be specific to the query.
It seems like having a parameter just gives more flexibility and the query macro seems to be a good place to have lots of flexibility.
comment:6 by , 18 years ago
Priority: | normal → high |
---|---|
Severity: | minor → normal |
Type: | enhancement → defect |
Uh, yeah… looking at the version of this page on my trac site is massively confusing, because there's nothing in the list and it looks like the query isn't working. One really can't tell from that what the macro is supposed to be doing.
I've upped the priority because unless addressed, for many people I think this feature will just appear to be broken.
comment:7 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:8 by , 18 years ago
Implemented in r5458. That "No results" string is returned in a span.query_no_results
element, so that it's possible to tweak its presentation further (red, blink … or even display: none
to match the previous behavior).
I do not know the Python programming language, but I took a stab at making this work.
I'm attaching the whole query.py file.