Ticket #27055: 27055.38.2.diff
| File 27055.38.2.diff, 6.4 KB (added by , 12 years ago) |
|---|
-
wp-admin/css/themes.css
216 216 * Displays a theme update notice 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); 222 223 color: #fff; … … 234 235 overflow: hidden; 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; 240 242 font: normal 20px/1 'dashicons'; … … 1074 1076 16.2 - Install Themes 1075 1077 ------------------------------------------------------------------------------*/ 1076 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 } 1097 1077 1098 .theme-navigation { 1078 1099 background: #fff; 1079 1100 -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); -
wp-admin/js/theme.js
22 22 // Adds attributes to the default data coming through the .org themes api 23 23 // Map `id` to `slug` for shared code 24 24 initialize: function() { 25 var install, preview ;25 var install, preview, installed; 26 26 27 27 // Install url for the theme 28 28 // using the install nonce … … 43 43 44 44 preview = themes.data.settings.installURI + '?' + $.param( preview ); 45 45 46 // If theme is already installed, set an attribute. 47 if ( _.indexOf( themes.data.installedThemes, this.get( 'slug' ) ) !== -1 ) { 48 this.set({ installed: true }); 49 } 50 46 51 // Set the attributes 47 52 this.set({ 48 53 installURI: install, … … 391 396 if ( this.model.get( 'displayAuthor' ) ) { 392 397 this.$el.addClass( 'display-author' ); 393 398 } 399 400 if ( this.model.get( 'installed' ) ) { 401 this.$el.addClass( 'is-installed' ); 402 this.$el.unbind(); 403 } 394 404 }, 395 405 396 406 // Adds a class to the currently active theme … … 451 461 return this.touchDrag = false; 452 462 } 453 463 464 // Allow direct link path to installing a theme. 465 if ( $( event.target ).hasClass( 'button-primary' ) ) { 466 return; 467 } 468 454 469 // 'enter' and 'space' keys expand the details view when a theme is :focused 455 470 if ( event.type === 'keydown' && ( event.which !== 13 && event.which !== 32 ) ) { 456 471 return; … … 494 509 495 510 // If we have no more themes, bail. 496 511 if ( _.isUndefined( self.current ) ) { 512 self.options.parent.parent.trigger( 'theme:end' ); 497 513 return self.current = current; 498 514 } 499 515 … … 505 521 // Render and append. 506 522 preview.render(); 507 523 $( 'div.wrap' ).append( preview.el ); 524 $( '.next-theme' ).focus(); 508 525 }) 509 526 .listenTo( preview, 'theme:previous', function() { 510 527 … … 532 549 // Render and append. 533 550 preview.render(); 534 551 $( 'div.wrap' ).append( preview.el ); 552 $( '.previous-theme' ).focus(); 535 553 }); 536 554 } 537 555 }); … … 882 900 // Loop through the themes and setup each theme view 883 901 self.instance.each( function( theme ) { 884 902 self.theme = new themes.view.Theme({ 885 model: theme 903 model: theme, 904 parent: self 886 905 }); 887 906 888 907 // Render the views... … … 1224 1243 // Get the themes by sending Ajax POST request to api.wordpress.org/themes 1225 1244 // or searching the local cache 1226 1245 this.collection.query( request ); 1246 1247 // Set route 1248 themes.router.navigate( themes.router.baseUrl( '?search=' + value ), { replace: true } ); 1227 1249 }, 300 ) 1228 1250 }); 1229 1251 … … 1329 1351 }, 1330 1352 1331 1353 sort: function( sort ) { 1332 $( '#theme-search-input' ).val( '');1354 this.clearSearch(); 1333 1355 1334 1356 $( '.theme-section, .theme-filter' ).removeClass( this.activeClass ); 1335 1357 $( '[data-sort="' + sort + '"]' ).addClass( this.activeClass ); … … 1450 1472 return this.addFilter(); 1451 1473 } 1452 1474 1475 this.clearSearch(); 1476 1477 themes.router.navigate( themes.router.baseUrl( '' ) ); 1453 1478 $( 'body' ).toggleClass( 'more-filters-opened' ); 1454 1479 }, 1455 1480 … … 1474 1499 1475 1500 backToFilters: function() { 1476 1501 $( 'body' ).removeClass( 'filters-applied' ); 1502 }, 1503 1504 clearSearch: function() { 1505 $( '#theme-search-input').val( '' ); 1477 1506 } 1478 1507 }); 1479 1508 -
wp-admin/theme-install.php
33 33 'new' => __( 'Newest Themes' ), 34 34 ); 35 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 } 42 36 43 wp_localize_script( 'theme', '_wpThemeSettings', array( 37 44 'themes' => false, 38 45 'settings' => array( … … 51 58 'back' => __( 'Back' ), 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, 56 64 ), … … 190 198 <a class="button button-primary" href="{{ data.installURI }}"><?php esc_html_e( 'Install' ); ?></a> 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 195 207 <script id="tmpl-theme-preview" type="text/template"> 196 208 <div class="wp-full-overlay-sidebar"> 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"> 202 218 <div class="install-theme-info">