Author: crossley
Date: Wed Nov 25 01:56:25 2015
New Revision: 1716292

URL: http://svn.apache.org/viewvc?rev=1716292&view=rev
Log:
Backported the feature from the "scales" skin to the "pelt" skin for the 
"Conditional display of menuitems". Enabled via site.xml using the attribute 
type=showWhenSelected.
Issue: FOR-1255

Modified:
    
forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-c/showonlywhenselected/page1.xml
    
forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-c/showonlywhenselected/page2.xml
    forrest/trunk/main/webapp/skins/new-skin-names.txt
    forrest/trunk/main/webapp/skins/pelt/xslt/html/book-to-menu.xsl
    forrest/trunk/site-author/status.xml

Modified: 
forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-c/showonlywhenselected/page1.xml
URL: 
http://svn.apache.org/viewvc/forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-c/showonlywhenselected/page1.xml?rev=1716292&r1=1716291&r2=1716292&view=diff
==============================================================================
--- 
forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-c/showonlywhenselected/page1.xml
 (original)
+++ 
forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-c/showonlywhenselected/page1.xml
 Wed Nov 25 01:56:25 2015
@@ -24,8 +24,8 @@
     <section>
       <title>Always Visible</title>
       <note>
-        This feature requires the use of the 'scales'-skin. Used in any other
-        skin, both pages will show normally.
+        This feature requires the use of the 'pelt' skin (or the 'scales' 
skin).
+        Used in any other skin, both pages will show normally.
       </note>
       <p>
         This page is always visible and just another Forrest document.

Modified: 
forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-c/showonlywhenselected/page2.xml
URL: 
http://svn.apache.org/viewvc/forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-c/showonlywhenselected/page2.xml?rev=1716292&r1=1716291&r2=1716292&view=diff
==============================================================================
--- 
forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-c/showonlywhenselected/page2.xml
 (original)
+++ 
forrest/trunk/main/fresh-site/src/documentation/content/xdocs/samples-c/showonlywhenselected/page2.xml
 Wed Nov 25 01:56:25 2015
@@ -24,16 +24,16 @@
     <section>
       <title>Conditionally visible</title>
       <note>
-        This feature requires the use of the 'scales'-skin. Used in any other
-        skin, both pages will show normally.
+        This feature requires the use of the 'pelt' skin (or the 'scales' 
skin).
+        Used in any other skin, both pages will show normally.
       </note>
       <p>
         This page will only become visible on the menu when it is already the
         current page. Since it doesn't normally appear on the menu, this can
-        only happen, if you link to it from another page or from another site.
+        only happen if you link to it from another page or from another site.
       </p>
       <p>
-        Open another page by menu-selection or follwing a
+        Open another page by menu-selection or following a
         <a href="page1.html">link</a> to make this page disappear from this
         menu.
       </p>

Modified: forrest/trunk/main/webapp/skins/new-skin-names.txt
URL: 
http://svn.apache.org/viewvc/forrest/trunk/main/webapp/skins/new-skin-names.txt?rev=1716292&r1=1716291&r2=1716292&view=diff
==============================================================================
--- forrest/trunk/main/webapp/skins/new-skin-names.txt (original)
+++ forrest/trunk/main/webapp/skins/new-skin-names.txt Wed Nov 25 01:56:25 2015
@@ -21,7 +21,7 @@ and get the name that comes out.
 11 dermis
 12 corium -> taken
 13 calyx
-14 scale -> taken
+14 scales -> taken
 15 leather -> taken
 16 patina
 17 crust -> taken

Modified: forrest/trunk/main/webapp/skins/pelt/xslt/html/book-to-menu.xsl
URL: 
http://svn.apache.org/viewvc/forrest/trunk/main/webapp/skins/pelt/xslt/html/book-to-menu.xsl?rev=1716292&r1=1716291&r2=1716292&view=diff
==============================================================================
--- forrest/trunk/main/webapp/skins/pelt/xslt/html/book-to-menu.xsl (original)
+++ forrest/trunk/main/webapp/skins/pelt/xslt/html/book-to-menu.xsl Wed Nov 25 
01:56:25 2015
@@ -37,6 +37,35 @@ details.
       </ul></li>
   </xsl:template>
   <xsl:template match="menu-item[@type='hidden']"/>
+<!-- 
+       Show menu-items of this type only when the referenced page
+       is currently open.
+       Added to maintain context without having to show all pages always on 
the menu.
+   -->
+  <xsl:template match="menu-item[@type='showWhenSelected']">
+<!-- Use apply-imports when overriding -->
+    <xsl:variable name="href-nofrag">
+      <xsl:call-template name="path-nofrag">
+        <xsl:with-param name="path" select="@href" />
+      </xsl:call-template>
+    </xsl:variable>
+<!-- Compare with extensions stripped -->
+    <xsl:variable name="node-path">
+      <xsl:call-template name="normalize">
+        <xsl:with-param name="path" select="concat($dirname, $href-nofrag)" />
+      </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="$node-path = $path-nofrag">
+      <li><xsl:choose>
+          <xsl:when test="contains(@href, '#')">
+            <xsl:call-template name="selected-anchor" />
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:call-template name="selected" />
+          </xsl:otherwise>
+        </xsl:choose></li>
+    </xsl:if>
+  </xsl:template>
   <xsl:template match="menu-item">
     <li><xsl:apply-imports/></li>
   </xsl:template>

Modified: forrest/trunk/site-author/status.xml
URL: 
http://svn.apache.org/viewvc/forrest/trunk/site-author/status.xml?rev=1716292&r1=1716291&r2=1716292&view=diff
==============================================================================
--- forrest/trunk/site-author/status.xml (original)
+++ forrest/trunk/site-author/status.xml Wed Nov 25 01:56:25 2015
@@ -155,6 +155,12 @@
       </action>
 <!-- 2015-## -->
 <!-- 2015-11 -->
+      <action context="code" type="add" dev="DC" fixes-bug="FOR-1255">
+        Backported the feature from the "scales" skin to the "pelt" skin for
+        the "Conditional display of menuitems". Enabled via site.xml using
+        the attribute type=showWhenSelected. See the demonstration in the
+        "seed-sample" site.
+      </action>
       <action context="code" type="add" dev="DC">
         Added a reader and a serializer for JSON.
       </action>