Source

bloodhound-trac / trac / versioncontrol / templates / browser.html

Full commit
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<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">
  <xi:include href="layout.html" />
  <head>
    <title py:choose="len(path_links)">
      <py:when test="1">/</py:when>
      <py:when test="2">${path_links[-1].name}</py:when>
      <py:otherwise><i18n:msg params="basename, dirname">${path_links[-1].name} in ${'/'.join(part.name for part in path_links[1:-1])}</i18n:msg></py:otherwise>
    </title>
    <meta py:if="file and file.annotate" name="ROBOTS" content="NOINDEX, NOFOLLOW" />
    <meta py:if="dir" name="ROBOTS" content="NOINDEX" />
    <script type="text/javascript" src="${chrome.htdocs_location}js/folding.js"></script>
    <script type="text/javascript">
      jQuery(document).ready(function($) {
        $(".trac-toggledeleted").show().click(function() {
                  $(this).siblings().find(".trac-deleted").toggle();
                  return false;
        }).click();
        $("#jumploc input").hide();
        $("#jumploc select").change(function () {
          this.parentNode.parentNode.submit();
        });

        <py:if test="dir or repo">
          /* browsers using old WebKits have issues with expandDir... */
          var webkit_rev = /AppleWebKit\/(\d+)/.exec(navigator.userAgent);
          if ( !webkit_rev || (521 - webkit_rev[1]).toString()[0] == "-" )
            enableExpandDir(null, $("table.dirlist tr"), {
                action: 'inplace',
                range_min_secs: '$dir.range_min_secs',
                range_max_secs: '$dir.range_max_secs'
            });
        </py:if>
        <py:if test="file">
          <py:if test="file.annotate == 'blame'">
            enableBlame("${href.changeset()}/", "${reponame}", "${path}");
          </py:if>
          $('#preview table.code').enableCollapsibleColumns($('#preview table.code thead th.content'));
        </py:if>
      });
    </script>
  </head>

  <body>
    <div id="content" class="browser">

      <py:if test="dir or file">
        <h1 py:with="repo_index=repo and repo.repositories;
                     path_links=None if repo_index else path_links">
          <span py:if="repo_index" class="pathentry">Default Repository</span>
          <xi:include href="path_links.html" />
        </h1>

        <div id="diffrev">
          <form action="${href.changeset()}" method="get">
            <div>
              <label title="Show the diff against a specific revision"
                     py:with="full_path = '/'.join(p.strip('/') for p in (reponame, path) if p)">
                View diff against: <input type="text" name="old" size="6"/>
                <input type="hidden" name="old_path" value="$full_path"/>
                <input type="hidden" name="new" value="$stickyrev"/>
                <input type="hidden" name="new_path" value="$full_path"/>
              </label>
            </div>
          </form>
        </div>

        <div id="jumprev">
          <form action="" method="get">
            <div>
              <label for="rev" title="${_('Hint: clear the field to view latest revision') if stickyrev else None}">
                View revision:</label>
              <input type="text" id="rev" name="rev" value="$stickyrev" size="6" />
            </div>
          </form>
        </div>

        <div py:if="quickjump_entries" id="jumploc">
          <form action="" method="get">
            <div class="buttons">
              <label for="preselected">Visit:</label>
              <select id="preselected" name="preselected">
                <option selected="selected" />
                <optgroup py:for="category, locations in groupby(quickjump_entries, key=lambda q: q[0])"
                  label="${category}">
                  <option py:for="_, name, path, rev in locations" value="${href.browser(reponame, path, rev=rev)}">$name</option>
                </optgroup>
              </select>
              <input type="submit" value="${_('Go!')}" title="Jump to the chosen preselected path" />
            </div>
          </form>
        </div>

        <div class="trac-tags" py:with="changeset = repos.get_changeset(repos.normalize_rev(stickyrev))">
          <span py:for="branch, head in changeset.get_branches()" py:if="branch not in ('default', 'master')"
                class="branch${' head' if head else ''}"
                title="${_('Branch head') if head else _('Branch')}">${branch}</span>
          <span py:for="tag in changeset.get_tags()" class="tag" title="Tag">${tag}</span>
        </div>
      </py:if>

      <py:if test="dir">
        <table class="listing dirlist" id="dirlist">
          <xi:include href="dirlist_thead.html" />
          <tbody>
            <py:if test="'up' in chrome.links">
              <tr class="even">
                <td class="name" colspan="6">
                  <a class="parent" title="Parent Directory" href="${chrome.links.up[0].href}">../</a>
                </td>
              </tr>
            </py:if>
            <xi:include href="dir_entries.html" />
            <tr py:if="'up' not in chrome.links and not dir.entries" class="even">
              <td class="name" colspan="6">
                No files found
              </td>
            </tr>
          </tbody>
        </table>
      </py:if>

      <table py:if="properties or file" id="info" summary="Revision info">
        <tr py:if="file">
          <th py:with="cset = href.changeset(created_rev, reponame);
                       rcset = href.changeset(created_rev, reponame, created_path);
                       drev = display_rev(created_rev);
                       author = authorinfo(file.changeset.author);
                       age = pretty_dateinfo(file.changeset.date)">
            <py:choose>
              <py:when test="stickyrev">
                <i18n:msg params="stickyrev, rev, author, age">
                  <a href="$rcset" title="View differences">Last change</a>
                  on this file since ${display_rev(stickyrev)} was
                  <a href="$cset" title="${_('View changeset %(rev)s', rev=drev)}">$drev</a>,
                  checked in by $author, $age
                </i18n:msg>
              </py:when>
              <py:otherwise>
                <i18n:msg params="rev, author, age">
                  <a href="$rcset" title="View differences">Last change</a>
                  on this file was
                  <a href="$cset" title="${_('View changeset %(rev)s', rev=drev)}">$drev</a>,
                  checked in by $author, $age
                </i18n:msg>
              </py:otherwise>
            </py:choose>
          </th>
        </tr>
        <tr py:if="file">
          <td class="message searchable" py:choose="">
            <py:when test="wiki_format_messages" xml:space="preserve">
              ${wiki_to_html(context.child('changeset', file.changeset.rev, parent=repos.resource),
                             file.changeset.message, escape_newlines=True)}
            </py:when>
            <py:otherwise>${file.changeset.message}</py:otherwise>
          </td>
        </tr>
        <tr py:if="properties">
          <td colspan="2">
            <ul class="props">
              <py:def function="prop_value(prop)">
                <py:choose>
                  <py:when test="istext(prop.value)"><em><code>$prop.value</code></em></py:when>
                  <py:otherwise>$prop.value</py:otherwise>
                </py:choose>
              </py:def>
              <li py:for="prop in properties" py:choose="">
                <py:when test="prop.rendered">
                   <span py:if="prop.rendered.name"
                         py:attrs="prop.rendered.name_attributes" py:content="prop.rendered.name" />
                   <div py:attrs="prop.rendered.content_attributes" py:content="prop.rendered.content" />
                </py:when>
                <py:otherwise>
                  <i18n:msg params="name, value">Property <strong>$prop.name</strong> set to ${prop_value(prop)}</i18n:msg>
                </py:otherwise>
              </li>
            </ul>
          </td>
        </tr>
        <tr py:if="file" i18n:msg="size">
          <td colspan="2">
            <strong>File size:</strong>
            <span title="${_('%(size)s bytes', size=file.size)}">${pretty_size(file.size)}</span>
          </td>
        </tr>
      </table>

      <div py:if="dir and path == '/'" class="description">
        ${wiki_to_html(context.child('source', '/', parent=repos.resource), repoinfo.description)}
      </div>

      <py:if test="repo and repo.repositories">
        <hr py:if="dir"/>
        <h1>Repository Index</h1>
        <py:with vars="repoindex = 'repoindex'">
          <xi:include href="repository_index.html" />
        </py:with>
      </py:if>

      <div py:if="file and file.preview" id="preview" class="searchable">
        <xi:include href="preview_file.html" py:with="preview = file.preview"/>
      </div>

      <div id="anydiff">
        <form action="${href.diff()}" method="get">
          <div class="buttons">
            <input type="hidden" name="new_path" value="${'/' + pathjoin(reponame, path)}" />
            <input type="hidden" name="old_path" value="${'/' + pathjoin(reponame, path)}" />
            <input type="hidden" name="new_rev" value="$stickyrev" />
            <input type="hidden" name="old_rev" value="$stickyrev" />
            <input type="submit" value="${_('View changes...')}" title="Select paths and revs for Diff" />
          </div>
        </form>
      </div>

      <div id="help" i18n:msg="">
        <strong>Note:</strong> See <a href="${href.wiki('TracBrowser')}">TracBrowser</a>
        for help on using the repository browser.
      </div>

    </div>
  </body>
</html>