You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by gj...@apache.org on 2012/05/08 14:07:11 UTC

svn commit: r1335448 - in /incubator/bloodhound/trunk/bloodhound_theme/bhtheme: templates/bh_attach_file_form.html templates/bh_path_wikipage.html templates/bh_wiki_view.html theme.py

Author: gjm
Date: Tue May  8 12:07:10 2012
New Revision: 1335448

URL: http://svn.apache.org/viewvc?rev=1335448&view=rev
Log:
theme: updating wiki view to use bootstrap - towards #41 (from olemis)

Added:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_attach_file_form.html   (with props)
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_wikipage.html   (with props)
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_view.html   (with props)
Modified:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_attach_file_form.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_attach_file_form.html?rev=1335448&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_attach_file_form.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_attach_file_form.html Tue May  8 12:07:10 2012
@@ -0,0 +1,18 @@
+<!--!
+Conditionally render an ''Attach File'' button.
+
+Arguments:
+ - alist: the data for the list of attachments
+ - add_button_title=None: the title of the "Attach" button
+-->
+<form 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:if="alist.can_create" method="get" action="${alist.attach_href}"
+      id="attachfile" style="display: inline">
+  <input type="hidden" name="action" value="new" />
+  <div class="btn-group">
+    <input class="btn" type="submit" name="attachfilebutton" value="${value_of('add_button_title', None) or _('Attach file')}" />
+  </div>
+</form>

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_attach_file_form.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_attach_file_form.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_wikipage.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_wikipage.html?rev=1335448&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_wikipage.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_wikipage.html Tue May  8 12:07:10 2012
@@ -0,0 +1,14 @@
+<div xmlns="http://www.w3.org/1999/xhtml"
+     xmlns:py="http://genshi.edgewall.org/"
+     xmlns:i18n="http://genshi.edgewall.org/i18n"
+     xmlns:xi="http://www.w3.org/2001/XInclude"
+  py:strip="" py:with="parts = page.name.split('/')">
+  <li>
+    <a title="View default wiki page" href="${href.wiki()}">wiki:</a>
+  </li>
+  <li py:for="idx, part in enumerate(parts)">
+    <a href="${href.wiki(*parts[:idx + 1])}"
+         title="${_('View %(path)s', path='/'.join(parts[:idx + 1]))}">${part}</a>
+    <span class="divider" py:if="idx != len(parts) - 1">/</span>
+  </li>
+</div>

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_wikipage.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_path_wikipage.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_view.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_view.html?rev=1335448&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_view.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_view.html Tue May  8 12:07:10 2012
@@ -0,0 +1,147 @@
+<!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:i18n="http://genshi.edgewall.org/i18n"
+      xmlns:xi="http://www.w3.org/2001/XInclude"
+      py:with="modify_perm = 'WIKI_MODIFY' in perm(page.resource);
+               admin_perm = 'WIKI_ADMIN' in perm(page.resource);
+               is_not_latest = page.exists and page.version != latest_version">
+  <xi:include href="layout.html" />
+  <head>
+    <title py:if="title">$title</title>
+    <meta py:if="version or page.author == 'trac'" name="ROBOTS" content="NOINDEX, NOFOLLOW" />
+    <link py:if="admin_perm or (not page.readonly and modify_perm)" rel="alternate" type="application/x-wiki"
+          href="${href.wiki(page.name, action='edit', version=page.version if is_not_latest else None)}"
+          title="${_('Revert page to this version') if is_not_latest else _('Edit this page')}"/>
+    <script type="text/javascript">
+      jQuery(document).ready(function($) {
+        $("#content").find("h1,h2,h3,h4,h5,h6").addAnchor(_("Link to this section"));
+        $("#content").find(".wikianchor").each(function() {
+          $(this).addAnchor(babel.format(_("Link to #%(id)s"), {id: $(this).attr('id')}));
+        });
+        $(".foldable").enableFolding(true, true);
+      });
+    </script>
+  </head>
+
+  <body>
+    <div id="content" class="wiki row">
+
+      <py:if test="version">
+        <br />
+        <table id="info" summary="Revision info">
+          <tbody>
+            <tr><th scope="row" i18n:msg="version, author, date">
+               Version $page.version (modified by ${authorinfo(page.author)}, ${pretty_dateinfo(page.time)})
+               (<a href="${href.wiki(page.name, action='diff', version=page.version)}">diff</a>)
+            </th></tr>
+            <tr><td xml:space="preserve">
+              <div class="alert alert-success">
+                ${wiki_to_html(context, page.comment or '--')}
+              </div>
+            </td></tr>
+          </tbody>
+        </table>
+      </py:if>
+
+      <div class="wikipage searchable span12" py:choose="" xml:space="preserve">
+        <py:when test="page.exists">
+          <?python
+            last_modification = (page.comment and
+                 _('Version %(version)s by %(author)s: %(comment)s',
+                   version=page.version, author=format_author(page.author), comment=page.comment) or
+                 _('Version %(version)s by %(author)s',
+                   version=page.version, author=format_author(page.author)))
+          ?>
+          <div py:if="not version" class="trac-modifiedby">
+            <span i18n:msg="reldate">
+              <a href="${href.wiki(page.name, action='diff', version=page.version)}"
+                 title="$last_modification">Last modified</a> ${pretty_dateinfo(page.time)}
+            </span>
+            <span class="trac-print" i18n:msg="date">Last modified on ${format_datetime(page.time)}</span>
+          </div>
+          <div id="wikipage" py:content="wiki_to_html(context, text)" />
+        </py:when>
+        <py:otherwise>
+          <p i18n:msg="name">The page ${name_of(page.resource)} does not exist. You can create it here.</p>
+          <py:if test="higher">
+            <p>You could also create the same page higher in the hierarchy:</p>
+            <ul>
+              <li py:for="markup in higher">${markup}</li>
+            </ul>
+          </py:if>
+        </py:otherwise>
+      </div>
+
+      <div class="span12">
+        <xi:include href="list_of_attachments.html"
+                  py:with="alist = attachments; compact = True; foldable = True"/>
+      </div>
+
+      <py:with vars="delete_perm = 'WIKI_DELETE' in perm(page.resource);
+                     rename_perm = 'WIKI_RENAME' in perm(page.resource)">
+        <div class="span12"
+            py:if="admin_perm or (not page.readonly and (modify_perm or delete_perm))">
+          <div class="btn-toolbar">
+            <form style="display:inline" method="get" action="${href.wiki(page.name)}" id="modifypage" py:if="modify_perm" >
+              <input type="hidden" name="action" value="edit" />
+              <input type="hidden" name="version" value="${page.version}"
+                  py:if="is_not_latest" />
+              <div class="btn-group">
+                <py:choose>
+                  <py:when test="is_not_latest">
+                    <input class="btn" type="submit" value="${_('Revert to this version')}"/>
+                  </py:when>
+                  <py:when test="page.exists">
+                    <input class="btn" type="submit" value="${_('Edit this page')}" accesskey="e" />
+                  </py:when>
+                  <py:otherwise>
+                    <input class="btn" type="submit" value="${_('Create this page')}" accesskey="e" />
+                    <div py:if="templates" id="template" style="display:inline">
+                      <label for="template">Using the template:</label>
+                      <select name="template">
+                        <option selected="${not default_template in templates or None}"
+                                value="">(blank page)</option>
+                        <option py:for="t in sorted(templates)" value="$t"
+                                selected="${t == default_template or None}">$t</option>
+                      </select>
+                    </div>
+                  </py:otherwise>
+                </py:choose>
+              </div>
+            </form>
+            <py:if test="page.exists">
+              <xi:include href="bh_attach_file_form.html" py:with="alist = attachments"/>
+            </py:if>
+            <form method="get" style="display:inline" action="${href.wiki(page.name)}" id="rename" py:if="page.exists and rename_perm">
+              <input type="hidden" name="action" value="rename" />
+              <div class="btn-group">
+                <input class="btn btn-warning" type="submit" value="${_('Rename page')}" />
+              </div>
+            </form>
+            <form method="get" style="display:inline" action="${href.wiki(page.name)}" py:if="page.exists and delete_perm">
+              <input type="hidden" name="action" value="delete" />
+              <input type="hidden" name="version" value="$page.version" />
+              <div id="delete" class="btn-group">
+                <py:if test="page.version == latest_version">
+                  <input class="btn btn-danger" type="submit" name="delete_version" value="${_('Delete this version')}" />
+                </py:if>
+                <input class="btn btn-danger" type="submit" value="${_('Delete page')}" />
+              </div>
+            </form>
+          </div>
+        </div>
+      </py:with>
+
+      <div class="wikipage searchable span12" py:if="not page.exists and related">
+        <p>The following pages have a name similar to this page, and may be related:</p>
+        <ul>
+          <li py:for="markup in related">${markup}</li>
+        </ul>
+      </div>
+
+    </div>
+  </body>
+</html>

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_view.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_view.html
------------------------------------------------------------------------------
    svn:mime-type = text/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=1335448&r1=1335447&r2=1335448&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Tue May  8 12:07:10 2012
@@ -95,6 +95,7 @@ class BloodhoundTheme(ThemeBase):
 
         # Wiki
         'wiki_edit.html' : ('bh_wiki_edit.html', None),
+        'wiki_view.html' : ('bh_wiki_view.html', '_modify_wiki_page_path'),
     }
 
     implements(IRequestFilter)
@@ -147,6 +148,12 @@ class BloodhoundTheme(ThemeBase):
             # Context nav
             prevnext_nav(req, _('Previous'), _('Next'))
 
+    def _modify_wiki_page_path(self, req, template, data, content_type, is_active):
+        """Override wiki breadcrumbs nav items
+        """
+        if is_active:
+            data['resourcepath_template'] = 'bh_path_wikipage.html'
+
 class QuickCreateTicketDialog(Component):
     implements(IRequestFilter, IRequestHandler)