Ticket #27055: 27055.22.diff
| File 27055.22.diff, 6.6 KB (added by , 12 years ago) |
|---|
-
wp-admin/css/themes.css
1230 1230 body.more-filters-opened .more-filters-container { 1231 1231 display: block; 1232 1232 } 1233 body.more-filters-opened .theme-section.current { 1234 border-bottom: none; 1235 } 1233 1236 .more-filters-container .filters-group { 1234 1237 -webkit-box-sizing: border-box; 1235 1238 -moz-box-sizing: border-box; 1236 1239 box-sizing: border-box; 1237 1240 float: left; 1238 width: 20%; 1241 width: 19%; 1242 background: #fff; 1243 margin: 0 1% 0 0; 1244 border: 1px solid #e5e5e5; 1245 -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04); 1246 box-shadow: 0 1px 1px rgba(0,0,0,0.04); 1247 padding: 10px; 1239 1248 } 1240 1249 .more-filters-container .feature-name { 1241 margin-top: 0; 1250 cursor: pointer; 1251 margin: 0; 1252 position: relative; 1242 1253 } 1243 1254 .more-filters-container ol { 1244 1255 list-style-type: none; 1256 margin: 20px 0 0; 1257 display: block; 1258 font-size: 12px; 1259 } 1260 .theme-navigation .more-filters-container .apply-filters { 1261 margin: 20px 0 0; 1262 } 1263 .theme-navigation .more-filters-container .clear-filters { 1264 display: none; 1265 margin: 20px 0 0 10px; 1266 } 1267 .more-filters-container .apply-filters span { 1268 display: inline-block; 1269 font-size: 12px; 1270 text-indent: 10px; 1271 opacity: 0.8; 1272 } 1273 .more-filters-container .filtering-by { 1274 display: none; 1245 1275 margin: 0; 1246 1276 } 1277 .more-filters-container .filtering-by > span { 1278 font-weight: 600; 1279 } 1280 .more-filters-container .filtering-by .tags { 1281 display: inline; 1282 } 1283 .more-filters-container .filtering-by .tag { 1284 background: #fff; 1285 border: 1px solid #e5e5e5; 1286 -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04); 1287 box-shadow: 0 1px 1px rgba(0,0,0,0.04); 1288 margin: 0 5px; 1289 padding: 4px 8px; 1290 } 1291 body.filters-applied .more-filters-container .filters-group, 1292 body.filters-applied .more-filters-container a, 1293 body.filters-applied .more-filters-container br { 1294 display: none !important; 1295 } 1296 body.filters-applied .more-filters-container .filtering-by { 1297 display: block; 1298 } 1299 body.filters-applied .more-filters-container { 1300 padding: 20px; 1301 } 1247 1302 1303 1248 1304 .theme-install-php .add-new-theme { 1249 1305 display: none !important; 1250 1306 } … … 1268 1324 text-align: left; 1269 1325 } 1270 1326 .more-filters-container .filters-group { 1271 width: 50%; 1327 margin-bottom: 0; 1328 margin-top: 5px; 1329 width: 49%; 1272 1330 } 1273 1331 .more-filters-container .filters-group:nth-child(3n) { 1274 1332 clear: left; 1275 1333 } 1276 1334 } 1277 1335 1336 @media only screen and (max-width: 782px) { 1337 .more-filters-container .filters-group { 1338 width: 100%; 1339 } 1340 } 1341 1278 1342 .rating { 1279 1343 margin: 30px 0; 1280 1344 } -
wp-admin/js/theme.js
1143 1143 'click .theme-section': 'onSort', 1144 1144 'click .theme-filter': 'onFilter', 1145 1145 'click .more-filters': 'moreFilters', 1146 'click [type="checkbox"]': 'addFilter' 1146 'click .apply-filters': 'addFilter', 1147 'click [type="checkbox"]': 'filtersChecked', 1148 'click .clear-filters': 'clearFilters', 1149 'click .feature-name': 'filterSection' 1147 1150 }, 1148 1151 1149 1152 // Handles all the rendering of the public theme directory … … 1217 1220 1218 1221 event.preventDefault(); 1219 1222 1223 $( 'body' ).removeClass( 'filters-applied more-filters-opened' ); 1224 1220 1225 // Bail if this is already active 1221 1226 if ( $el.hasClass( this.activeClass ) ) { 1222 1227 return; … … 1268 1273 // Clicking on a checkbox triggers a tag request 1269 1274 addFilter: function() { 1270 1275 var tags = this.filtersChecked(), 1271 request = { tag: tags }; 1276 request = { tag: tags }, 1277 filteringBy = $( '.filtering-by .tags' ); 1272 1278 1279 $( 'body' ).addClass( 'filters-applied' ); 1280 filteringBy.empty(); 1281 1282 _.each( tags, function( tag ) { 1283 filteringBy.append( '<span class="tag">' + tag + '</span>' ); 1284 }); 1285 1273 1286 // Get the themes by sending Ajax POST request to api.wordpress.org/themes 1274 1287 // or searching the local cache 1275 1288 this.collection.query( request ); 1276 1289 }, 1277 1290 1278 // Get the checked filters and return an array 1291 // Get the checked filters 1292 // @return {array} of tags or false 1279 1293 filtersChecked: function() { 1280 1294 var items = $( '.feature-group' ).find( ':checkbox' ), 1281 1295 tags = []; … … 1284 1298 tags.push( $( item ).prop( 'value' ) ); 1285 1299 }); 1286 1300 1301 // When no filters are checked, restore initial state and return 1302 if ( tags.length === 0 ) { 1303 $( '.apply-filters' ).find( 'span' ).text( '' ); 1304 $( '.clear-filters' ).hide(); 1305 $( 'body' ).removeClass( 'filters-applied' ); 1306 return false; 1307 } 1308 1309 $( '.apply-filters' ).find( 'span' ).text( tags.length ); 1310 $( '.clear-filters' ).css( 'display', 'inline-block' ); 1311 1287 1312 return tags; 1288 1313 }, 1289 1314 … … 1304 1329 }); 1305 1330 }, 1306 1331 1332 // Toggle the full filters navigation 1307 1333 moreFilters: function() { 1334 if ( $( 'body' ).hasClass( 'filters-applied' ) ) { 1335 return $( 'body' ).removeClass( 'filters-applied' ); 1336 } 1337 1308 1338 $( 'body' ).toggleClass( 'more-filters-opened' ); 1339 }, 1340 1341 // Expand/collapse each individual filter section 1342 filterSection: function() { 1343 $( event.target ).parent().toggleClass( 'open' ); 1344 }, 1345 1346 // Clears all the checked filters 1347 // @uses filtersChecked() 1348 clearFilters: function() { 1349 var items = $( '.feature-group' ).find( ':checkbox' ), 1350 self = this; 1351 1352 _.each( items.filter( ':checked' ), function( item ) { 1353 $( item ).prop( 'checked', false ); 1354 return self.filtersChecked(); 1355 }); 1309 1356 } 1310 1357 }); 1311 1358 -
wp-admin/theme-install.php
118 118 <a class="theme-section" href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a> 119 119 <a class="theme-section" href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a> 120 120 <div class="theme-top-filters"> 121 <!-- <span class="theme-filter" data-filter="photoblogging">Photography</span>122 <span class="theme-filter" data-filter="responsive-layout">Responsive</span> -->123 <a class="more-filters" href="#"><?php _e( ' Feature Filter' ); ?></a>121 <!-- <span class="theme-filter" data-filter="photoblogging">Photography</span> 122 <span class="theme-filter" data-filter="responsive-layout">Responsive</span> --> 123 <a class="more-filters" href="#"><?php _e( 'All' ); ?></a> 124 124 </div> 125 125 <div class="more-filters-container"> 126 126 <?php … … 140 140 } 141 141 ?> 142 142 <br class="clear" /> 143 <a class="apply-filters button button-secondary"><?php _e( 'Apply Filters' ); ?><span></span></a> 144 <a class="clear-filters button button-secondary"><?php _e( 'Clear' ); ?></a> 145 <div class="filtering-by"> 146 <span><?php _e( 'Filtering by:' ); ?></span> 147 <div class="tags"></div> 148 </div> 143 149 </div> 144 150 </div> 145 151 <div class="theme-browser"></div>