#1: Add a new project summary module. (My Page)
-------------------------+--------------------------------------------------
 Reporter:               |        Owner:  jonas   
     Type:  enhancement  |       Status:  reopened
 Priority:  normal       |    Milestone:  1.0     
Component:  general      |      Version:  0.6.1   
 Severity:  major        |   Resolution:          
 Keywords:  project      |  
-------------------------+--------------------------------------------------
Changes (by cboos):

  * status:  closed => reopened
  * resolution:  fixed =>

Comment:

 Quite unbelievably, this is ''not'' a test ticket, but a valid one.

 Though the question of whether this should be done as a plugin might be
 asked...

 An alternative to a plugin would be the possibility to have macros that
 can provide all the required info an be inserted in the WikiStart page.

 e.g. the TicketQuery macro could be adapted to accept a ''count'' format,
 in addition to the ''compact'' one, and that would simply show the number
 of tickets matching the specific request.

 {{{
 #!diff
 Index: trac/ticket/query.py
 ===================================================================
 --- trac/ticket/query.py        (revision 3603)
 +++ trac/ticket/query.py        (working copy)
 @@ -677,22 +677,30 @@
      This macro accepts two parameters, the second of which is optional.

      The first parameter is the query itself, and uses the same syntax as
 for
 -    {{{query:}}} wiki links. The second parameter determines how the list
 of
 -    tickets is presented: the default presentation is to list the ticket
 ID next
 -    to the summary, with each ticket on a separate line. If the second
 parameter
 -    is given and set to '''compact''' then the tickets are presented as a
 -    comma-separated list of ticket IDs.
 +    {{{query:}}} wiki links.
 +
 +    The second parameter determines how the list of tickets is
 +    presented: the default presentation is to list the ticket ID next
 +    to the summary, with each ticket on a separate line.
 +    If the second parameter is given, it must be one of:
 +     - '''compact''' -- the tickets are presented as a comma-separated
 +       list of ticket IDs.
 +     - '''count''' -- only the count of matching tickets is displayed
      """

      def render_macro(self, req, name, content):
          query_string = ''
 -        compact = 0
 +        compact = False
 +        count = False
          argv = content.split(',')
          if len(argv) > 0:
              query_string = argv[0]
              if len(argv) > 1:
 -                if argv[1].strip().lower() == 'compact':
 -                    compact = 1
 +                format = argv[1].strip().lower()
 +                if format == 'compact':
 +                    compact = True
 +                elif format == 'count':
 +                    count = True

          buf = StringIO()

 @@ -709,6 +717,8 @@
                          (ticket['status'], href, summary, ticket['id'])
                      links.append(a)
                  buf.write(', '.join(links))
 +            elif count:
 +                buf.write(len(tickets))
              else:
                  buf.write('<dl class="wiki compact">')
                  for ticket in tickets:

 }}}

-- 
Ticket URL: <http://trac.edgewall.org/ticket/1#comment:36>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets

Reply via email to