Ticket #26600: 26600.9.patch
File 26600.9.patch, 10.8 KB (added by , 10 years ago) |
---|
-
src/wp-admin/css/themes.css
1141 1141 font-size: 18px; 1142 1142 font-style: normal; 1143 1143 margin: 0; 1144 padding: 100px 00;1144 padding: 0; 1145 1145 text-align: center; 1146 1146 display: none; 1147 1147 } -
src/wp-admin/js/theme.js
79 79 80 80 // Render and append 81 81 this.view.render(); 82 this.$el.find( '.themes' ).remove(); 83 this.$el.append( this.view.el ).addClass( 'rendered' ); 82 this.$el.empty().append( this.view.el ).addClass( 'rendered' ); 84 83 this.$el.append( '<br class="clear"/>' ); 85 84 }, 86 85 … … 157 156 // Useful for resetting the views when you clean the input 158 157 if ( this.terms === '' ) { 159 158 this.reset( themes.data.themes ); 159 $( 'body' ).removeClass( 'no-results' ); 160 160 } 161 161 162 162 // Trigger an 'update' event … … 831 831 // The theme count element 832 832 count: $( '.wp-core-ui .theme-count' ), 833 833 834 // The live themes count 835 liveThemeCount: 0, 836 834 837 initialize: function( options ) { 835 838 var self = this; 836 839 … … 854 857 this.listenTo( self.collection, 'query:success', function( count ) { 855 858 if ( _.isNumber( count ) ) { 856 859 self.count.text( count ); 860 self.announceSearchResults( count ); 857 861 } else { 858 862 self.count.text( self.collection.length ); 863 self.announceSearchResults( self.collection.length ); 859 864 } 860 865 }); 861 866 … … 926 931 } 927 932 928 933 // Display a live theme count for the collection 929 this.count.text( this.collection.count ? this.collection.count : this.collection.length ); 934 this.liveThemeCount = this.collection.count ? this.collection.count : this.collection.length; 935 this.count.text( this.liveThemeCount ); 936 937 this.announceSearchResults( this.liveThemeCount ); 930 938 }, 931 939 932 940 // Iterates through each instance of the collection … … 1078 1086 self.theme.trigger( 'theme:expand', previousModel.cid ); 1079 1087 1080 1088 } 1089 }, 1090 1091 // Dispatch audible search results feedback message 1092 announceSearchResults: function( count ) { 1093 if ( 0 === count ) { 1094 wp.a11y.speak( l10n.noThemesFound ); 1095 } else { 1096 wp.a11y.speak( l10n.themesFound.replace( '%d', count ) ); 1097 } 1081 1098 } 1082 1099 }); 1083 1100 … … 1091 1108 1092 1109 attributes: { 1093 1110 placeholder: l10n.searchPlaceholder, 1094 type: 'search' 1111 type: 'search', 1112 'aria-describedby': 'live-search-desc' 1095 1113 }, 1096 1114 1097 1115 events: { 1098 'input': 'search', 1099 'keyup': 'search', 1100 'change': 'search', 1101 'search': 'search', 1102 'blur': 'pushState' 1116 'input': 'search', 1117 'keyup': 'search', 1118 'blur': 'pushState' 1103 1119 }, 1104 1120 1105 1121 initialize: function( options ) { … … 1112 1128 1113 1129 }, 1114 1130 1115 // Runs a search on the theme collection.1116 1131 search: function( event ) { 1117 var options = {};1118 1119 1132 // Clear on escape. 1120 1133 if ( event.type === 'keyup' && event.which === 27 ) { 1121 1134 event.target.value = ''; 1122 1135 } 1123 1136 1124 // Lose input focus when pressing enter 1125 if ( event.which === 13 ) { 1126 this.$el.trigger( 'blur' ); 1127 } 1137 /** 1138 * Since doSearch is debounced, it will only run when user input comes to a rest 1139 */ 1140 this.doSearch( event ); 1141 }, 1128 1142 1143 // Runs a search on the theme collection. 1144 doSearch: _.debounce( function( event ) { 1145 var options = {}; 1146 1129 1147 this.collection.doSearch( event.target.value ); 1130 1148 1131 1149 // if search is initiated and key is not return … … 1141 1159 } else { 1142 1160 themes.router.navigate( themes.router.baseUrl( '' ) ); 1143 1161 } 1144 }, 1162 }, 500 ), 1145 1163 1146 1164 pushState: function( event ) { 1147 1165 var url = themes.router.baseUrl( '' ); … … 1252 1270 themes.view.InstallerSearch = themes.view.Search.extend({ 1253 1271 1254 1272 events: { 1273 'input': 'search', 1255 1274 'keyup': 'search' 1256 1275 }, 1257 1276 … … 1305 1324 1306 1325 // Set route 1307 1326 themes.router.navigate( themes.router.baseUrl( themes.router.searchPath + value ), { replace: true } ); 1308 }, 300 )1327 }, 500 ) 1309 1328 }); 1310 1329 1311 1330 themes.view.Installer = themes.view.Appearance.extend({ -
src/wp-admin/theme-install.php
44 44 ), 45 45 'l10n' => array( 46 46 'addNew' => __( 'Add New Theme' ), 47 'search' 47 'search' => __( 'Search Themes' ), 48 48 'searchPlaceholder' => __( 'Search themes...' ), // placeholder (no ellipsis) 49 49 'upload' => __( 'Upload Theme' ), 50 50 'back' => __( 'Back' ), 51 'error' => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) 51 'error' => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), 52 'themesFound' => __( 'Number of Themes found: %d' ), 53 'noThemesFound' => __( 'No themes found. Try a different search.' ), 52 54 ), 53 55 'installedThemes' => array_keys( $installed_themes ), 54 56 ) ); … … 70 72 71 73 $help_overview = 72 74 '<p>' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), 'https://wordpress.org/themes/') . '</p>' . 73 '<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter. Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.') . '</p>' .75 '<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span> ' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' . 74 76 '<p>' . __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme’s folder via FTP into your <code>/wp-content/themes</code> directory.') . '</p>'; 75 77 76 78 get_current_screen()->add_help_tab( array( … … 166 168 </div> 167 169 </div> 168 170 </div> 169 <div class="theme-browser content-filterable" aria-live="polite"> 170 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> 171 </div> 171 <div class="theme-browser content-filterable"></div> 172 172 <div class="theme-install-overlay wp-full-overlay expanded"></div> 173 174 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> 173 175 <span class="spinner"></span> 174 176 175 177 <br class="clear" /> -
src/wp-admin/themes.php
47 47 '<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' . 48 48 '<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' . 49 49 '<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' . 50 '<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>'; 50 '<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>' . 51 '<p>' . __( 'The search for installed themes will search for terms in their name, description, author, or tag.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>'; 51 52 52 53 get_current_screen()->add_help_tab( array( 53 54 'id' => 'overview', … … 107 108 'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ), 108 109 ), 109 110 'l10n' => array( 110 'addNew' => __( 'Add New Theme' ),111 'search' => __( 'Search Installed Themes' ),111 'addNew' => __( 'Add New Theme' ), 112 'search' => __( 'Search Installed Themes' ), 112 113 'searchPlaceholder' => __( 'Search installed themes...' ), // placeholder (no ellipsis) 114 'themesFound' => __( 'Number of Themes found: %d' ), 115 'noThemesFound' => __( 'No themes found. Try a different search.' ), 113 116 ), 114 117 ) ); 115 118 … … 198 201 199 202 ?> 200 203 201 <div class="theme-browser" aria-live="polite">204 <div class="theme-browser"> 202 205 <div class="themes"> 203 206 204 207 <?php … … 255 258 <?php endforeach; ?> 256 259 <br class="clear" /> 257 260 </div> 258 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>259 261 </div> 260 262 <div class="theme-overlay"></div> 261 263 264 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> 265 262 266 <?php 263 267 // List broken themes, if any. 264 268 if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) { -
src/wp-admin/update.php
201 201 if ( ! current_user_can('install_themes') ) 202 202 wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) ); 203 203 204 include_once( ABSPATH . 'wp-admin/includes/ theme-install.php' ); //for themes_api..204 include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api.. 205 205 206 206 check_admin_referer( 'install-theme_' . $theme ); 207 207 $api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth. -
src/wp-includes/script-loader.php
499 499 500 500 $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 ); 501 501 502 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone' ), false, 1 );502 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y' ), false, 1 ); 503 503 504 504 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 ); 505 505 did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(