Ticket #27055: 27055.32.diff
| File 27055.32.diff, 8.6 KB (added by , 12 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 } … … 1508 1511 margin: 0; 1509 1512 z-index: 10; 1510 1513 overflow: auto; 1511 background: transparent;1514 background: #eee; 1512 1515 border-right: none; 1513 1516 } 1514 1517 … … 1671 1674 display: none; 1672 1675 } 1673 1676 1677 .wp-full-overlay .theme-navigation { 1678 padding: 10px; 1679 position: absolute; 1680 bottom: 10px; 1681 text-align: center; 1682 } 1683 1674 1684 /* Animations */ 1675 1685 .wp-full-overlay, 1676 1686 .wp-full-overlay-sidebar, … … 1749 1759 1750 1760 .install-theme-info { 1751 1761 display: none; 1752 padding: 10px 20px 20px;1762 padding: 10px 20px 60px; 1753 1763 } 1754 1764 1755 1765 .single-theme .install-theme-info { -
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 } … … 305 319 306 320 // Send Ajax POST request to api.wordpress.org/themes 307 321 apiCall: function( request, paginated ) { 308 // Store current query request args309 // for later use with the event `theme:end`310 this.currentQuery.request = request;311 322 312 323 // Ajax request to .org API 313 324 return $.ajax({ … … 441 452 }, 442 453 443 454 preview: function( event ) { 455 var self = this, 456 current; 457 444 458 // Bail if the user scrolled on a touch device 445 459 if ( this.touchDrag === true ) { 446 460 return this.touchDrag = false; … … 460 474 461 475 event = event || window.event; 462 476 477 // Set focus to current theme. 478 themes.focusedTheme = this.$el; 479 480 // Construct a new Preview view. 463 481 var preview = new themes.view.Preview({ 464 482 model: this.model 465 483 }); 466 484 485 // Render the view and append it. 467 486 preview.render(); 468 487 $( 'div.wrap' ).append( preview.el ); 488 489 // Listen to our preview object 490 // for `theme:next` and `theme:previous` events. 491 this.listenTo( preview, 'theme:next', function() { 492 493 // Keep local track of current theme model. 494 current = self.model; 495 496 // If we have ventured away from current model update the current model position. 497 if ( ! _.isUndefined( self.current ) ) { 498 current = self.current; 499 } 500 501 // Get previous theme model. 502 self.current = self.model.collection.at( self.model.collection.indexOf( current ) + 1 ); 503 504 // If we have no more themes, bail. 505 if ( _.isUndefined( self.current ) ) { 506 return; 507 } 508 509 // Construct a new Preview view. 510 preview = new themes.view.Preview({ 511 model: self.current 512 }); 513 514 // Render and append. 515 preview.render(); 516 $( 'div.wrap' ).append( preview.el ); 517 }) 518 .listenTo( preview, 'theme:previous', function() { 519 520 // Keep track of current theme model. 521 current = self.model; 522 523 // If we have ventured away from current model update the current model position. 524 if ( ! _.isUndefined( self.current ) ) { 525 current = self.current; 526 } 527 528 // Get previous theme model. 529 self.current = self.model.collection.at( self.model.collection.indexOf( current ) - 1 ); 530 531 // If we have no more themes, bail. 532 if ( _.isUndefined( self.current ) ) { 533 return; 534 } 535 536 // Construct a new Preview view. 537 preview = new themes.view.Preview({ 538 model: self.current 539 }); 540 541 // Render and append. 542 preview.render(); 543 $( 'div.wrap' ).append( preview.el ); 544 }); 469 545 } 470 546 }); 471 547 … … 633 709 634 710 // Theme Preview view 635 711 // Set ups a modal overlay with the expanded theme data 636 themes.view.Preview = wp.Backbone.View.extend({712 themes.view.Preview = themes.view.Details.extend({ 637 713 638 714 className: 'wp-full-overlay expanded', 639 715 el: '#theme-installer', 640 716 641 717 events: { 642 718 'click .close-full-overlay': 'close', 643 'click .collapse-sidebar': 'collapse' 719 'click .collapse-sidebar': 'collapse', 720 'click .previous-theme': 'previousTheme', 721 'click .next-theme': 'nextTheme' 644 722 }, 645 723 646 724 // The HTML template for the theme preview … … 654 732 655 733 this.$el.fadeIn( 200, function() { 656 734 $( 'body' ).addClass( 'theme-installer-active full-overlay-active' ); 735 $( '.close-full-overlay' ).focus(); 657 736 }); 658 737 }, 659 738 660 739 close: function() { 661 740 this.$el.fadeOut( 200, function() { 662 741 $( 'body' ).removeClass( 'theme-installer-active full-overlay-active' ); 742 743 // Return focus to the theme div 744 if ( themes.focusedTheme ) { 745 themes.focusedTheme.focus(); 746 } 663 747 }); 664 748 665 749 themes.router.navigate( themes.router.baseUrl( '' ) ); … … 782 866 } 783 867 784 868 // Display a live theme count for the collection 785 this.count.text( this.collection. length );869 this.count.text( this.collection.count ? this.collection.count : this.collection.length ); 786 870 }, 787 871 788 872 // Iterates through each instance of the collection … … 1143 1227 request.tag = [ value.slice( 4 ) ]; 1144 1228 } 1145 1229 1230 $( '.theme-section.current' ).removeClass( 'current' ); 1231 $( 'body' ).removeClass( 'more-filters-opened filters-applied' ); 1232 1146 1233 // Get the themes by sending Ajax POST request to api.wordpress.org/themes 1147 1234 // or searching the local cache 1148 1235 this.collection.query( request ); … … 1161 1248 'click .apply-filters': 'addFilter', 1162 1249 'click [type="checkbox"]': 'filtersChecked', 1163 1250 'click .clear-filters': 'clearFilters', 1164 'click .feature-name': 'filterSection' 1251 'click .feature-name': 'filterSection', 1252 'click .filtering-by a': 'backToFilters' 1165 1253 }, 1166 1254 1167 1255 // Handles all the rendering of the public theme directory … … 1297 1385 } 1298 1386 1299 1387 $( 'body' ).addClass( 'filters-applied' ); 1388 $( '.theme-section.current' ).removeClass( 'current' ); 1300 1389 filteringBy.empty(); 1301 1390 1302 1391 _.each( tags, function( tag ) { … … 1355 1444 event.preventDefault(); 1356 1445 1357 1446 if ( $( 'body' ).hasClass( 'filters-applied' ) ) { 1358 return $( 'body' ).removeClass( 'filters-applied');1447 return this.backToFilters(); 1359 1448 } 1360 1449 1361 1450 // If the filters section is opened and filters are checked … … 1384 1473 $( item ).prop( 'checked', false ); 1385 1474 return self.filtersChecked(); 1386 1475 }); 1476 }, 1477 1478 backToFilters: function() { 1479 $( 'body' ).removeClass( 'filters-applied' ); 1387 1480 } 1388 1481 }); 1389 1482 -
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> 151 152 <div class="theme-browser"></div> 152 <div class="theme-overlay"></div>153 153 <div id="theme-installer" class="wp-full-overlay expanded"></div> 154 154 155 155 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> … … 224 224 <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> 225 225 <span class="collapse-sidebar-arrow"></span> 226 226 </a> 227 <div class="theme-navigation"> 228 <a class="previous-theme button" href="#"><?php _e( 'Previous' ); ?></a> 229 <a class="next-theme button" href="#"><?php _e( 'Next' ); ?></a> 230 </div> 227 231 </div> 228 232 </div> 229 233 <div class="wp-full-overlay-main">