<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[412] sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base: WordCamp Base: Add support for responsive menus.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://meta.trac.wordpress.org/changeset/412">412</a></dd>
<dt>Author</dt> <dd>iandunn</dd>
<dt>Date</dt> <dd>2014-02-21 19:01:42 +0000 (Fri, 21 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>WordCamp Base: Add support for responsive menus. props r3df. Fixes <a href="http://meta.trac.wordpress.org/ticket/358">#358</a>.

This does include the CSS rules to show the responsive menu on smaller devices by default, it just adds the necessary menu element and toggle script so that a WordCamp can use the Custom CSS module to make their site fully responsive.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentthemeswordcampbaseheaderphp">sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/header.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentthemeswordcampbaselibstructureclasswcbmenuphp">sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/lib/structure/class-wcb-menu.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentthemeswordcampbasestylecss">sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/style.css</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/lib/navigation/</li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentthemeswordcampbaselibnavigationnavigationjs">sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/lib/navigation/navigation.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentthemeswordcampbaseheaderphp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/header.php (411 => 412)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/header.php  2014-02-20 23:12:10 UTC (rev 411)
+++ sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/header.php     2014-02-21 19:01:42 UTC (rev 412)
</span><span class="lines">@@ -22,6 +22,9 @@
</span><span class="cx">  if ( is_singular() && get_option( 'thread_comments' ) )
</span><span class="cx">          wp_enqueue_script( 'comment-reply' );
</span><span class="cx"> 
</span><ins>+       // Adds JavaScript for handling the navigation menu hide-and-show behavior to allow responsive menus.
+       wp_enqueue_script( 'wordcamp-base-navigation', get_template_directory_uri() . '/lib/navigation/navigation.js', array(), '1.0', true );
+
</ins><span class="cx">   /* Always have wp_head() just before the closing </head>
</span><span class="cx">   * tag of your theme, or you will break many plugins, which
</span><span class="cx">   * generally use this hook to add elements to <head> such
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentthemeswordcampbaselibnavigationnavigationjs"></a>
<div class="addfile"><h4>Added: sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/lib/navigation/navigation.js (0 => 412)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/lib/navigation/navigation.js                                (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/lib/navigation/navigation.js   2014-02-21 19:01:42 UTC (rev 412)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+/**
+ * navigation.js
+ *
+ * Handles toggling the navigation menu for small screens.
+ */
+( function() {
+       var nav = document.getElementById( 'access' ), button, menu;
+       if ( ! nav )
+               return;
+       button = nav.getElementsByTagName( 'h3' )[0];
+       menu   = nav.getElementsByTagName( 'ul' )[0];
+       if ( ! button )
+               return;
+
+       // Hide button if menu is missing or empty.
+       if ( ! menu || ! menu.childNodes.length ) {
+               button.style.display = 'none';
+               return;
+       }
+
+       button.onclick = function() {
+               if ( -1 == menu.className.indexOf( 'menu' ) )
+                       menu.className = 'menu';
+
+               if ( -1 != button.className.indexOf( 'toggled-on' ) ) {
+                       button.className = button.className.replace( ' toggled-on', '' );
+                       menu.className = menu.className.replace( ' toggled-on', '' );
+               } else {
+                       button.className += ' toggled-on';
+                       menu.className += ' toggled-on';
+               }
+       };
+} )();
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentthemeswordcampbaselibstructureclasswcbmenuphp"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/lib/structure/class-wcb-menu.php (411 => 412)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/lib/structure/class-wcb-menu.php    2014-02-20 23:12:10 UTC (rev 411)
+++ sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/lib/structure/class-wcb-menu.php       2014-02-21 19:01:42 UTC (rev 412)
</span><span class="lines">@@ -8,6 +8,8 @@
</span><span class="cx">  function content() { ?>
</span><span class="cx">          <div id="<?php echo $this->get_id(); ?>" class="grid_12">
</span><span class="cx">                  <div id="access" role="navigation" class="clearfix">
</span><ins>+                               <?php /* Toggle element for responsive menus */ ?>
+                               <h3 class="menu-toggle"><?php _e( 'Menu', 'wordcampbase' ); ?></h3>
</ins><span class="cx">                           <?php /*  Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
</span><span class="cx">                          <div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'wordcampbase' ); ?>"><?php _e( 'Skip to content', 'wordcampbase' ); ?></a></div>
</span><span class="cx">                          <?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu.  The menu assiged to the primary position is the one used.  If none is assigned, the menu with the lowest ID is used.  */ ?>
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentthemeswordcampbasestylecss"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/style.css (411 => 412)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/style.css   2014-02-20 23:12:10 UTC (rev 411)
+++ sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-base/style.css      2014-02-21 19:01:42 UTC (rev 412)
</span><span class="lines">@@ -375,6 +375,9 @@
</span><span class="cx">  margin: 0 auto;
</span><span class="cx">  width: 940px;
</span><span class="cx"> }
</span><ins>+#access .menu-toggle {
+       display: none;
+}
</ins><span class="cx"> #access .menu-header,
</span><span class="cx"> div.menu {
</span><span class="cx">  font-size: 13px;
</span></span></pre>
</div>
</div>

</body>
</html>