<!--!
Display a list of attachments.

Arguments:
 - stats: an instance of trac.ticket.roadmap.TicketGroupStats
 - interval_hrefs: link associated to each interval in stats.intervals
 - percent=None: show that value as percentage, instead of stats.done_percent
 - legend=True: show a legend of label and count for each interval
 - style=None: explicit styling for the table.progress
 - stats_href=None: link associated to the total
-->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:i18n="http://genshi.edgewall.org/i18n"
      py:with="percent = value_of('percent', None);
               legend = value_of('legend', True);
               style = value_of('style', None);
               stats_href = value_of('stats_href', None)" py:strip="">

  <table class="progress" style="$style">
    <tr>
      <td py:for="idx, interval in enumerate(stats.intervals)"
          class="$interval.css_class"
          style="${interval.percent > 0 and 'width: %d%%' % interval.percent or 'display: none'}">
        <a href="${interval_hrefs and interval_hrefs[idx] or None}"
           title="${_('%(count)s/%(total)s %(title)s',
                      count=interval.count, total=stats.count, title=interval.title)}"></a>
      </td>
    </tr>
  </table>

  <p class="percent">${percent is None and '%d%%' % stats.done_percent or percent}</p>

  <dl py:if="legend">
    <dt i18n:msg="unit">Number of ${stats.unit}:</dt><dd />

    <py:for each="idx, interval in enumerate(stats.intervals)">
      <py:with vars="href = interval_hrefs and interval_hrefs[idx] or None">
        <i18n:msg params="title, count">
          <dt><a href="${href}">${interval.title}:</a></dt>
          <dd><a href="${href}">${interval.count}</a></dd>
        </i18n:msg>
      </py:with>
    </py:for>

    <i18n:msg params="count">
      <dt><a href="${stats_href}" i18n:msg="num">Total:</a></dt>
      <dd><a href="${stats_href}">${stats.count}</a></dd>
    </i18n:msg>

  </dl>
</html>
