Changeset 27896
- Timestamp:
- 04/01/2014 10:19:51 PM (9 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/themes.css
r27804 r27896 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, … … 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, … … 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 … … 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; … … 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 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 box-shadow: 0 1px 1px rgba(0,0,0,0.04); 1287 font-size: 11px; 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 } 1302 p.no-themes { 1303 color: #999; 1304 font-size: 18px; 1305 font-style: normal; 1306 margin: 0; 1307 padding: 0; 1308 text-align: center; 1309 display: none; 1310 } 1311 body.no-results p.no-themes { 1312 display: block; 1313 } 1314 body.show-upload-theme p.no-themes { 1315 display: none !important; 1316 } 1317 1247 1318 1248 1319 .theme-install-php .add-new-theme { … … 1269 1340 } 1270 1341 .more-filters-container .filters-group { 1271 width: 50%; 1342 margin-bottom: 0; 1343 margin-top: 5px; 1344 width: 49%; 1272 1345 } 1273 1346 .more-filters-container .filters-group:nth-child(3n) { 1274 1347 clear: left; 1348 } 1349 } 1350 1351 @media only screen and (max-width: 782px) { 1352 .more-filters-container .filters-group { 1353 width: 100%; 1275 1354 } 1276 1355 } … … 1718 1797 color: #777; 1719 1798 line-height: 20px; 1799 max-width: 100%; 1720 1800 } 1721 1801 -
trunk/src/wp-admin/js/theme.js
r27845 r27896 256 256 self.trigger( 'query:success', count ); 257 257 258 if ( data.themes.length === 0 ) { 259 self.trigger( 'query:empty' ); 260 } 261 258 262 // Store the results and the query request 259 263 queries.push( { themes: data.themes, request: request } ); … … 276 280 self.trigger( 'query:fail' ); 277 281 }); 282 } 283 284 if ( query.themes.length === 0 ) { 285 self.trigger( 'query:empty' ); 286 } else { 287 $( 'body' ).removeClass( 'no-results' ); 278 288 } 279 289 … … 331 341 if ( ! paginated ) { 332 342 // Spin it 333 $( 'body' ).addClass( 'loading-themes' ) ;343 $( 'body' ).addClass( 'loading-themes' ).removeClass( 'no-results' ); 334 344 } 335 345 } … … 658 668 659 669 collapse: function() { 670 660 671 this.$el.toggleClass( 'collapsed' ).toggleClass( 'expanded' ); 661 672 return false; … … 703 714 self.count.text( self.collection.length ); 704 715 } 716 }); 717 718 this.listenTo( self.collection, 'query:empty', function() { 719 $( 'body' ).addClass( 'no-results' ); 705 720 }); 706 721 … … 1144 1159 'click .theme-filter': 'onFilter', 1145 1160 'click .more-filters': 'moreFilters', 1146 'click [type="checkbox"]': 'addFilter' 1161 'click .apply-filters': 'addFilter', 1162 'click [type="checkbox"]': 'filtersChecked', 1163 'click .clear-filters': 'clearFilters', 1164 'click .feature-name': 'filterSection' 1147 1165 }, 1148 1166 … … 1218 1236 event.preventDefault(); 1219 1237 1238 $( 'body' ).removeClass( 'filters-applied more-filters-opened' ); 1239 1220 1240 // Bail if this is already active 1221 1241 if ( $el.hasClass( this.activeClass ) ) { … … 1267 1287 1268 1288 // Clicking on a checkbox triggers a tag request 1269 addFilter: function() { 1270 var tags = this.filtersChecked(), 1271 request = { tag: tags }; 1289 addFilter: function( event ) { 1290 var name, 1291 tags = this.filtersChecked(), 1292 request = { tag: tags }, 1293 filteringBy = $( '.filtering-by .tags' ); 1294 1295 if ( event ) { 1296 event.preventDefault(); 1297 } 1298 1299 $( 'body' ).addClass( 'filters-applied' ); 1300 filteringBy.empty(); 1301 1302 _.each( tags, function( tag ) { 1303 name = $( 'label[for="feature-id-' + tag + '"]' ).text(); 1304 filteringBy.append( '<span class="tag">' + name + '</span>' ); 1305 }); 1272 1306 1273 1307 // Get the themes by sending Ajax POST request to api.wordpress.org/themes … … 1276 1310 }, 1277 1311 1278 // Get the checked filters and return an array 1312 // Get the checked filters 1313 // @return {array} of tags or false 1279 1314 filtersChecked: function() { 1280 1315 var items = $( '.feature-group' ).find( ':checkbox' ), … … 1284 1319 tags.push( $( item ).prop( 'value' ) ); 1285 1320 }); 1321 1322 // When no filters are checked, restore initial state and return 1323 if ( tags.length === 0 ) { 1324 $( '.apply-filters' ).find( 'span' ).text( '' ); 1325 $( '.clear-filters' ).hide(); 1326 $( 'body' ).removeClass( 'filters-applied' ); 1327 return false; 1328 } 1329 1330 $( '.apply-filters' ).find( 'span' ).text( tags.length ); 1331 $( '.clear-filters' ).css( 'display', 'inline-block' ); 1286 1332 1287 1333 return tags; … … 1305 1351 }, 1306 1352 1307 moreFilters: function() { 1353 // Toggle the full filters navigation 1354 moreFilters: function( event ) { 1355 event.preventDefault(); 1356 1357 if ( $( 'body' ).hasClass( 'filters-applied' ) ) { 1358 return $( 'body' ).removeClass( 'filters-applied' ); 1359 } 1360 1361 // If the filters section is opened and filters are checked 1362 // run the relevant query collapsing to filtered-by state 1363 if ( $( 'body' ).hasClass( 'more-filters-opened' ) && this.filtersChecked() ) { 1364 return this.addFilter(); 1365 } 1366 1308 1367 $( 'body' ).toggleClass( 'more-filters-opened' ); 1368 }, 1369 1370 // Expand/collapse each individual filter section 1371 filterSection: function() { 1372 $( event.target ).parent().toggleClass( 'open' ); 1373 }, 1374 1375 // Clears all the checked filters 1376 // @uses filtersChecked() 1377 clearFilters: function( event ) { 1378 var items = $( '.feature-group' ).find( ':checkbox' ), 1379 self = this; 1380 1381 event.preventDefault(); 1382 1383 _.each( items.filter( ':checked' ), function( item ) { 1384 $( item ).prop( 'checked', false ); 1385 return self.filtersChecked(); 1386 }); 1309 1387 } 1310 1388 }); -
trunk/src/wp-admin/theme-install.php
r27804 r27896 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> -->121 <!-- <span class="theme-filter" data-filter="photoblogging">Photography</span> 122 <span class="theme-filter" data-filter="responsive-layout">Responsive</span> --> 123 123 <a class="more-filters" href="#"><?php _e( 'Feature Filter' ); ?></a> 124 124 </div> … … 141 141 ?> 142 142 <br class="clear" /> 143 <a class="apply-filters button button-secondary" href="#"><?php _e( 'Apply Filters' ); ?><span></span></a> 144 <a class="clear-filters button button-secondary" href="#"><?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> … … 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 … … 189 196 <div class="wp-full-overlay-sidebar"> 190 197 <div class="wp-full-overlay-header"> 191 <a href=" " class="close-full-overlay button-secondary"><?php _e( 'Close' ); ?></a>198 <a href="#" class="close-full-overlay button-secondary"><?php _e( 'Close' ); ?></a> 192 199 <a href="{{ data.installURI }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a> 193 200 </div> … … 214 221 </div> 215 222 <div class="wp-full-overlay-footer"> 216 <a href=" " class="collapse-sidebar" title="<?php esc_attr_e( 'Collapse Sidebar' ); ?>">223 <a href="#" class="collapse-sidebar" title="<?php esc_attr_e( 'Collapse Sidebar' ); ?>"> 217 224 <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> 218 225 <span class="collapse-sidebar-arrow"></span>
Note: See TracChangeset
for help on using the changeset viewer.