<!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>[27896] trunk/src/wp-admin: Theme Installer fixes:</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/27896">27896</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2014-04-01 22:19:51 +0000 (Tue, 01 Apr 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Theme Installer fixes:
* Better more filters section. props sonjanyc for some mockups.
* Better handling of no results.
* Use # for hrefs.
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 (27895 => 27896)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/themes.css 2014-04-01 19:03:24 UTC (rev 27895)
+++ trunk/src/wp-admin/css/themes.css 2014-04-01 22:19:51 UTC (rev 27896)
</span><span class="lines">@@ -1150,8 +1150,6 @@
</span><span class="cx"> display: inline-block;
</span><span class="cx"> margin: 0 10px;
</span><span class="cx"> padding: 15px 0;
</span><del>- -webkit-transition: border-color .1s ease-in;
- transition: border-color .1s ease-in;
</del><span class="cx"> }
</span><span class="cx"> .theme-section.current,
</span><span class="cx"> .theme-filter.current {
</span><span class="lines">@@ -1167,8 +1165,6 @@
</span><span class="cx"> display: inline-block;
</span><span class="cx"> margin: 0 10px;
</span><span class="cx"> padding: 4px 6px;
</span><del>- -webkit-transition: color .1s ease-in, background .1s ease-in;
- transition: color .1s ease-in, background .1s ease-in;
</del><span class="cx"> }
</span><span class="cx"> body.more-filters-opened .more-filters,
</span><span class="cx"> body.more-filters-opened .more-filters:before {
</span><span class="lines">@@ -1177,8 +1173,6 @@
</span><span class="cx"> border-radius: 2px;
</span><span class="cx"> border: none;
</span><span class="cx"> color: #fff;
</span><del>- -webkit-transition: color .1s ease-in, background .1s ease-in;
- transition: color .1s ease-in, background .1s ease-in;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> body.more-filters-opened .more-filters:hover,
</span><span class="lines">@@ -1230,21 +1224,98 @@
</span><span class="cx"> body.more-filters-opened .more-filters-container {
</span><span class="cx"> display: block;
</span><span class="cx"> }
</span><ins>+body.more-filters-opened .theme-section.current {
+ border-bottom: none;
+}
+body.more-filters-opened .theme-browser,
+body.more-filters-opened.filters-applied.loading-themes .theme-browser {
+ display: none;
+}
+body.more-filters-opened.filters-applied .theme-browser {
+ display: block;
+}
</ins><span class="cx"> .more-filters-container .filters-group {
</span><span class="cx"> -webkit-box-sizing: border-box;
</span><span class="cx"> -moz-box-sizing: border-box;
</span><span class="cx"> box-sizing: border-box;
</span><span class="cx"> float: left;
</span><del>- width: 20%;
</del><ins>+ width: 19%;
+ background: #fff;
+ margin: 0 1% 0 0;
+ border: 1px solid #e5e5e5;
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+ box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+ padding: 10px;
</ins><span class="cx"> }
</span><span class="cx"> .more-filters-container .feature-name {
</span><del>- margin-top: 0;
</del><ins>+ margin: 0;
+ position: relative;
</ins><span class="cx"> }
</span><span class="cx"> .more-filters-container ol {
</span><span class="cx"> list-style-type: none;
</span><ins>+ margin: 20px 0 0;
+ display: block;
+ font-size: 12px;
+}
+.theme-navigation .more-filters-container .apply-filters {
+ margin: 20px 0 0;
+}
+.theme-navigation .more-filters-container .clear-filters {
+ display: none;
+ margin: 20px 0 0 10px;
+}
+.more-filters-container .apply-filters span {
+ display: inline-block;
+ font-size: 12px;
+ text-indent: 10px;
+ opacity: 0.8;
+}
+.more-filters-container .filtering-by {
+ display: none;
</ins><span class="cx"> margin: 0;
</span><span class="cx"> }
</span><ins>+.more-filters-container .filtering-by > span {
+ font-weight: 600;
+}
+.more-filters-container .filtering-by .tags {
+ display: inline;
+}
+.more-filters-container .filtering-by .tag {
+ background: #fff;
+ border: 1px solid #e5e5e5;
+ box-shadow: 0 1px 1px rgba(0,0,0,0.04);
+ font-size: 11px;
+ margin: 0 5px;
+ padding: 4px 8px;
+}
+body.filters-applied .more-filters-container .filters-group,
+body.filters-applied .more-filters-container a,
+body.filters-applied .more-filters-container br {
+ display: none !important;
+}
+body.filters-applied .more-filters-container .filtering-by {
+ display: block;
+}
+body.filters-applied .more-filters-container {
+ padding: 20px;
+}
+p.no-themes {
+ color: #999;
+ font-size: 18px;
+ font-style: normal;
+ margin: 0;
+ padding: 0;
+ text-align: center;
+ display: none;
+}
+body.no-results p.no-themes {
+ display: block;
+}
+body.show-upload-theme p.no-themes {
+ display: none !important;
+}
</ins><span class="cx">
</span><ins>+
</ins><span class="cx"> .theme-install-php .add-new-theme {
</span><span class="cx"> display: none !important;
</span><span class="cx"> }
</span><span class="lines">@@ -1268,13 +1339,21 @@
</span><span class="cx"> text-align: left;
</span><span class="cx"> }
</span><span class="cx"> .more-filters-container .filters-group {
</span><del>- width: 50%;
</del><ins>+ margin-bottom: 0;
+ margin-top: 5px;
+ width: 49%;
</ins><span class="cx"> }
</span><span class="cx"> .more-filters-container .filters-group:nth-child(3n) {
</span><span class="cx"> clear: left;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+@media only screen and (max-width: 782px) {
+ .more-filters-container .filters-group {
+ width: 100%;
+ }
+}
+
</ins><span class="cx"> .rating {
</span><span class="cx"> margin: 30px 0;
</span><span class="cx"> }
</span><span class="lines">@@ -1717,6 +1796,7 @@
</span><span class="cx"> float: left;
</span><span class="cx"> color: #777;
</span><span class="cx"> line-height: 20px;
</span><ins>+ max-width: 100%;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #theme-installer .wp-full-overlay-header {
</span></span></pre></div>
<a id="trunksrcwpadminjsthemejs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/theme.js (27895 => 27896)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/theme.js 2014-04-01 19:03:24 UTC (rev 27895)
+++ trunk/src/wp-admin/js/theme.js 2014-04-01 22:19:51 UTC (rev 27896)
</span><span class="lines">@@ -255,6 +255,10 @@
</span><span class="cx"> self.trigger( 'update' );
</span><span class="cx"> self.trigger( 'query:success', count );
</span><span class="cx">
</span><ins>+ if ( data.themes.length === 0 ) {
+ self.trigger( 'query:empty' );
+ }
+
</ins><span class="cx"> // Store the results and the query request
</span><span class="cx"> queries.push( { themes: data.themes, request: request } );
</span><span class="cx"> }).fail( function() {
</span><span class="lines">@@ -277,6 +281,12 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if ( query.themes.length === 0 ) {
+ self.trigger( 'query:empty' );
+ } else {
+ $( 'body' ).removeClass( 'no-results' );
+ }
+
</ins><span class="cx"> // Only trigger an update event since we already have the themes
</span><span class="cx"> // on our cached object
</span><span class="cx"> this.reset( query.themes );
</span><span class="lines">@@ -330,7 +340,7 @@
</span><span class="cx"> beforeSend: function() {
</span><span class="cx"> if ( ! paginated ) {
</span><span class="cx"> // Spin it
</span><del>- $( 'body' ).addClass( 'loading-themes' );
</del><ins>+ $( 'body' ).addClass( 'loading-themes' ).removeClass( 'no-results' );
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> });
</span><span class="lines">@@ -657,6 +667,7 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> collapse: function() {
</span><ins>+
</ins><span class="cx"> this.$el.toggleClass( 'collapsed' ).toggleClass( 'expanded' );
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -704,6 +715,10 @@
</span><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><ins>+ this.listenTo( self.collection, 'query:empty', function() {
+ $( 'body' ).addClass( 'no-results' );
+ });
+
</ins><span class="cx"> this.listenTo( this.parent, 'theme:scroll', function() {
</span><span class="cx"> self.renderThemes( self.parent.page );
</span><span class="cx"> });
</span><span class="lines">@@ -1143,7 +1158,10 @@
</span><span class="cx"> 'click .theme-section': 'onSort',
</span><span class="cx"> 'click .theme-filter': 'onFilter',
</span><span class="cx"> 'click .more-filters': 'moreFilters',
</span><del>- 'click [type="checkbox"]': 'addFilter'
</del><ins>+ 'click .apply-filters': 'addFilter',
+ 'click [type="checkbox"]': 'filtersChecked',
+ 'click .clear-filters': 'clearFilters',
+ 'click .feature-name': 'filterSection'
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> // Handles all the rendering of the public theme directory
</span><span class="lines">@@ -1217,6 +1235,8 @@
</span><span class="cx">
</span><span class="cx"> event.preventDefault();
</span><span class="cx">
</span><ins>+ $( 'body' ).removeClass( 'filters-applied more-filters-opened' );
+
</ins><span class="cx"> // Bail if this is already active
</span><span class="cx"> if ( $el.hasClass( this.activeClass ) ) {
</span><span class="cx"> return;
</span><span class="lines">@@ -1266,16 +1286,31 @@
</span><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> // Clicking on a checkbox triggers a tag request
</span><del>- addFilter: function() {
- var tags = this.filtersChecked(),
- request = { tag: tags };
</del><ins>+ addFilter: function( event ) {
+ var name,
+ tags = this.filtersChecked(),
+ request = { tag: tags },
+ filteringBy = $( '.filtering-by .tags' );
</ins><span class="cx">
</span><ins>+ if ( event ) {
+ event.preventDefault();
+ }
+
+ $( 'body' ).addClass( 'filters-applied' );
+ filteringBy.empty();
+
+ _.each( tags, function( tag ) {
+ name = $( 'label[for="feature-id-' + tag + '"]' ).text();
+ filteringBy.append( '<span class="tag">' + name + '</span>' );
+ });
+
</ins><span class="cx"> // Get the themes by sending Ajax POST request to api.wordpress.org/themes
</span><span class="cx"> // or searching the local cache
</span><span class="cx"> this.collection.query( request );
</span><span class="cx"> },
</span><span class="cx">
</span><del>- // Get the checked filters and return an array
</del><ins>+ // Get the checked filters
+ // @return {array} of tags or false
</ins><span class="cx"> filtersChecked: function() {
</span><span class="cx"> var items = $( '.feature-group' ).find( ':checkbox' ),
</span><span class="cx"> tags = [];
</span><span class="lines">@@ -1284,6 +1319,17 @@
</span><span class="cx"> tags.push( $( item ).prop( 'value' ) );
</span><span class="cx"> });
</span><span class="cx">
</span><ins>+ // When no filters are checked, restore initial state and return
+ if ( tags.length === 0 ) {
+ $( '.apply-filters' ).find( 'span' ).text( '' );
+ $( '.clear-filters' ).hide();
+ $( 'body' ).removeClass( 'filters-applied' );
+ return false;
+ }
+
+ $( '.apply-filters' ).find( 'span' ).text( tags.length );
+ $( '.clear-filters' ).css( 'display', 'inline-block' );
+
</ins><span class="cx"> return tags;
</span><span class="cx"> },
</span><span class="cx">
</span><span class="lines">@@ -1304,8 +1350,40 @@
</span><span class="cx"> });
</span><span class="cx"> },
</span><span class="cx">
</span><del>- moreFilters: function() {
</del><ins>+ // Toggle the full filters navigation
+ moreFilters: function( event ) {
+ event.preventDefault();
+
+ if ( $( 'body' ).hasClass( 'filters-applied' ) ) {
+ return $( 'body' ).removeClass( 'filters-applied' );
+ }
+
+ // If the filters section is opened and filters are checked
+ // run the relevant query collapsing to filtered-by state
+ if ( $( 'body' ).hasClass( 'more-filters-opened' ) && this.filtersChecked() ) {
+ return this.addFilter();
+ }
+
</ins><span class="cx"> $( 'body' ).toggleClass( 'more-filters-opened' );
</span><ins>+ },
+
+ // Expand/collapse each individual filter section
+ filterSection: function() {
+ $( event.target ).parent().toggleClass( 'open' );
+ },
+
+ // Clears all the checked filters
+ // @uses filtersChecked()
+ clearFilters: function( event ) {
+ var items = $( '.feature-group' ).find( ':checkbox' ),
+ self = this;
+
+ event.preventDefault();
+
+ _.each( items.filter( ':checked' ), function( item ) {
+ $( item ).prop( 'checked', false );
+ return self.filtersChecked();
+ });
</ins><span class="cx"> }
</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 (27895 => 27896)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/theme-install.php 2014-04-01 19:03:24 UTC (rev 27895)
+++ trunk/src/wp-admin/theme-install.php 2014-04-01 22:19:51 UTC (rev 27896)
</span><span class="lines">@@ -118,8 +118,8 @@
</span><span class="cx"> <a class="theme-section" href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a>
</span><span class="cx"> <a class="theme-section" href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a>
</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>-->
</del><ins>+ <!-- <span class="theme-filter" data-filter="photoblogging">Photography</span>
+ <span class="theme-filter" data-filter="responsive-layout">Responsive</span> -->
</ins><span class="cx"> <a class="more-filters" href="#"><?php _e( 'Feature Filter' ); ?></a>
</span><span class="cx"> </div>
</span><span class="cx"> <div class="more-filters-container">
</span><span class="lines">@@ -140,12 +140,19 @@
</span><span class="cx"> }
</span><span class="cx"> ?>
</span><span class="cx"> <br class="clear" />
</span><ins>+ <a class="apply-filters button button-secondary" href="#"><?php _e( 'Apply Filters' ); ?><span></span></a>
+ <a class="clear-filters button button-secondary" href="#"><?php _e( 'Clear' ); ?></a>
+ <div class="filtering-by">
+ <span><?php _e( 'Filtering by:' ); ?></span>
+ <div class="tags"></div>
+ </div>
</ins><span class="cx"> </div>
</span><span class="cx"> </div>
</span><span class="cx"> <div class="theme-browser"></div>
</span><span class="cx"> <div class="theme-overlay"></div>
</span><span class="cx"> <div id="theme-installer" class="wp-full-overlay expanded"></div>
</span><span class="cx">
</span><ins>+ <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
</ins><span class="cx"> <span class="spinner"></span>
</span><span class="cx">
</span><span class="cx"> <br class="clear" />
</span><span class="lines">@@ -188,7 +195,7 @@
</span><span class="cx"> <script id="tmpl-theme-preview" type="text/template">
</span><span class="cx"> <div class="wp-full-overlay-sidebar">
</span><span class="cx"> <div class="wp-full-overlay-header">
</span><del>- <a href="" class="close-full-overlay button-secondary"><?php _e( 'Close' ); ?></a>
</del><ins>+ <a href="#" class="close-full-overlay button-secondary"><?php _e( 'Close' ); ?></a>
</ins><span class="cx"> <a href="{{ data.installURI }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a>
</span><span class="cx"> </div>
</span><span class="cx"> <div class="wp-full-overlay-sidebar-content">
</span><span class="lines">@@ -213,7 +220,7 @@
</span><span class="cx"> </div>
</span><span class="cx"> </div>
</span><span class="cx"> <div class="wp-full-overlay-footer">
</span><del>- <a href="" class="collapse-sidebar" title="<?php esc_attr_e( 'Collapse Sidebar' ); ?>">
</del><ins>+ <a href="#" class="collapse-sidebar" title="<?php esc_attr_e( 'Collapse Sidebar' ); ?>">
</ins><span class="cx"> <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span>
</span><span class="cx"> <span class="collapse-sidebar-arrow"></span>
</span><span class="cx"> </a>
</span></span></pre>
</div>
</div>
</body>
</html>