Ticket #27055: 27055.14.diff
| File 27055.14.diff, 8.2 KB (added by , 12 years ago) |
|---|
-
wp-admin/includes/theme-install.php
134 134 } 135 135 // add_action('install_themes_dashboard', 'install_themes_dashboard'); 136 136 137 /** 138 * Display all the available tag filters. 139 * 140 * @since 3.9.0 141 */ 142 function install_themes_more_filters() { 143 144 $feature_list = get_theme_feature_list(); 145 146 foreach ( (array) $feature_list as $feature_name => $features ) { 147 echo '<div class="filters-group">'; 148 $feature_name = esc_html( $feature_name ); 149 echo '<h4 class="feature-name">' . $feature_name . '</h4>'; 150 151 echo '<ol class="feature-group">'; 152 foreach ( $features as $feature => $feature_name ) { 153 $feature_name = esc_html( $feature_name ); 154 $feature = esc_attr($feature); 155 ?> 156 <li> 157 <input type="checkbox" name="features[]" id="feature-id-<?php echo $feature; ?>" value="<?php echo $feature; ?>" /> 158 <label for="feature-id-<?php echo $feature; ?>"><?php echo $feature_name; ?></label> 159 </li> 160 <?php } ?> 161 </ol> 162 </div> 163 <?php } ?> 164 <br class="clear" /> 165 <?php 166 } 167 137 168 function install_themes_upload() { 138 169 ?> 139 170 <p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.'); ?></p> -
wp-admin/js/theme.js
992 992 events: { 993 993 'click .theme-section': 'onSort', 994 994 'click .theme-filter': 'onFilter', 995 'click .more-filters': 'moreFilters' 995 'click .more-filters': 'moreFilters', 996 'click [type="checkbox"]': 'addFilter' 996 997 }, 997 998 998 999 // Send Ajax POST request to api.wordpress.org/themes … … 1126 1127 // using the default values 1127 1128 1128 1129 // @todo Cache the collection after fetching based on the filter 1130 filter = _.union( filter, this.filtersChecked() ); 1129 1131 request = { tag: [ filter ] }; 1130 1132 1131 1133 // Send Ajax POST request to api.wordpress.org/themes … … 1146 1148 return false; 1147 1149 }, 1148 1150 1151 // Clicking on a checkbox triggers a tag request 1152 addFilter: function() { 1153 var self = this, 1154 tags = this.filtersChecked(), 1155 request = { tag: tags }; 1156 1157 // Send Ajax POST request to api.wordpress.org/themes 1158 this.apiCall( request ).done( function( data ) { 1159 // Update the collection with the queried data 1160 self.collection.reset( data.themes ); 1161 // Trigger a collection refresh event to render the views 1162 self.collection.trigger( 'update' ); 1163 1164 // Un-spin it 1165 $( 'body' ).removeClass( 'loading-themes' ); 1166 $( '.theme-browser' ).find( 'div.error' ).remove(); 1167 }).fail( function() { 1168 $( '.theme-browser' ).find( 'div.error' ).remove(); 1169 $( '.theme-browser' ).append( '<div class="error"><p>' + l10n.error + '</p></div>' ); 1170 }); 1171 }, 1172 1173 // Get the checked filters and return an array 1174 filtersChecked: function() { 1175 var items = $( '.feature-group' ).find( ':checkbox' ), 1176 tags = []; 1177 1178 _.each( items.filter( ':checked' ), function( item ) { 1179 tags.push( $( item ).prop( 'value' ) ); 1180 }); 1181 1182 return tags; 1183 }, 1184 1149 1185 activeClass: 'current', 1150 1186 1151 1187 // Overwrite search container class to append search … … 1153 1189 searchContainer: $( '.theme-navigation' ), 1154 1190 1155 1191 uploader: function() { 1156 $( 'a.upload.button' ).on( 'click', function() { 1157 $( '.upload-theme' ) 1158 .toggleClass( 'opened' ) 1159 .hasClass( 'opened' ) ? $( this ).text( l10n.back ) : $( this ).text( l10n.upload ); 1192 $( 'a.upload' ).on( 'click', function() { 1193 $( 'body' ).addClass( 'show-upload-theme' ); 1194 themes.router.navigate( themes.router.baseUrl( '?upload' ), { replace: true } ); 1160 1195 }); 1196 $( 'a.browse-themes' ).on( 'click', function() { 1197 $( 'body' ).removeClass( 'show-upload-theme' ); 1198 themes.router.navigate( themes.router.baseUrl( '' ), { replace: true } ); 1199 }); 1161 1200 }, 1162 1201 1163 1202 moreFilters: function() { … … 1168 1207 themes.InstallerRouter = Backbone.Router.extend({ 1169 1208 routes: { 1170 1209 'theme-install.php?theme=:slug': 'preview', 1171 'theme-install.php(?sort=:sort)': 'sort', 1210 'theme-install.php?sort=:sort': 'sort', 1211 'theme-install.php?upload': 'upload', 1172 1212 '': 'sort' 1173 1213 }, 1174 1214 … … 1225 1265 self.view.trigger( 'theme:close' ); 1226 1266 }); 1227 1267 1268 themes.router.on( 'route:upload', function( slug ) { 1269 $( 'a.upload' ).trigger( 'click' ); 1270 }); 1271 1228 1272 this.extraRoutes(); 1229 1273 }, 1230 1274 -
wp-admin/css/themes.css
1065 1065 16.2 - Install Themes 1066 1066 ------------------------------------------------------------------------------*/ 1067 1067 1068 .theme-install-php h2 .upload {1069 margin-left: 10px;1070 }1071 1068 .theme-navigation { 1072 1069 background: #fff; 1073 1070 box-shadow: 0 1px 1px 0 rgba(0,0,0,.1); … … 1081 1078 position: relative; 1082 1079 width: 100%; 1083 1080 } 1081 .theme-install-php a.upload, 1082 .theme-install-php a.browse-themes { 1083 cursor: pointer; 1084 } 1085 .theme-install-php a.browse-themes, 1086 .theme-install-php.show-upload-theme a.upload { 1087 display: none; 1088 } 1089 .theme-install-php.show-upload-theme a.browse-themes { 1090 display: inline; 1091 } 1084 1092 .upload-theme { 1085 1093 -moz-box-sizing: border-box; 1086 1094 box-sizing: border-box; … … 1092 1100 position: relative; 1093 1101 top: 10px; 1094 1102 } 1095 .upload-theme.opened{1103 body.show-upload-theme .upload-theme { 1096 1104 display: block; 1097 1105 } 1098 1106 .upload-theme .wp-upload-form { … … 1110 1118 padding: 40px 0 0; 1111 1119 text-align: center; 1112 1120 } 1113 .upload-theme.opened+ .theme-navigation,1114 .upload-theme.opened+ .theme-navigation + .theme-browser {1121 body.show-upload-theme .upload-theme + .theme-navigation, 1122 body.show-upload-theme .upload-theme + .theme-navigation + .theme-browser { 1115 1123 display: none; 1116 1124 } 1117 1125 .theme-navigation .theme-count { 1118 top: 3px;1119 1126 margin-left: 0; 1127 position: absolute; 1128 top: 12px; 1120 1129 } 1130 .theme-count + .theme-section { 1131 margin-left: 60px; 1132 } 1121 1133 .theme-section, 1122 1134 .theme-filter { 1123 1135 border-bottom: 4px solid #fff; … … 1148 1160 transition: color .1s ease-in, background .1s ease-in; 1149 1161 } 1150 1162 body.more-filters-opened .more-filters, 1151 .theme-navigation .more-filters.current{1163 body.more-filters-opened .more-filters:before { 1152 1164 background: rgb(46, 162, 204); 1153 1165 border-radius: 2px; 1154 1166 border: none; … … 1197 1209 body.more-filters-opened .more-filters-container { 1198 1210 display: block; 1199 1211 } 1212 .more-filters-container .filters-group { 1213 -moz-box-sizing: border-box; 1214 box-sizing: border-box; 1215 float: left; 1216 width: 20%; 1217 } 1218 .more-filters-container .feature-name { 1219 margin-top: 0; 1220 } 1221 .more-filters-container ol { 1222 list-style-type: none; 1223 margin: 0; 1224 } 1225 1200 1226 .theme-install-php .add-new-theme { 1201 1227 display: none !important; 1202 1228 } 1203 1229 1230 @media only screen and (max-width: 1120px) { 1231 .theme-install-php .theme-search { 1232 margin: 20px 0; 1233 position: static; 1234 width: 100%; 1235 } 1236 .more-filters-container { 1237 border-bottom: 1px solid #eee; 1238 } 1239 .upload-theme .wp-upload-form { 1240 margin: 20px 0; 1241 max-width: 100%; 1242 } 1243 .upload-theme .install-help { 1244 font-size: 15px; 1245 padding: 20px 0 0; 1246 text-align: left; 1247 } 1248 .more-filters-container .filters-group { 1249 width: 50%; 1250 } 1251 .more-filters-container .filters-group:nth-child(3n) { 1252 clear: left; 1253 } 1254 } 1255 1204 1256 .rating { 1205 1257 margin: 30px 0; 1206 1258 } -
wp-admin/theme-install.php
104 104 <div class="wrap"> 105 105 <h2> 106 106 <?php echo esc_html( $title ); ?> 107 <a class="upload button button-secondary"><?php esc_html_e( 'Upload Theme' ); ?></a> 107 <a class="upload add-new-h2"><?php esc_html_e( 'Upload Theme' ); ?></a> 108 <a class="browse-themes add-new-h2"><?php esc_html_e( 'Browse' ); ?></a> 108 109 </h2> 109 110 110 111 <div class="upload-theme"> … … 119 120 <div class="theme-top-filters"> 120 121 <span class="theme-filter" data-filter="photoblogging">Photography</span> 121 122 <span class="theme-filter" data-filter="responsive-layout">Responsive</span> 122 <span class=" theme-filtermore-filters">More</span>123 <span class="more-filters">More</span> 123 124 </div> 124 125 <div class="more-filters-container"> 125 Display more filters.126 <?php install_themes_more_filters(); ?> 126 127 </div> 127 128 </div> 128 129 <div class="theme-browser"></div>