Ticket #27055: 27055.30.2.diff
File 27055.30.2.diff, 4.5 KB (added by , 10 years ago) |
---|
-
wp-admin/css/themes.css
1288 1288 margin: 0 5px; 1289 1289 padding: 4px 8px; 1290 1290 } 1291 .more-filters-container .filtering-by a { 1292 margin-left: 10px; 1293 } 1291 1294 body.filters-applied .more-filters-container .filters-group, 1292 body.filters-applied .more-filters-container a ,1295 body.filters-applied .more-filters-container a.button, 1293 1296 body.filters-applied .more-filters-container br { 1294 1297 display: none !important; 1295 1298 } -
wp-admin/js/theme.js
215 215 return collection; 216 216 }, 217 217 218 count: false, 219 218 220 // Handles requests for more themes 219 221 // and caches results 220 222 // … … 229 231 self = this, 230 232 query, isPaginated, count; 231 233 234 // Store current query request args 235 // for later use with the event `theme:end` 236 this.currentQuery.request = request; 237 232 238 // Search the query cache for matches. 233 239 query = _.find( queries, function( query ) { 234 240 return _.isEqual( query.request, request ); … … 244 250 } 245 251 246 252 // Otherwise, send a new API call and add it to the cache. 247 if ( ! query ) {253 if ( ! query && ! isPaginated ) { 248 254 query = this.apiCall( request ).done( function( data ) { 249 255 // Update the collection with the queried data. 250 256 self.reset( data.themes ); … … 260 266 } 261 267 262 268 // Store the results and the query request 263 queries.push( { themes: data.themes, request: request } );269 queries.push( { themes: data.themes, request: request, total: count } ); 264 270 }).fail( function() { 265 271 self.trigger( 'query:fail' ); 266 272 }); … … 289 295 290 296 // Only trigger an update event since we already have the themes 291 297 // on our cached object 298 if ( _.isNumber( query.total ) ) { 299 this.count = query.total; 300 } 301 302 if ( ! query.total ) { 303 this.count = this.length; 304 } 305 292 306 this.reset( query.themes ); 293 307 this.trigger( 'update' ); 294 308 } … … 300 314 // Keep track of current query so we can handle pagination 301 315 currentQuery: { 302 316 page: 1, 303 request: {} 317 request: {}, 318 total: false 304 319 }, 305 320 306 321 // Send Ajax POST request to api.wordpress.org/themes 307 322 apiCall: function( request, paginated ) { 308 // Store current query request args309 // for later use with the event `theme:end`310 this.currentQuery.request = request;311 323 312 324 // Ajax request to .org API 313 325 return $.ajax({ … … 782 794 } 783 795 784 796 // Display a live theme count for the collection 785 this.count.text( this.collection. length );797 this.count.text( this.collection.count ? this.collection.count : this.collection.length ); 786 798 }, 787 799 788 800 // Iterates through each instance of the collection … … 1143 1155 request.tag = [ value.slice( 4 ) ]; 1144 1156 } 1145 1157 1158 $( '.theme-section.current' ).removeClass( 'current' ); 1159 $( 'body' ).removeClass( 'more-filters-opened filters-applied' ); 1160 1146 1161 // Get the themes by sending Ajax POST request to api.wordpress.org/themes 1147 1162 // or searching the local cache 1148 1163 this.collection.query( request ); … … 1161 1176 'click .apply-filters': 'addFilter', 1162 1177 'click [type="checkbox"]': 'filtersChecked', 1163 1178 'click .clear-filters': 'clearFilters', 1164 'click .feature-name': 'filterSection' 1179 'click .feature-name': 'filterSection', 1180 'click .filtering-by a': 'backToFilters' 1165 1181 }, 1166 1182 1167 1183 // Handles all the rendering of the public theme directory … … 1297 1313 } 1298 1314 1299 1315 $( 'body' ).addClass( 'filters-applied' ); 1316 $( '.theme-section.current' ).removeClass( 'current' ); 1300 1317 filteringBy.empty(); 1301 1318 1302 1319 _.each( tags, function( tag ) { … … 1355 1372 event.preventDefault(); 1356 1373 1357 1374 if ( $( 'body' ).hasClass( 'filters-applied' ) ) { 1358 return $( 'body' ).removeClass( 'filters-applied');1375 return this.backToFilters(); 1359 1376 } 1360 1377 1361 1378 // If the filters section is opened and filters are checked … … 1384 1401 $( item ).prop( 'checked', false ); 1385 1402 return self.filtersChecked(); 1386 1403 }); 1404 }, 1405 1406 backToFilters: function() { 1407 $( 'body' ).removeClass( 'filters-applied' ); 1387 1408 } 1388 1409 }); 1389 1410 -
wp-admin/theme-install.php
145 145 <div class="filtering-by"> 146 146 <span><?php _e( 'Filtering by:' ); ?></span> 147 147 <div class="tags"></div> 148 <a href="#"><?php _e( 'Edit' ); ?></a> 148 149 </div> 149 150 </div> 150 151 </div>