<!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>[27636] trunk/src/wp-admin: Theme installer:</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://core.trac.wordpress.org/changeset/27636">27636</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2014-03-20 04:19:55 +0000 (Thu, 20 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Theme installer:
 * Restore the feature filter.
 * Improve responsiveness.
 * Router updates, fixes.
 * Make "Upload Theme" button more consistent with the admin.
 * Avoid theme-count causing filters to jump.

props matveb.
see <a href="http://core.trac.wordpress.org/ticket/27055">#27055</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincssthemescss">trunk/src/wp-admin/css/themes.css</a></li>
<li><a href="#trunksrcwpadminjsthemejs">trunk/src/wp-admin/js/theme.js</a></li>
<li><a href="#trunksrcwpadminthemeinstallphp">trunk/src/wp-admin/theme-install.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincssthemescss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/themes.css (27635 => 27636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/themes.css        2014-03-20 02:58:48 UTC (rev 27635)
+++ trunk/src/wp-admin/css/themes.css   2014-03-20 04:19:55 UTC (rev 27636)
</span><span class="lines">@@ -169,9 +169,9 @@
</span><span class="cx">  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
</span><span class="cx">  opacity: 0;
</span><span class="cx">  position: absolute;
</span><del>-               top: 35%;
-               right: 25%;
-               left: 25%;
</del><ins>+        top: 35%;
+       right: 25%;
+       left: 25%;
</ins><span class="cx">   background: #222;
</span><span class="cx">  background: rgba(0,0,0,0.7);
</span><span class="cx">  color: #fff;
</span><span class="lines">@@ -1065,9 +1065,6 @@
</span><span class="cx">   16.2 - Install Themes
</span><span class="cx"> ------------------------------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-.theme-install-php h2 .upload {
-       margin-left: 10px;
-}
</del><span class="cx"> .theme-navigation {
</span><span class="cx">  background: #fff;
</span><span class="cx">  box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
</span><span class="lines">@@ -1081,6 +1078,17 @@
</span><span class="cx">  position: relative;
</span><span class="cx">  width: 100%;
</span><span class="cx"> }
</span><ins>+.theme-install-php a.upload,
+.theme-install-php a.browse-themes {
+       cursor: pointer;
+}
+.theme-install-php a.browse-themes,
+.theme-install-php.show-upload-theme a.upload {
+       display: none;
+}
+.theme-install-php.show-upload-theme a.browse-themes {
+       display: inline;
+}
</ins><span class="cx"> .upload-theme {
</span><span class="cx">  -moz-box-sizing: border-box;
</span><span class="cx">  box-sizing: border-box;
</span><span class="lines">@@ -1090,9 +1098,9 @@
</span><span class="cx">  width: 100%;
</span><span class="cx">  overflow: hidden;
</span><span class="cx">  position: relative;
</span><del>-               top: 10px;
</del><ins>+        top: 10px;
</ins><span class="cx"> }
</span><del>-.upload-theme.opened {
</del><ins>+body.show-upload-theme .upload-theme {
</ins><span class="cx">   display: block;
</span><span class="cx"> }
</span><span class="cx"> .upload-theme .wp-upload-form {
</span><span class="lines">@@ -1110,14 +1118,18 @@
</span><span class="cx">  padding: 40px 0 0;
</span><span class="cx">  text-align: center;
</span><span class="cx"> }
</span><del>-.upload-theme.opened + .theme-navigation,
-.upload-theme.opened + .theme-navigation + .theme-browser {
</del><ins>+body.show-upload-theme .upload-theme + .theme-navigation,
+body.show-upload-theme .upload-theme + .theme-navigation + .theme-browser {
</ins><span class="cx">   display: none;
</span><span class="cx"> }
</span><span class="cx"> .theme-navigation .theme-count {
</span><del>-       top: 3px;
</del><span class="cx">   margin-left: 0;
</span><ins>+       position: absolute;
+       top: 12px;
</ins><span class="cx"> }
</span><ins>+.theme-count + .theme-section {
+       margin-left: 60px;
+}
</ins><span class="cx"> .theme-section,
</span><span class="cx"> .theme-filter {
</span><span class="cx">  border-bottom: 4px solid #fff;
</span><span class="lines">@@ -1142,13 +1154,13 @@
</span><span class="cx">  cursor: pointer;
</span><span class="cx">  display: inline-block;
</span><span class="cx">  margin: 0 10px;
</span><del>-       padding: 4px 5px;
</del><ins>+        padding: 4px 6px;
</ins><span class="cx">   -moz-transition: color .1s ease-in, background .1s ease-in;
</span><span class="cx">  -webkit-transition: color .1s ease-in, background .1s ease-in;
</span><span class="cx">  transition: color .1s ease-in, background .1s ease-in;
</span><span class="cx"> }
</span><span class="cx"> body.more-filters-opened .more-filters,
</span><del>-.theme-navigation .more-filters.current {
</del><ins>+body.more-filters-opened .more-filters:before {
</ins><span class="cx">   background: rgb(46, 162, 204);
</span><span class="cx">  border-radius: 2px;
</span><span class="cx">  border: none;
</span><span class="lines">@@ -1156,8 +1168,8 @@
</span><span class="cx"> }
</span><span class="cx"> .theme-install-php .theme-search {
</span><span class="cx">  position: absolute;
</span><del>-               right: 10px;
-               top: 9px;
</del><ins>+        right: 10px;
+       top: 9px;
</ins><span class="cx">   font-size: 16px;
</span><span class="cx">  font-weight: 300;
</span><span class="cx">  line-height: 1.5;
</span><span class="lines">@@ -1197,10 +1209,50 @@
</span><span class="cx"> body.more-filters-opened .more-filters-container {
</span><span class="cx">  display: block;
</span><span class="cx"> }
</span><ins>+.more-filters-container .filters-group {
+       -moz-box-sizing: border-box;
+       box-sizing: border-box;
+       float: left;
+       width: 20%;
+}
+.more-filters-container .feature-name {
+       margin-top: 0;
+}
+.more-filters-container ol {
+       list-style-type: none;
+       margin: 0;
+}
+
</ins><span class="cx"> .theme-install-php .add-new-theme {
</span><span class="cx">  display: none !important;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+@media only screen and (max-width: 1120px) {
+       .theme-install-php .theme-search {
+               margin: 20px 0;
+               position: static;
+               width: 100%;
+       }
+       .more-filters-container {
+               border-bottom: 1px solid #eee;
+       }
+       .upload-theme .wp-upload-form {
+               margin: 20px 0;
+               max-width: 100%;
+       }
+       .upload-theme .install-help {
+               font-size: 15px;
+               padding: 20px 0 0;
+               text-align: left;
+       }
+       .more-filters-container .filters-group {
+               width: 50%;
+       }
+       .more-filters-container .filters-group:nth-child(3n) {
+               clear: left;
+       }
+}
+
</ins><span class="cx"> .rating {
</span><span class="cx">  margin: 30px 0;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunksrcwpadminjsthemejs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/theme.js (27635 => 27636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/theme.js   2014-03-20 02:58:48 UTC (rev 27635)
+++ trunk/src/wp-admin/js/theme.js      2014-03-20 04:19:55 UTC (rev 27636)
</span><span class="lines">@@ -992,7 +992,8 @@
</span><span class="cx">  events: {
</span><span class="cx">          'click .theme-section': 'onSort',
</span><span class="cx">          'click .theme-filter': 'onFilter',
</span><del>-               'click .more-filters': 'moreFilters'
</del><ins>+                'click .more-filters': 'moreFilters',
+               'click [type="checkbox"]': 'addFilter'
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">  // Send Ajax POST request to api.wordpress.org/themes
</span><span class="lines">@@ -1126,6 +1127,7 @@
</span><span class="cx">          // using the default values
</span><span class="cx"> 
</span><span class="cx">          // @todo Cache the collection after fetching based on the filter
</span><ins>+               filter = _.union( filter, this.filtersChecked() );
</ins><span class="cx">           request = { tag: [ filter ] };
</span><span class="cx"> 
</span><span class="cx">          // Send Ajax POST request to api.wordpress.org/themes
</span><span class="lines">@@ -1146,6 +1148,40 @@
</span><span class="cx">          return false;
</span><span class="cx">  },
</span><span class="cx"> 
</span><ins>+       // Clicking on a checkbox triggers a tag request
+       addFilter: function() {
+               var self = this,
+                       tags = this.filtersChecked(),
+                       request = { tag: tags };
+
+               // Send Ajax POST request to api.wordpress.org/themes
+               this.apiCall( request ).done( function( data ) {
+                               // Update the collection with the queried data
+                               self.collection.reset( data.themes );
+                               // Trigger a collection refresh event to render the views
+                               self.collection.trigger( 'update' );
+
+                               // Un-spin it
+                               $( 'body' ).removeClass( 'loading-themes' );
+                               $( '.theme-browser' ).find( 'div.error' ).remove();
+               }).fail( function() {
+                               $( '.theme-browser' ).find( 'div.error' ).remove();
+                               $( '.theme-browser' ).append( '<div class="error"><p>' + l10n.error + '</p></div>' );
+               });
+       },
+
+       // Get the checked filters and return an array
+       filtersChecked: function() {
+               var items = $( '.feature-group' ).find( ':checkbox' ),
+                       tags = [];
+
+               _.each( items.filter( ':checked' ), function( item ) {
+                       tags.push( $( item ).prop( 'value' ) );
+               });
+
+               return tags;
+       },
+
</ins><span class="cx">   activeClass: 'current',
</span><span class="cx"> 
</span><span class="cx">  // Overwrite search container class to append search
</span><span class="lines">@@ -1153,11 +1189,14 @@
</span><span class="cx">  searchContainer: $( '.theme-navigation' ),
</span><span class="cx"> 
</span><span class="cx">  uploader: function() {
</span><del>-               $( 'a.upload.button' ).on( 'click', function() {
-                       $( '.upload-theme' )
-                               .toggleClass( 'opened' )
-                               .hasClass( 'opened' ) ? $( this ).text( l10n.back ) : $( this ).text( l10n.upload );
</del><ins>+                $( 'a.upload' ).on( 'click', function() {
+                       $( 'body' ).addClass( 'show-upload-theme' );
+                       themes.router.navigate( themes.router.baseUrl( '?upload' ), { replace: true } );
</ins><span class="cx">           });
</span><ins>+               $( 'a.browse-themes' ).on( 'click', function() {
+                       $( 'body' ).removeClass( 'show-upload-theme' );
+                       themes.router.navigate( themes.router.baseUrl( '' ), { replace: true } );
+               });
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">  moreFilters: function() {
</span><span class="lines">@@ -1168,7 +1207,8 @@
</span><span class="cx"> themes.InstallerRouter = Backbone.Router.extend({
</span><span class="cx">  routes: {
</span><span class="cx">          'theme-install.php?theme=:slug': 'preview',
</span><del>-               'theme-install.php(?sort=:sort)': 'sort',
</del><ins>+                'theme-install.php?sort=:sort': 'sort',
+               'theme-install.php?upload': 'upload',
</ins><span class="cx">           '': 'sort'
</span><span class="cx">  },
</span><span class="cx"> 
</span><span class="lines">@@ -1225,6 +1265,10 @@
</span><span class="cx">                  self.view.trigger( 'theme:close' );
</span><span class="cx">          });
</span><span class="cx"> 
</span><ins>+               themes.router.on( 'route:upload', function( slug ) {
+                       $( 'a.upload' ).trigger( 'click' );
+               });
+
</ins><span class="cx">           this.extraRoutes();
</span><span class="cx">  },
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunksrcwpadminthemeinstallphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/theme-install.php (27635 => 27636)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/theme-install.php     2014-03-20 02:58:48 UTC (rev 27635)
+++ trunk/src/wp-admin/theme-install.php        2014-03-20 04:19:55 UTC (rev 27636)
</span><span class="lines">@@ -104,7 +104,8 @@
</span><span class="cx"> <div class="wrap">
</span><span class="cx">  <h2>
</span><span class="cx">          <?php echo esc_html( $title ); ?>
</span><del>-               <a class="upload button button-secondary"><?php esc_html_e( 'Upload Theme' ); ?></a>
</del><ins>+                <a class="upload add-new-h2"><?php esc_html_e( 'Upload Theme' ); ?></a>
+               <a class="browse-themes add-new-h2"><?php esc_html_e( 'Browse' ); ?></a>
</ins><span class="cx">   </h2>
</span><span class="cx"> 
</span><span class="cx">  <div class="upload-theme">
</span><span class="lines">@@ -117,12 +118,28 @@
</span><span class="cx">          <span class="theme-section" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></span>
</span><span class="cx">          <span class="theme-section" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></span>
</span><span class="cx">          <div class="theme-top-filters">
</span><del>-                       <span class="theme-filter" data-filter="photoblogging">Photography</span>
-                       <span class="theme-filter" data-filter="responsive-layout">Responsive</span>
-                       <span class="theme-filter more-filters">More</span>
</del><ins>+                        <!--<span class="theme-filter" data-filter="photoblogging">Photography</span>
+                       <span class="theme-filter" data-filter="responsive-layout">Responsive</span>-->
+                       <span class="more-filters"><?php _e( 'Feature Filter' ); ?></span>
</ins><span class="cx">           </div>
</span><span class="cx">          <div class="more-filters-container">
</span><del>-                       Display more filters.
</del><ins>+                <?php
+               $feature_list = get_theme_feature_list();
+               foreach ( $feature_list as $feature_name => $features ) {
+                       echo '<div class="filters-group">';
+                       $feature_name = esc_html( $feature_name );
+                       echo '<h4 class="feature-name">' . $feature_name . '</h4>';
+                       echo '<ol class="feature-group">';
+                       foreach ( $features as $feature => $feature_name ) {
+                               $feature = esc_attr( $feature );
+                               echo '<li><input type="checkbox" id="feature-id-' . $feature . '" value="' . $feature . '" /> ';
+                               echo '<label for="feature-id-' . $feature . '">' . $feature_name . '</label></li>';
+                       }
+                       echo '</ol>';
+                       echo '</div>';
+               }
+               ?>
+                       <br class="clear" />
</ins><span class="cx">           </div>
</span><span class="cx">  </div>
</span><span class="cx">  <div class="theme-browser"></div>
</span></span></pre>
</div>
</div>

</body>
</html>