bloodhound-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rjol...@apache.org
Subject svn commit: r1453168 - in /incubator/bloodhound/trunk/bloodhound_theme/bhtheme: templates/bh_browser.html templates/bh_dir_entries.html templates/bh_dirlist_thead.html templates/bh_repository_index.html templates/bh_sortable_th.html theme.py
Date Wed, 06 Mar 2013 06:14:39 GMT
Author: rjollos
Date: Wed Mar  6 06:14:38 2013
New Revision: 1453168

URL: http://svn.apache.org/r1453168
Log:
Refs #162: Applied patch `t162_r1433074_bootstrap_browser.diff` from Olemis, with modifications
to keep elements contained within the `#content` `div`.

Added:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_browser.html
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_dir_entries.html
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_dirlist_thead.html
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_repository_index.html
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_sortable_th.html
Modified:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_browser.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_browser.html?rev=1453168&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_browser.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_browser.html Wed Mar
 6 06:14:38 2013
@@ -0,0 +1,246 @@
+<!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 row">
+
+      <py:if test="dir or file">
+        <div class="span12">
+          <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>
+            <py:if test="path_links">
+              <span py:choose="" py:with="part = path_links[-1]">
+                <py:when test="dir">Directory</py:when>
+                <py:when test="file">File</py:when>
+                <a class="path_entry" href="${part.href}" 
+                    title="${_('View %(name)s', name=part.name)}">${part.name}</a>
+              </span>
+            </py:if>
+          </h1>
+  
+          <div id="diffrev" class="pull-right">
+            <form action="${href.changeset()}" method="get" class="form-inline">
+              <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" class="input-small"/>
+                  <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" class="pull-right">
+            <form action="" method="get" class="form-inline">
+              <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" class="input-small"/>
+              </div>
+            </form>
+          </div>
+  
+          <div py:if="quickjump_entries" id="jumploc" class="pull-right">
+            <form action="" method="get" class="form-inline">
+              <div class="buttons">
+                <label for="preselected">Visit:</label>
+                <select id="preselected" name="preselected" class="input-small">
+                  <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>
+
+        <div class="trac-tags span12" py:with="changeset = repos.get_changeset(repos.normalize_rev(stickyrev))">
+          <p>
+            <py:for each="branch, head in changeset.get_branches()">
+              <span py:if="branch not in ('default', 'master')"
+                  class="label label-inverse branch${' head' if head else ''}"
+                  title="${_('Branch head') if head else _('Branch')}">${branch}</span>
+            </py:for>
+            <py:for each="tag in changeset.get_tags()">&nbsp;
+              <span class="label tag" title="Tag">${tag}</span>
+            </py:for>
+          </p>
+        </div>
+      </py:if>
+
+      <div py:if="dir" class="span12">
+        <table class="listing dirlist" id="dirlist">
+          <xi:include href="bh_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="bh_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>
+      </div>
+
+      <div class="span12">
+        <div py:if="properties or file" id="info" class="well" summary="Revision info">
+          <py:if test="file">
+            <strong 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>
+            </strong><br/>
+          </py:if>
+          <py:if test="file">
+            <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}<br/></py:otherwise>
+            </py:choose>
+          </py:if>
+          <py:if test="properties">
+            <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>
+          </py:if>
+          <py:if test="file" i18n:msg="size">
+            <span class="label label-info">File size:</span>
+            <span title="${_('%(size)s bytes', size=file.size)}">${pretty_size(file.size)}</span>
+          </py:if>
+        </div>
+        <br/>
+      </div>
+
+      <div py:if="dir and path == '/'" class="description">
+        ${wiki_to_html(context.child('source', '/', parent=repos.resource), repoinfo.description)}
+      </div>
+
+      <div py:if="repo and repo.repositories" class="span12">
+        <hr py:if="dir"/>
+        <h2>Repository Index</h2>
+        <py:with vars="repoindex = 'repoindex'">
+          <xi:include href="bh_repository_index.html" />
+        </py:with>
+      </div>
+
+      <div py:if="file and file.preview" class="span12">
+        <div id="preview" class="searchable">
+          <xi:include href="bh_preview_file.html" py:with="preview = file.preview"/>
+        </div>
+        <br/>
+      </div>
+
+      <div id="anydiff" class="span12">
+        <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" class="btn" />
+          </div>
+        </form>
+      </div>
+
+      <div id="help" i18n:msg="" class="help-block pull-right">
+        <span class="label label-info">Note</span> See <a href="${href.wiki('TracBrowser')}">TracBrowser</a>
+        for help on using the repository browser.
+      </div>
+
+    </div>
+  </body>
+</html>

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_dir_entries.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_dir_entries.html?rev=1453168&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_dir_entries.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_dir_entries.html Wed
Mar  6 06:14:38 2013
@@ -0,0 +1,39 @@
+<!--! Template for generating rows corresponding to directory entries -->
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:py="http://genshi.edgewall.org/"
+      xmlns:xi="http://www.w3.org/2001/XInclude" py:strip="">
+  <py:for each="idx, entry in enumerate(dir.entries)"
+          py:with="change = dir.changes[entry.created_rev];
+                   chgset_context = change and context.child('changeset', change.rev, parent=repos.resource);
+                   chgset_view = change and change.is_viewable(perm);
+                   isdir = entry.kind == 'dir'">
+    <tr class="${'odd' if idx % 2 else 'even'}">
+      <td class="name">
+        <a class="$entry.kind" title="${_('View Directory') if isdir else _('View File')}"
+           href="${href.browser(reponame, entry.path, rev=stickyrev, 
+                                order=order if order != 'name' else None, desc=desc)}">$entry.name</a>
+      </td>
+      <td class="size">
+        <span title="${_('%(size)s bytes', size=entry.content_length)}">${pretty_size(entry.content_length)}</span>
+        <a py:if="entry.raw_href" href="$entry.raw_href" class="${'trac-ziplink' if isdir
else 'trac-rawlink'}"                       
+           title="${_('Download as Zip archive') if isdir else _('Download')}">&#8203;<i
class="icon-download-alt"></i></a>
+      </td>
+      <td class="rev">
+        <a title="View Revision Log" href="${href.log(reponame, entry.path, rev=rev)}">${display_rev(entry.created_rev)}</a>
+        <a title="View Changeset" class="chgset" href="${href.changeset(change.rev, reponame)}">&nbsp;</a>
+      </td>
+      <td class="age" style="${chgset_view and dir.timerange and 'border-color: rgb(%s,%s,%s)'
%
+                               dir.colorize_age(dir.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="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>
+  </py:for>
+</html>

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_dirlist_thead.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_dirlist_thead.html?rev=1453168&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_dirlist_thead.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_dirlist_thead.html Wed
Mar  6 06:14:38 2013
@@ -0,0 +1,15 @@
+<!--! Template snippet for a standard table header for a dirlist -->
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:py="http://genshi.edgewall.org/"
+    xmlns:xi="http://www.w3.org/2001/XInclude" py:strip="">
+  <thead>
+    <tr>
+      <xi:include href="bh_sortable_th.html" py:with="class_ = 'name'; title = _('Name')"/>
+      <xi:include href="bh_sortable_th.html" py:with="class_ = 'size'; title = _('Size')"/>
+      <th class="rev">Rev</th>
+      <xi:include href="bh_sortable_th.html" py:with="class_ = 'date'; title = _('Age')"/>
+      <xi:include href="bh_sortable_th.html" py:with="class_ = 'author'; title = _('Author')"/>
+      <th class="change">Last Change</th>
+    </tr>
+  </thead>
+</html>

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_repository_index.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_repository_index.html?rev=1453168&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_repository_index.html
(added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_repository_index.html
Wed Mar  6 06:14:38 2013
@@ -0,0 +1,50 @@
+<!--! 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="bh_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">
+              <b 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>
+              </b>
+            </em>
+          </td>
+          <td class="size">
+            <a py:if="raw_href" class="trac-ziplink" href="$raw_href" title="Download
as Zip archive">&#8203;<i class="icon-download-alt"></i></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>

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_sortable_th.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_sortable_th.html?rev=1453168&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_sortable_th.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_sortable_th.html Wed
Mar  6 06:14:38 2013
@@ -0,0 +1,23 @@
+<!--! Snippet for a <th> corresponding to a sortable column.
+
+    Expects the following variables to be set specifically:
+
+    class_    the CSS class for the column
+    title     the title attribute for the column
+
+    e.g.  <py:with vars="class_ = 'name'; title = 'Name'">
+            <xi:include href="sortable_th.html" />
+          </py:with>
+
+    Expects the following variables from the context: order, desc, href, reponame, path,
stickyrev
+-->
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:py="http://genshi.edgewall.org/"
+    xmlns:xi="http://www.w3.org/2001/XInclude" py:strip="">
+  <th class="$class_${(' desc' if desc else ' asc') if order == class_ else None}">
+    <a title="${_('Sort by %(col)s %(direction)s', col=class_, 
+                  direction=_('(descending)') if order == class_ and not desc else _('(ascending)'))}"
+      href="${href.browser(reponame, path, rev=stickyrev, order=class_ if class_ != 'name'
else None,
+                           desc=1 if class_ == order and not desc else None)}">$title
<i py:if="order == class_" class="${'icon-chevron-down' if desc else 'icon-chevron-up'}"></i></a>
+  </th>
+</html>

Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py?rev=1453168&r1=1453167&r2=1453168&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Wed Mar  6 06:14:38 2013
@@ -62,7 +62,7 @@ class BloodhoundTheme(ThemeBase):
     disable_all_trac_css = True
     BLOODHOUND_KEEP_CSS = set(
         (
-            'diff.css',
+            'diff.css', 'code.css'
         )
     )
     BLOODHOUND_TEMPLATE_MAP = {
@@ -114,6 +114,8 @@ class BloodhoundTheme(ThemeBase):
 
         # Version control
         'revisionlog.html' : ('bh_revisionlog.html', '_modify_generic_vcs'),
+        'browser.html' : ('bh_browser.html', '_modify_browser'),
+        'dir_entries.html' : ('bh_dir_entries.html', None),
 
         # Multi Product
         'product_view.html' : ('bh_product_view.html', None),
@@ -338,6 +340,12 @@ class BloodhoundTheme(ThemeBase):
                 path_depth_limit=2
             ))
 
+    def _modify_browser(self, req, template, data, content_type, is_active):
+        """Locate path to file in breadcrumbs area rather than title.
+        """
+        self._modify_generic_vcs(req, template, data, content_type, is_active)
+        add_stylesheet(req, 'theme/css/browser.css')
+
     # INavigationContributor methods
 
     def get_active_navigation_item(self, req):



Mime
View raw message