Changeset 27937
- Timestamp:
- 04/03/2014 11:52:45 PM (12 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 3 edited
-
css/themes.css (modified) (4 diffs)
-
js/theme.js (modified) (18 diffs)
-
theme-install.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/themes.css
r27918 r27937 1290 1290 padding: 4px 8px; 1291 1291 } 1292 .more-filters-container .filtering-by a { 1293 margin-left: 10px; 1294 } 1292 1295 body.filters-applied .more-filters-container .filters-group, 1293 body.filters-applied .more-filters-container a ,1296 body.filters-applied .more-filters-container a.button, 1294 1297 body.filters-applied .more-filters-container br { 1295 1298 display: none !important; … … 1510 1513 z-index: 10; 1511 1514 overflow: auto; 1512 background: transparent;1515 background: #eee; 1513 1516 border-right: none; 1514 1517 } … … 1671 1674 .wp-full-overlay.collapsed .collapse-sidebar-label { 1672 1675 display: none; 1676 } 1677 1678 .wp-full-overlay .theme-navigation { 1679 padding: 10px 20px; 1680 position: absolute; 1681 bottom: 10px; 1682 text-align: left; 1683 } 1684 .wp-full-overlay .theme-navigation .next-theme { 1685 float: right; 1673 1686 } 1674 1687 … … 1751 1764 .install-theme-info { 1752 1765 display: none; 1753 padding: 10px 20px 20px;1766 padding: 10px 20px 60px; 1754 1767 } 1755 1768 -
trunk/src/wp-admin/js/theme.js
r27896 r27937 215 215 return collection; 216 216 }, 217 218 count: false, 217 219 218 220 // Handles requests for more themes … … 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 ) { … … 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. … … 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' ); … … 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' ); … … 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 … … 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 ) { … … 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 self.current = current; 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 }); … … 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', … … 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 … … 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 }, … … 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 … … 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 … … 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 … … 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 … … 1298 1386 1299 1387 $( 'body' ).addClass( 'filters-applied' ); 1388 $( '.theme-section.current' ).removeClass( 'current' ); 1300 1389 filteringBy.empty(); 1301 1390 … … 1356 1445 1357 1446 if ( $( 'body' ).hasClass( 'filters-applied' ) ) { 1358 return $( 'body' ).removeClass( 'filters-applied');1447 return this.backToFilters(); 1359 1448 } 1360 1449 … … 1385 1474 return self.filtersChecked(); 1386 1475 }); 1476 }, 1477 1478 backToFilters: function() { 1479 $( 'body' ).removeClass( 'filters-applied' ); 1387 1480 } 1388 1481 }); -
trunk/src/wp-admin/theme-install.php
r27896 r27937 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 … … 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>
Note: See TracChangeset
for help on using the changeset viewer.