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:00:39 UTC

svn commit: r1335445 - in /incubator/bloodhound/trunk/bloodhound_theme/bhtheme: htdocs/bloodhound.css templates/bh_wiki_edit.html templates/bh_wiki_edit_form.html theme.py

Author: gjm
Date: Tue May  8 12:00:38 2012
New Revision: 1335445

URL: http://svn.apache.org/viewvc?rev=1335445&view=rev
Log:
theme: fixing side by side edit - towards #41 (from olemis)

Added:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_edit.html   (with props)
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_edit_form.html   (with props)
Modified:
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css
    incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py

Modified: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css?rev=1335445&r1=1335444&r2=1335445&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/htdocs/bloodhound.css Tue May  8 12:00:38 2012
@@ -261,6 +261,20 @@ h1, h2, h3, h4 {
 
 /* @end */
 
+/* @group Inherited wiki styles */
+
+.wiki #preview {
+ background: #f8f8f8 url(../common/draft.png);
+ margin: 1em 0 2em;
+ overflow: auto;
+}
+
+.wiki #preview .wikipage {
+ padding: 0.8em 0px;
+}
+
+/* @end */
+
 /* @group Search */
 
 #results .author,

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_edit.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_edit.html?rev=1335445&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_edit.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_edit.html Tue May  8 12:00:38 2012
@@ -0,0 +1,176 @@
+<!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:xi="http://www.w3.org/2001/XInclude"
+      xmlns:py="http://genshi.edgewall.org/"
+      xmlns:i18n="http://genshi.edgewall.org/i18n">
+  <xi:include href="layout.html" />
+
+  <!--! Note: the wiki edit page can be presented according to several modes:
+
+        - "standard" or "side  by side" edit mode (`sidebyside` is true in the second mode)
+          In standard mode, the edit area is on top of the preview, in side by side mode
+          there are next to each other.
+
+        - "edit" or "edit+preview" mode (`action == 'preview'` is true in the second mode)
+          In edit mode, only the textarea is visible, but not the preview.
+          In sidebyside mode, we always have a preview.
+          In this category, we also have the "collision mode" (`action == 'collision'`),
+          which happens when a concurrent edit has been detected.
+
+        - "wiki preview" or "diff preview" (`diff` is true in the second mode)
+          When the preview is shown, it can be either an actual preview of the rendered wiki
+          text, or it can be a diff view on the changes that have been made (a.k.a. "review mode").
+          In the latter case, `changes[0].diffs` contains the data for the diffs, if any.
+          See `preview_or_review` below.
+    -->
+  <head>
+    <title>$title</title>
+    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
+    <script type="text/javascript">
+      jQuery(document).ready(function($) {
+        $("#text").blur(function() {
+          $("#scroll_bar_pos").val(this.scrollTop);
+        }).get(0).scrollTop = $("#scroll_bar_pos").val();
+        $("#editrows").change(function() {
+          resizeTextArea("text", this.options[this.selectedIndex].value);
+        });
+        <py:if test="not sidebyside and (action == 'preview' or diff)">
+          $("#info").scrollToTop();
+        </py:if>
+        <py:if test="sidebyside">
+          function autoResizeText() {
+            var preview_height = $("#preview").height();
+            if (preview_height)
+              $("#text").height(preview_height + 15);
+          }
+          autoResizeText();
+          $(window).resize(autoResizeText);
+        </py:if>
+        <py:if test="sidebyside and not diff">
+          $("#text").autoPreview("${href.wiki_render()}", {
+              realm: "${page.resource.realm}", id: "${page.resource.id}"
+            }, function(textarea, text, rendered) {
+              $("#preview div.wikipage").html(rendered);
+              autoResizeText();
+          });
+        </py:if>
+        $(".foldable").enableFolding(true, true);
+      });
+    </script>
+  </head>
+
+  <body>
+    <div id="content" class="wiki row"
+         py:with="preview_or_review = action == 'preview' and (not diff or changes[0].diffs)">
+      <div class="trac-topnav span12" py:if="sidebyside or preview_or_review" py:choose="">
+        <a py:when="sidebyside" href="#changeinfo"
+           title="Go to Save, Preview, Review or Cancel buttons">Actions</a>
+        <a py:when="diff" href="#info" title="See the diffs">Review</a>
+        <a py:otherwise="" href="#info" title="See the preview">Preview</a>
+        &darr;
+      </div>
+      <h1 i18n:msg="name">Editing ${name_of(page.resource)}</h1>
+      <div py:if="merge" class="system-message span12">
+        <div class="alert">
+          <p>
+          <span class="label label-important">Important</span>
+          Someone else has modified that page since you started your edits.</p><br />
+          <p i18n:msg=""><strong>If you save right away, you risk to revert those changes
+          (highlighted below as deletions).</strong></p><br />
+          <p i18n:msg="">Please review all those changes and manually merge them with your
+          own changes. <br />
+          If you're unsure about what you're doing, please press <tt>Cancel</tt>
+          (losing your changes) and start editing the latest version of the page
+          again.</p>
+        </div>
+      </div>
+
+      <!--/p!
+
+      Normal preview mode, edit form followed by preview:
+
+       | [xi:include "bh_wiki_edit_form.html"                  ]
+       |
+       | == Preview ==
+       |
+       | [.Revision #info...................................]
+       |
+       | [.....#preview.....................................]
+
+
+      Side-by-side edit/preview mode:
+
+       | [.Revision #info...................................]
+       |
+       | == Preview ==
+       |                               [......#preview......]
+       | [xi:include "bh_wiki_edit_form.html"]
+
+      (the  #preview will float at the right of the edit form's textarea)
+
+      -->
+      <div class="span12" py:if="not sidebyside">
+        <xi:include href="bh_wiki_edit_form.html" />
+      </div>
+      <py:choose test="action">
+        <py:when test="'preview'">
+          <div class="span12">
+            <table id="info" summary="Revision info">
+              <tbody>
+                <tr><th scope="col" i18n:msg="version, author">
+                  Change information for future version ${page.version+1} (modified by $author):
+                </th></tr>
+                <tr><td class="message" xml:space="preserve">
+                  ${wiki_to_html(context.child(page.resource(version=None)), comment)}
+                </td></tr>
+              </tbody>
+            </table>
+          </div>
+          <div class="span6" py:if="sidebyside">
+            <xi:include href="bh_wiki_edit_form.html" />
+          </div>
+          <div class="${sidebyside and 'sidebyside preview-right span6' or 'span12'}"
+              py:choose="">
+            <div class="trac-nav" py:if="not sidebyside and preview_or_review">
+              <a href="#content" title="Go to the editor">Edit</a> &uarr;
+            </div>
+            <h2 py:choose="">
+              <py:when test="preview_or_review and diff">Review Changes</py:when>
+              <py:when test="preview_or_review">Preview</py:when>
+              <py:otherwise>No changes</py:otherwise>
+            </h2>
+            <div id="preview">
+              <div py:when="diff" class="diff">
+                <xi:include href="diff_div.html" py:with="no_id=True" />
+              </div>
+              <div py:otherwise="" class="wikipage" xml:space="preserve">
+                ${wiki_to_html(context.child(page.resource), page.text)}
+              </div>
+            </div>
+            <div py:if="not sidebyside and page.text" class="trac-nav">
+              <a href="#changeinfo"
+                title="Go to Save, Preview, Review or Cancel buttons">Actions</a> &uarr;
+            </div>
+          </div>
+        </py:when>
+        <py:when test="'collision'">
+          <div class="span12">
+            <div class="alert alert-error">
+              <span class="label label-important">Oops !</span>
+              Sorry, this page has been modified by somebody else since you started
+              editing. Your changes cannot be saved.
+            </div>
+          </div>
+          <div class="span12">
+            <xi:include href="bh_wiki_edit_form.html" />
+          </div>
+        </py:when>
+      </py:choose>
+      
+      <xi:include href="list_of_attachments.html"
+                  py:with="alist = attachments; compact = True; foldable = True"/>
+    </div>
+  </body>
+</html>

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

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

Added: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_edit_form.html
URL: http://svn.apache.org/viewvc/incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_edit_form.html?rev=1335445&view=auto
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_edit_form.html (added)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_edit_form.html Tue May  8 12:00:38 2012
@@ -0,0 +1,89 @@
+<!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" py:strip="">
+  <form id="edit" action="${href.wiki(page.name)}" method="post">
+    <fieldset class="iefix control-group">
+      <input type="hidden" name="from_editor" value="1" />
+      <input type="hidden" name="action" value="edit" />
+      <input type="hidden" name="version" value="$page.version" />
+      <input type="hidden" id="scroll_bar_pos" name="scroll_bar_pos"
+             value="$scroll_bar_pos" />
+      <div id="rows">
+        <py:if test="not sidebyside">
+          <label for="editrows">Adjust edit area height:</label>
+          <select size="1" name="editrows" id="editrows" tabindex="43">
+            <option py:for="rows in range(8, 42, 4)" value="$rows"
+                    selected="${str(rows) == edit_rows or None}">
+              $rows
+            </option>
+          </select>
+        </py:if>
+        <span class="pull-right">
+          <label for="sidebyside" title="Selecting and pressing 'Preview' enters a two-column [edit|preview] mode">
+            Edit side-by-side
+          </label>
+          <input type="checkbox" name="sidebyside" id="sidebyside" checked="$sidebyside" />
+        </span>
+        <br/>
+      </div>
+      <p><textarea id="text" class="wikitext${' trac-resizable' if not sidebyside else None}"
+                   name="text" rows="${max(edit_rows, 10)}" style="width:100%; min-width:50%; max-width:100%">
+$page.text</textarea>
+      </p>
+      <div id="help-block pull-right" i18n:msg="">
+        <span class="label label-info">Note</span>
+        See <a href="${href.wiki('WikiFormatting')}">WikiFormatting</a> and
+        <a href="${href.wiki('TracWiki')}">TracWiki</a> for help on editing wiki content.
+      </div>
+    </fieldset>
+    <div class="trac-nav" py:if="sidebyside" py:choose="">
+      <a py:when="diff" href="#content" title="See the start of the diffs">Review</a>
+      <a py:otherwise="" href="#content" title="See the start of the preview">Preview</a>
+      &uarr;
+    </div>
+    <div class="well">
+      <fieldset id="changeinfo">
+        <legend>Change information</legend>
+        <div id="changeinfo1">
+          <div py:if="authname == 'anonymous'" class="field">
+            <label>Your email or username:<br />
+              <input id="author" type="text" name="author" size="30" value="$author" />
+            </label>
+            <p py:if="author == 'anonymous'" class="hint">
+              <i18n:msg>E-mail address and user name can be saved in the <a href="${href.prefs()}">Preferences</a>.</i18n:msg>
+            </p>
+          </div>
+          <div class="field">
+            <label>Comment about this change (optional):<br />
+              <input id="comment" type="text" name="comment" size="60" value="$comment" />
+            </label>
+          </div>
+        </div>
+        <div py:if="'WIKI_ADMIN' in perm(page.resource)" id="changeinfo2" class="options">
+          <label><input type="checkbox" name="readonly" id="readonly"
+                        checked="${page.readonly or None}" />
+            Page is read-only
+          </label>
+        </div>
+      </fieldset>
+    </div>
+    <div class="btn-toolbar buttons">
+      <div class="btn-group" py:choose="action">
+        <py:when test="'collision'">
+          <input class="btn" type="submit" name="preview" value="${_('Preview')}" disabled="disabled" />&nbsp;
+          <input class="btn" type="submit" name="merge" value="${_('Merge changes')}" accesskey="r" />&nbsp;
+          <input class="btn" type="submit" name="save" value="${_('Submit changes')}" disabled="disabled" />&nbsp;
+        </py:when>
+        <py:otherwise>
+          <input class="btn" type="submit" name="preview" value="${_('Preview Page')}" accesskey="p" />&nbsp;
+          <input class="btn" type="submit" name="diff" value="${_('Review Changes')}" accesskey="r" />&nbsp;
+          <input class="btn" type="submit" id="save" name="save" value="${_('Submit changes')}" />&nbsp;
+        </py:otherwise>
+      </div>
+      <input class="btn btn-inverse" type="submit" name="cancel" value="${_('Cancel')}" />
+    </div>
+  </form>
+</html>

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

Propchange: incubator/bloodhound/trunk/bloodhound_theme/bhtheme/templates/bh_wiki_edit_form.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=1335445&r1=1335444&r2=1335445&view=diff
==============================================================================
--- incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py (original)
+++ incubator/bloodhound/trunk/bloodhound_theme/bhtheme/theme.py Tue May  8 12:00:38 2012
@@ -92,7 +92,11 @@ class BloodhoundTheme(ThemeBase):
 
         # Search
         'search.html' : ('bh_search.html', '_modify_search_data'),
+
+        # Wiki
+        'wiki_edit.html' : ('bh_wiki_edit.html', None),
     }
+
     implements(IRequestFilter)
 
     # IRequestFilter methods