Ticket #27055: 27055.26.diff
| File 27055.26.diff, 9.8 KB (added by , 12 years ago) |
|---|
-
wp-admin/css/themes.css
1150 1150 display: inline-block; 1151 1151 margin: 0 10px; 1152 1152 padding: 15px 0; 1153 -webkit-transition: border-color .1s ease-in;1154 transition: border-color .1s ease-in;1155 1153 } 1156 1154 .theme-section.current, 1157 1155 .theme-filter.current { … … 1167 1165 display: inline-block; 1168 1166 margin: 0 10px; 1169 1167 padding: 4px 6px; 1170 -webkit-transition: color .1s ease-in, background .1s ease-in;1171 transition: color .1s ease-in, background .1s ease-in;1172 1168 } 1173 1169 body.more-filters-opened .more-filters, 1174 1170 body.more-filters-opened .more-filters:before { … … 1177 1173 border-radius: 2px; 1178 1174 border: none; 1179 1175 color: #fff; 1180 -webkit-transition: color .1s ease-in, background .1s ease-in;1181 transition: color .1s ease-in, background .1s ease-in;1182 1176 } 1183 1177 1184 1178 body.more-filters-opened .more-filters:hover, … … 1230 1224 body.more-filters-opened .more-filters-container { 1231 1225 display: block; 1232 1226 } 1227 body.more-filters-opened .theme-section.current { 1228 border-bottom: none; 1229 } 1230 body.more-filters-opened .theme-browser, 1231 body.more-filters-opened.filters-applied.loading-themes .theme-browser { 1232 display: none; 1233 } 1234 body.more-filters-opened.filters-applied .theme-browser { 1235 display: block; 1236 } 1233 1237 .more-filters-container .filters-group { 1234 1238 -webkit-box-sizing: border-box; 1235 1239 -moz-box-sizing: border-box; 1236 1240 box-sizing: border-box; 1237 1241 float: left; 1238 width: 20%; 1242 width: 19%; 1243 background: #fff; 1244 margin: 0 1% 0 0; 1245 border: 1px solid #e5e5e5; 1246 -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.04); 1247 box-shadow: 0 1px 1px rgba(0,0,0,0.04); 1248 padding: 10px; 1239 1249 } 1240 1250 .more-filters-container .feature-name { 1241 margin-top: 0; 1251 cursor: pointer; 1252 margin: 0; 1253 position: relative; 1242 1254 } 1243 1255 .more-filters-container ol { 1244 1256 list-style-type: none; 1257 margin: 20px 0 0; 1258 display: block; 1259 font-size: 12px; 1260 } 1261 .theme-navigation .more-filters-container .apply-filters { 1262 margin: 20px 0 0; 1263 } 1264 .theme-navigation .more-filters-container .clear-filters { 1265 display: none; 1266 margin: 20px 0 0 10px; 1267 } 1268 .more-filters-container .apply-filters span { 1269 display: inline-block; 1270 font-size: 12px; 1271 text-indent: 10px; 1272 opacity: 0.8; 1273 } 1274 .more-filters-container .filtering-by { 1275 display: none; 1245 1276 margin: 0; 1246 1277 } 1278 .more-filters-container .filtering-by > span { 1279 font-weight: 600; 1280 } 1281 .more-filters-container .filtering-by .tags { 1282 display: inline; 1283 } 1284 .more-filters-container .filtering-by .tag { 1285 background: #fff; 1286 border: 1px solid #e5e5e5; 1287 box-shadow: 0 1px 1px rgba(0,0,0,0.04); 1288 font-size: 11px; 1289 margin: 0 5px; 1290 padding: 4px 8px; 1291 } 1292 body.filters-applied .more-filters-container .filters-group, 1293 body.filters-applied .more-filters-container a, 1294 body.filters-applied .more-filters-container br { 1295 display: none !important; 1296 } 1297 body.filters-applied .more-filters-container .filtering-by { 1298 display: block; 1299 } 1300 body.filters-applied .more-filters-container { 1301 padding: 20px; 1302 } 1303 p.no-themes { 1304 color: #999; 1305 font-size: 18px; 1306 font-style: normal; 1307 margin: 0; 1308 padding: 0; 1309 text-align: center; 1310 display: none; 1311 } 1312 body.no-results p.no-themes { 1313 display: block; 1314 } 1315 body.show-upload-theme p.no-themes { 1316 display: none !important; 1317 } 1247 1318 1319 1248 1320 .theme-install-php .add-new-theme { 1249 1321 display: none !important; 1250 1322 } … … 1268 1340 text-align: left; 1269 1341 } 1270 1342 .more-filters-container .filters-group { 1271 width: 50%; 1343 margin-bottom: 0; 1344 margin-top: 5px; 1345 width: 49%; 1272 1346 } 1273 1347 .more-filters-container .filters-group:nth-child(3n) { 1274 1348 clear: left; 1275 1349 } 1276 1350 } 1277 1351 1352 @media only screen and (max-width: 782px) { 1353 .more-filters-container .filters-group { 1354 width: 100%; 1355 } 1356 } 1357 1278 1358 .rating { 1279 1359 margin: 30px 0; 1280 1360 } … … 1717 1797 float: left; 1718 1798 color: #777; 1719 1799 line-height: 20px; 1800 max-width: 100%; 1720 1801 } 1721 1802 1722 1803 #theme-installer .wp-full-overlay-header { -
wp-admin/js/theme.js
229 229 self = this, 230 230 query, isPaginated, count; 231 231 232 console.log(this.currentQuery); 233 232 234 // Search the query cache for matches. 233 235 query = _.find( queries, function( query ) { 234 236 return _.isEqual( query.request, request ); … … 255 257 self.trigger( 'update' ); 256 258 self.trigger( 'query:success', count ); 257 259 260 if ( data.themes.length === 0 ) { 261 self.trigger( 'query:empty' ); 262 } 263 258 264 // Store the results and the query request 259 265 queries.push( { themes: data.themes, request: request } ); 260 266 }).fail( function() { … … 277 283 }); 278 284 } 279 285 286 if ( query.themes.length === 0 ) { 287 self.trigger( 'query:empty' ); 288 } else { 289 $( 'body' ).removeClass( 'no-results' ); 290 } 291 280 292 // Only trigger an update event since we already have the themes 281 293 // on our cached object 282 294 this.reset( query.themes ); … … 330 342 beforeSend: function() { 331 343 if ( ! paginated ) { 332 344 // Spin it 333 $( 'body' ).addClass( 'loading-themes' ) ;345 $( 'body' ).addClass( 'loading-themes' ).removeClass( 'no-results' ); 334 346 } 335 347 } 336 348 }); … … 704 716 } 705 717 }); 706 718 719 this.listenTo( self.collection, 'query:empty', function() { 720 $( 'body' ).addClass( 'no-results' ); 721 }); 722 707 723 this.listenTo( this.parent, 'theme:scroll', function() { 708 724 self.renderThemes( self.parent.page ); 709 725 }); … … 1143 1159 'click .theme-section': 'onSort', 1144 1160 'click .theme-filter': 'onFilter', 1145 1161 'click .more-filters': 'moreFilters', 1146 'click [type="checkbox"]': 'addFilter' 1162 'click .apply-filters': 'addFilter', 1163 'click [type="checkbox"]': 'filtersChecked', 1164 'click .clear-filters': 'clearFilters', 1165 'click .feature-name': 'filterSection' 1147 1166 }, 1148 1167 1149 1168 // Handles all the rendering of the public theme directory … … 1217 1236 1218 1237 event.preventDefault(); 1219 1238 1239 $( 'body' ).removeClass( 'filters-applied more-filters-opened' ); 1240 1220 1241 // Bail if this is already active 1221 1242 if ( $el.hasClass( this.activeClass ) ) { 1222 1243 return; … … 1268 1289 // Clicking on a checkbox triggers a tag request 1269 1290 addFilter: function() { 1270 1291 var tags = this.filtersChecked(), 1271 request = { tag: tags }; 1292 request = { tag: tags }, 1293 filteringBy = $( '.filtering-by .tags' ), 1294 name; 1272 1295 1296 $( 'body' ).addClass( 'filters-applied' ); 1297 filteringBy.empty(); 1298 1299 _.each( tags, function( tag ) { 1300 name = $( 'label[for="feature-id-' + tag + '"]' ).text(); 1301 filteringBy.append( '<span class="tag">' + name + '</span>' ); 1302 }); 1303 1273 1304 // Get the themes by sending Ajax POST request to api.wordpress.org/themes 1274 1305 // or searching the local cache 1275 1306 this.collection.query( request ); 1276 1307 }, 1277 1308 1278 // Get the checked filters and return an array 1309 // Get the checked filters 1310 // @return {array} of tags or false 1279 1311 filtersChecked: function() { 1280 1312 var items = $( '.feature-group' ).find( ':checkbox' ), 1281 1313 tags = []; … … 1284 1316 tags.push( $( item ).prop( 'value' ) ); 1285 1317 }); 1286 1318 1319 // When no filters are checked, restore initial state and return 1320 if ( tags.length === 0 ) { 1321 $( '.apply-filters' ).find( 'span' ).text( '' ); 1322 $( '.clear-filters' ).hide(); 1323 $( 'body' ).removeClass( 'filters-applied' ); 1324 return false; 1325 } 1326 1327 $( '.apply-filters' ).find( 'span' ).text( tags.length ); 1328 $( '.clear-filters' ).css( 'display', 'inline-block' ); 1329 1287 1330 return tags; 1288 1331 }, 1289 1332 … … 1304 1347 }); 1305 1348 }, 1306 1349 1350 // Toggle the full filters navigation 1307 1351 moreFilters: function() { 1352 if ( $( 'body' ).hasClass( 'filters-applied' ) ) { 1353 return $( 'body' ).removeClass( 'filters-applied' ); 1354 } 1355 1356 // If the filters section is opened and filters are checked 1357 // run the relevant query collapsing to filtered-by state 1358 if ( $( 'body' ).hasClass( 'more-filters-opened' ) && this.filtersChecked() ) { 1359 return this.addFilter(); 1360 } 1361 1308 1362 $( 'body' ).toggleClass( 'more-filters-opened' ); 1363 }, 1364 1365 // Expand/collapse each individual filter section 1366 filterSection: function() { 1367 $( event.target ).parent().toggleClass( 'open' ); 1368 }, 1369 1370 // Clears all the checked filters 1371 // @uses filtersChecked() 1372 clearFilters: function() { 1373 var items = $( '.feature-group' ).find( ':checkbox' ), 1374 self = this; 1375 1376 _.each( items.filter( ':checked' ), function( item ) { 1377 $( item ).prop( 'checked', false ); 1378 return self.filtersChecked(); 1379 }); 1309 1380 } 1310 1381 }); 1311 1382 -
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> 146 152 <div class="theme-overlay"></div> 147 153 <div id="theme-installer" class="wp-full-overlay expanded"></div> 148 154 155 <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> 149 156 <span class="spinner"></span> 150 157 151 158 <br class="clear" />