Changeset 28025
- Timestamp:
- 04/07/2014 11:03:05 PM (10 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/themes.css
r27959 r28025 217 217 * when an update is available. 218 218 */ 219 .theme-browser .theme .theme-update { 219 .theme-browser .theme .theme-update, 220 .theme-browser .theme .theme-installed { 220 221 background: #d54e21; 221 222 background: rgba(213, 78, 33, 0.95); … … 235 236 } 236 237 237 .theme-browser .theme .theme-update:before { 238 .theme-browser .theme .theme-update:before, 239 .theme-browser .theme .theme-installed:before { 238 240 content: '\f463'; 239 241 display: inline-block; … … 1074 1076 16.2 - Install Themes 1075 1077 ------------------------------------------------------------------------------*/ 1078 1079 /* Already installed theme */ 1080 .theme-browser .theme.is-installed { 1081 cursor: default; 1082 } 1083 .theme-browser .theme .theme-installed { 1084 background: #0074a2; 1085 } 1086 .theme-browser .theme .theme-installed:before { 1087 content: '\f147'; 1088 } 1089 .theme-browser .theme.is-installed .theme-actions, 1090 .theme-browser.rendered .theme.is-installed .more-details { 1091 display: none !important; 1092 } 1093 .theme-browser.rendered .theme.is-installed:hover .theme-screenshot img, 1094 .theme-browser.rendered .theme.is-installed:focus .theme-screenshot img { 1095 opacity: 1 !important; 1096 } 1076 1097 1077 1098 .theme-navigation { -
trunk/src/wp-admin/js/theme.js
r27963 r28025 23 23 // Map `id` to `slug` for shared code 24 24 initialize: function() { 25 var install, preview;25 var install, installed; 26 26 27 27 // Install url for the theme … … 36 36 install = themes.data.settings.updateURI + '?' + $.param( install ); 37 37 38 // Preview url for the theme 39 preview = { 40 tab: 'theme-information', 41 theme: this.get( 'slug' ) 42 }; 43 44 preview = themes.data.settings.installURI + '?' + $.param( preview ); 38 // If theme is already installed, set an attribute. 39 if ( _.indexOf( themes.data.installedThemes, this.get( 'slug' ) ) !== -1 ) { 40 this.set({ installed: true }); 41 } 45 42 46 43 // Set the attributes 47 44 this.set({ 48 installURI: install, 49 previewURI: preview, 45 installURI: ( this.get( 'slug' ) ) ? install : false, 50 46 // slug is for installation, id is for existing. 51 47 id: this.get( 'slug' ) || this.get( 'id' ) … … 392 388 this.$el.addClass( 'display-author' ); 393 389 } 390 391 if ( this.model.get( 'installed' ) ) { 392 this.$el.addClass( 'is-installed' ); 393 this.$el.unbind(); 394 } 394 395 }, 395 396 … … 452 453 } 453 454 455 // Allow direct link path to installing a theme. 456 if ( $( event.target ).hasClass( 'button-primary' ) ) { 457 return; 458 } 459 454 460 // 'enter' and 'space' keys expand the details view when a theme is :focused 455 461 if ( event.type === 'keydown' && ( event.which !== 13 && event.which !== 32 ) ) { … … 495 501 // If we have no more themes, bail. 496 502 if ( _.isUndefined( self.current ) ) { 503 self.options.parent.parent.trigger( 'theme:end' ); 497 504 return self.current = current; 498 505 } … … 506 513 preview.render(); 507 514 $( 'div.wrap' ).append( preview.el ); 515 $( '.next-theme' ).focus(); 508 516 }) 509 517 .listenTo( preview, 'theme:previous', function() { … … 533 541 preview.render(); 534 542 $( 'div.wrap' ).append( preview.el ); 543 $( '.previous-theme' ).focus(); 535 544 }); 536 545 } … … 883 892 self.instance.each( function( theme ) { 884 893 self.theme = new themes.view.Theme({ 885 model: theme 894 model: theme, 895 parent: self 886 896 }); 887 897 … … 1159 1169 // Handles search route event 1160 1170 themes.router.on( 'route:search', function( query ) { 1161 self.view.trigger( 'theme:close' ); 1162 self.themes.doSearch( query ); 1171 $( '.theme-search' ).trigger( 'keyup' ); 1163 1172 }); 1164 1173 … … 1225 1234 // or searching the local cache 1226 1235 this.collection.query( request ); 1236 1237 // Set route 1238 themes.router.navigate( themes.router.baseUrl( '?search=' + value ), { replace: true } ); 1227 1239 }, 300 ) 1228 1240 }); … … 1330 1342 1331 1343 sort: function( sort ) { 1332 $( '#theme-search-input' ).val( '');1344 this.clearSearch(); 1333 1345 1334 1346 $( '.theme-section, .theme-filter' ).removeClass( this.activeClass ); … … 1451 1463 } 1452 1464 1465 this.clearSearch(); 1466 1467 themes.router.navigate( themes.router.baseUrl( '' ) ); 1453 1468 $( 'body' ).toggleClass( 'more-filters-opened' ); 1454 1469 }, … … 1475 1490 backToFilters: function() { 1476 1491 $( 'body' ).removeClass( 'filters-applied' ); 1492 }, 1493 1494 clearSearch: function() { 1495 $( '#theme-search-input').val( '' ); 1477 1496 } 1478 1497 }); … … 1483 1502 'theme-install.php?sort=:sort': 'sort', 1484 1503 'theme-install.php?upload': 'upload', 1504 'theme-install.php?search=:query': 'search', 1485 1505 '': 'sort' 1486 1506 }, … … 1488 1508 baseUrl: function( url ) { 1489 1509 return 'theme-install.php' + url; 1490 } 1510 }, 1511 1512 search: function( query ) { 1513 $( '.theme-search' ).val( query ); 1514 }, 1491 1515 }); 1492 1516 … … 1541 1565 themes.router.on( 'route:upload', function() { 1542 1566 $( 'a.upload' ).trigger( 'click' ); 1567 }); 1568 1569 // Handles search route event 1570 themes.router.on( 'route:search', function( query ) { 1571 $( '.theme-search' ).focus().trigger( 'keyup' ); 1543 1572 }); 1544 1573 -
trunk/src/wp-admin/theme-install.php
r27962 r28025 33 33 'new' => __( 'Newest Themes' ), 34 34 ); 35 36 $installed_themes = search_theme_directories(); 37 foreach ( $installed_themes as $k => $v ) { 38 if ( false !== strpos( $k, '/' ) ) { 39 unset( $installed_themes[ $k ] ); 40 } 41 } 35 42 36 43 wp_localize_script( 'theme', '_wpThemeSettings', array( … … 52 59 'error' => ( 'There was a problem trying to load the themes. Please, try again.' ), // @todo improve 53 60 ), 61 'installedThemes' => array_keys( $installed_themes ), 54 62 'browse' => array( 55 63 'sections' => $sections, … … 191 199 <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a> 192 200 </div> 201 202 <# if ( data.installed ) { #> 203 <div class="theme-installed"><?php _e( 'Already Installed' ); ?></div> 204 <# } #> 193 205 </script> 194 206 … … 197 209 <div class="wp-full-overlay-header"> 198 210 <a href="#" class="close-full-overlay button-secondary"><?php _e( 'Close' ); ?></a> 211 <# if ( data.installed ) { #> 212 <a href="#" class="button button-primary theme-install disabled"><?php _e( 'Installed' ); ?></a> 213 <# } else { #> 199 214 <a href="{{ data.installURI }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a> 215 <# } #> 200 216 </div> 201 217 <div class="wp-full-overlay-sidebar-content">
Note: See TracChangeset
for help on using the changeset viewer.