<!--!  Copyright (C) 2008-2014 Edgewall Software

  This software is licensed as described in the file COPYING, which
  you should have received as part of this distribution. The terms
  are also available at http://trac.edgewall.com/license.html.

  This software consists of voluntary contributions made by many
  individuals. For the exact contribution history, see the revision
  history and logs, available at http://trac.edgewall.org/.

Template snippet for a table of repositories
-->
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:py="http://genshi.edgewall.org/"
    xmlns:xi="http://www.w3.org/2001/XInclude" py:strip="">
  <table class="listing dirlist" id="${repoindex or None}">
    <xi:include href="dirlist_thead.html" />
    <tbody>
      <py:for each="idx, (reponame, repoinfo, repos, change, err, raw_href) in enumerate(repo.repositories)"
              py:with="chgset_context = change and context.child('changeset', change.rev, parent=repos.resource);
                       chgset_view = change and change.is_viewable(perm)">
        <tr class="${'odd' if idx % 2 else 'even'}">
          <td class="name">
            <em py:strip="not err">
              <strong py:strip="repoinfo.alias != ''">
                <a class="dir" title="View Root Directory"
                   href="${href.browser(repos.reponame if repos else reponame,
                                        order=order if order != 'name' else None, desc=desc)}">$reponame</a>
              </strong>
            </em>
          </td>
          <td class="size">
            <a py:if="raw_href" class="trac-ziplink" href="$raw_href" title="Download as Zip archive">&#8203;</a>
          </td>
          <td class="rev">
            <py:if test="change and not err">
              <a title="View Revision Log" href="${href.log(repos.reponame)}">${repos.display_rev(change.rev)}</a>
              <a title="View Changeset" class="chgset" href="${href.changeset(change.rev, repos.reponame)}">&nbsp;</a>
            </py:if>
          </td>
          <td class="age" style="${chgset_view and change and repo.timerange and 'border-color: rgb(%s,%s,%s)' %
                                   repo.colorize_age(repo.timerange.relative(change.date)) or None}">
            ${pretty_dateinfo(change.date, dateonly=True) if chgset_view else '&ndash;'}
          </td>
          <td class="author">${authorinfo_short(change.author) if chgset_view else '&ndash;'}</td>
          <td class="change" py:choose="">
            <py:when test="err"><em py:content="err"></em></py:when>
            <py:when test="chgset_view" py:choose="">
              <py:when test="wiki_format_messages">${wiki_to_oneliner(chgset_context, change.message, shorten=True)}</py:when>
              <py:otherwise>${shorten_line(change.message)}</py:otherwise>
            </py:when>
            <py:otherwise>&ndash;</py:otherwise>
          </td>
        </tr>
        <tr class="${'odd' if idx % 2 else 'even'}" py:if="repoinfo.description">
          <td class="description" colspan="6">${wiki_to_html(context.child('source', '/', parent=repos.resource), repoinfo.description)}</td>
        </tr>
      </py:for>
    </tbody>
  </table>
</html>
