<!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>[301] sites/trunk/wordpress.org/public_html/style/trac: Trac: Add initial support for 'focuses'.</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/301">301</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2014-01-21 00:31:09 +0000 (Tue, 21 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Trac: Add initial support for 'focuses'. These are a cross between a component and a keyword. Disabled for now - see <a href="http://meta.trac.wordpress.org/ticket/287">#287</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlstyletracwptraccss">sites/trunk/wordpress.org/public_html/style/trac/wp-trac.css</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlstyletracwptracjs">sites/trunk/wordpress.org/public_html/style/trac/wp-trac.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlstyletracwptraccss"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/style/trac/wp-trac.css (300 => 301)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/style/trac/wp-trac.css     2014-01-20 19:10:48 UTC (rev 300)
+++ sites/trunk/wordpress.org/public_html/style/trac/wp-trac.css        2014-01-21 00:31:09 UTC (rev 301)
</span><span class="lines">@@ -1100,11 +1100,10 @@
</span><span class="cx">  border-bottom: 0;
</span><span class="cx"> }
</span><span class="cx"> #edit-keywords {
</span><del>-       float: right;
</del><span class="cx">   cursor: pointer;
</span><span class="cx">  font-size: 8px;
</span><span class="cx">  color: #999;
</span><del>-       margin: 6px 6px 0 0;
</del><ins>+        margin: 6px 6px 0 6px;
</ins><span class="cx"> }
</span><span class="cx"> #keyword-bin span a:hover {
</span><span class="cx">  background-position: -10px 0;
</span><span class="lines">@@ -1121,6 +1120,50 @@
</span><span class="cx">  text-align: right;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/* =Focuses */
+#properties table td#focuses {
+       padding: .6em 0 .3em;
+       height: 66px;
+}
+#focuses span {
+       float: left;
+}
+#focuses ul {
+       float: left;
+       width: 356px;
+       margin: 0;
+       padding: 0;
+       list-style: none;
+}
+#focuses li {
+       font-size: 12px;
+       display: inline-block;
+       float: left;
+       margin: 0 0 6px 6px;
+       border-radius: 3px;
+       background: #eee;
+       color: #aaa;
+}
+#focuses a {
+       display: inline-block;
+       padding: 4px 7px;
+       color: inherit;
+       border-radius: 3px;
+       background: inherit;
+       text-decoration: none;
+       border-bottom: none;
+}
+#focuses li:hover,
+#focuses a:focus {
+       color: #000;
+       cursor: pointer;
+}
+#focuses li.active,
+#focuses li.active a:focus {
+       background: #666;
+       color: #fff;
+}
+
</ins><span class="cx"> /*
</span><span class="cx">  * Workaround for Trac bug.
</span><span class="cx">  * See â€‹http://trac.edgewall.org/ticket/10751
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlstyletracwptracjs"></a>
<div class="modfile"><h4>Modified: sites/trunk/wordpress.org/public_html/style/trac/wp-trac.js (300 => 301)</h4>
<pre class="diff"><span>
<span class="info">--- sites/trunk/wordpress.org/public_html/style/trac/wp-trac.js      2014-01-20 19:10:48 UTC (rev 300)
+++ sites/trunk/wordpress.org/public_html/style/trac/wp-trac.js 2014-01-21 00:31:09 UTC (rev 301)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-var wpTrac, coreKeywordList, gardenerKeywordList;
</del><ins>+var wpTrac, coreKeywordList, gardenerKeywordList, coreFocusesList;
</ins><span class="cx"> 
</span><span class="cx"> (function($){
</span><span class="cx"> 
</span><span class="lines">@@ -26,6 +26,19 @@
</span><span class="cx">          'good-first-bug': 'This ticket is great for a new contributor to work on, generally because it is easy or well-contained.'
</span><span class="cx">  };
</span><span class="cx"> 
</span><ins>+       coreFocusesList = {
+               'ui' : 'UI or design related.',
+               'javascript' : 'Heavy JavaScript focus.',
+               // 'accessibility' : 'Accessibility focus.',
+               'unit tests' : 'PHP or JS unit tests.',
+               'docs' : 'Documentation focus.',
+               'rtl' : 'Right-to-left languages.',
+               'administration' : 'Dashboard related, but assigned a more specifc component.',
+               'template' : 'Relating to theme template functions, but assigned a more specific component.',
+               'performance' : 'Performance or caching (but not the Cache API component).',
+               // 'multisite' : 'Relating to multisite, but assigned a more specific component.'
+       };
+
</ins><span class="cx">   gardenerKeywordList = [ 'commit', 'early', 'i18n-change' ];
</span><span class="cx"> 
</span><span class="cx">  wpTrac = {
</span><span class="lines">@@ -356,9 +369,8 @@
</span><span class="cx">                                  // If the owner field exists, then we're on /newticket. Remove it.
</span><span class="cx">                                  $('#field-owner').parents('tr').remove();
</span><span class="cx"> 
</span><del>-                                       html = '<a id="edit-keywords">manual</a>';
-                                       html += '<div><label id="keyword-label" for="keyword-add" style="width:' + labelWidth + 'px">Workflow Keywords:</label>';
-                                       html += '<select id="keyword-add"><option value=""> - Add - </option></select></div>';
</del><ins>+                                        html = '<div><label id="keyword-label" for="keyword-add" style="width:' + labelWidth + 'px">Workflow Keywords:</label>';
+                                       html += '<select id="keyword-add"><option value=""> - Add - </option></select> <a id="edit-keywords">manual</a></div>';
</ins><span class="cx">                                   html += '<div id="keyword-bin"></div>';
</span><span class="cx">                                  container.prepend( html );
</span><span class="cx">                                  elements.bin = $('#keyword-bin');
</span><span class="lines">@@ -379,7 +391,7 @@
</span><span class="cx">                                          elements.bin.empty();
</span><span class="cx"> 
</span><span class="cx">                                  // Replace commas, collapse spaces, trim, then split by space.
</span><del>-                                       keywords = $.trim( elements.hiddenEl.val().replace(',', ' ').replace(/ +/g, ' ') ).split(' ');
</del><ins>+                                        keywords = $.trim( elements.hiddenEl.val().replace(/,/g, ' ').replace(/ +/g, ' ') ).split(' ');
</ins><span class="cx"> 
</span><span class="cx">                                  // Put our cleaned up version back into the hidden field.
</span><span class="cx">                                  elements.hiddenEl.val( keywords.join(' ') );
</span><span class="lines">@@ -396,7 +408,7 @@
</span><span class="cx"> 
</span><span class="cx">                                  // Populate the dropdown.
</span><span class="cx">                                  if ( elements.add ) {
</span><del>-                                               elements.add.empty();
</del><ins>+                                                elements.add.children().not('[value=""]').remove();
</ins><span class="cx">                                   } else {
</span><span class="cx">                                          elements.add = $('#keyword-add');
</span><span class="cx">                                  }
</span><span class="lines">@@ -477,6 +489,103 @@
</span><span class="cx">                  }
</span><span class="cx">          }()),
</span><span class="cx"> 
</span><ins>+               focuses: (function() {
+                       var field, container, focuses, originalFocuses;
+
+                       function init() {
+                               var ul, classes;
+                               if ( typeof coreFocusesList === 'undefined' ) {
+                                       return;
+                               }
+
+                               field = $( '#field-focuses' );
+                               if ( field.length === 0 ) {
+                                       return;
+                               }
+                               $('label[for="field-focuses"]').parent().remove();
+                               field.parent().attr({ colspan: 2, id: 'focuses' });
+                               field.hide();
+
+                               focuses = $.trim( field.val().replace(/,/g, ' ').replace(/ +/g, ' ') );
+                               if ( focuses.length === 0 ) {
+                                       focuses = [];
+                               } else {
+                                       focuses = focuses.split( ' ' );
+                               }
+                               originalFocuses = $.merge( [], focuses );
+
+                               container = $( '#focuses' );
+                               container.append( '<span>Focuses:</span>' );
+                               ul = $( '<ul />' );
+                               $.each( coreFocusesList, function( focus, description ) {
+                                       classes = focus.replace( ' ', '-' );
+                                       if ( -1 !== $.inArray( focus, focuses ) ) {
+                                               classes += ' active';
+                                       }
+                                       ul.append( $( '<li />', {
+                                               'data-focus' : focus,
+                                               title: description,
+                                               class: classes
+                                       } ).html( '<a href="#">' + focus + '</a>' ) );
+                               });
+                               ul.appendTo( container );
+
+                               container.on( 'click', 'a', addRemove );
+                               container.closest( 'form' ).on( 'submit', submit );
+                       }
+
+                       function addRemove() {
+                               var focus = $( this ).parent();
+                               if ( focus.hasClass( 'active' ) ) {
+                                       remove( focus );
+                               } else {
+                                       add( focus );
+                               }
+                               return false;
+                       }
+
+                       function add( focus ) {
+                               focus.addClass( 'active' );
+                               focuses.push( focus.data( 'focus' ) );
+                               updateField();
+                       }
+
+                       function remove( focus ) {
+                               focus.removeClass( 'active' );
+                               var remove = focus.data( 'focus' );
+                               focuses = $.grep( focuses, function( value ) {
+                                       return value != remove;
+                               } );
+                               updateField();
+                       }
+
+                       function updateField() {
+                               var orderedFocuses = [];
+                               $.each( coreFocusesList, function( focus ) {
+                                       if ( -1 !== $.inArray( focus, focuses ) ) {
+                                               orderedFocuses.push( focus );
+                                       }
+                               });     
+                               field.val( orderedFocuses.join( ', ' ) );
+                       }
+
+                       function submit() {
+                               if ( focuses.length !== originalFocuses.length )
+                                       return;
+                               var testFocuses = $.grep( focuses, function(v) {
+                                       return -1 === $.inArray( v, originalFocuses );
+                               });
+                               // If the difference has no length, then restore to the original order.
+                               if ( ! testFocuses.length ) {
+                                       field.val( originalFocuses.join( ', ' ) );
+                               }
+                       }
+
+                       return {
+                               init: init
+                       };
+               }()),
+
</ins><span class="cx">           notifications: (function() {
</span><span class="cx">                  var notifications, endpoint, _ticket;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>