WordPress.org

Make WordPress Core

Ticket #19816: 19816.diff

File 19816.diff, 4.2 KB (added by helenyhou, 16 months ago)

First rough pass

  • wp-admin/js/theme-preview.dev.js

     
    5454                return false; 
    5555        } ); 
    5656 
     57 
    5758        // Theme details 
     59 
     60        var currentTheme, nextLower; 
     61 
    5862        $('#availablethemes').on('click', 'a.theme-detail', function (event) { 
    59                 $(this).siblings('.themedetaildiv').toggle(); 
     63 
     64                if ( currentTheme !== undefined ) { 
     65                        // remove active class/extended details div 
     66                        $('.extended-details').remove(); 
     67                        currentTheme.removeClass( 'active' ); 
     68 
     69                        // bail if the link clicked was the same as previously 
     70                        if ( currentTheme[0] ===  $(this).closest('div.available-theme')[0] ) { 
     71                                currentTheme = undefined; 
     72                                return false; 
     73                        } 
     74                } 
     75 
     76                // reset nextLower - has scope to use for window resize reflow 
     77                nextLower = undefined; 
     78 
     79                var detailsDiv = $('<div class="extended-details"><div class="themedetaildiv"><h4>Theme Details</h4></div><div class="screenshots"></div></div>'); 
     80 
     81                // get parent div.available-theme 
     82                currentTheme = $(this).closest( 'div.available-theme' ); 
     83 
     84                // set active class for parent 
     85                currentTheme.addClass( 'active' ); 
     86 
     87                // get top position of parent 
     88                var currentPosition = currentTheme.position().top; 
     89 
     90                // find the next div.available-theme that has a lower position().top 
     91                currentTheme.nextAll('div.available-theme').each( function(index) { 
     92                        if(currentPosition != $(this).position().top) { 
     93                                nextLower = $(this); 
     94                                return false; 
     95                        } 
     96                }); 
     97 
     98                // insert/move the theme details div before that parent if found 
     99                if ( nextLower !== undefined ) { 
     100                        nextLower.before(detailsDiv); 
     101                } 
     102                // if not found, insert before the end of the overall div 
     103                else { 
     104                        $('#availablethemes').append(detailsDiv); 
     105                } 
     106 
     107                // set inner HTML of theme details div to the contents of $(this).siblings('.themedetaildiv') 
     108                var themeDetails = $(this).siblings('.themedetaildiv').html(); 
     109                $('.extended-details .themedetaildiv').append(themeDetails); 
     110 
     111                // plus the HTML for the extra screenshots, to be pulled from... ? 
     112 
    60113                return false; 
    61114        }); 
    62115 
     116        // deal with window resizing and reflow, but only if there is something active 
     117        // $(window).resize( function() { } ); 
     118 
    63119}); 
  • wp-admin/css/wp-admin.dev.css

     
    44414441.available-theme { 
    44424442        display: inline-block; 
    44434443        margin-bottom: 10px; 
    4444         margin-right: 25px; 
    4445         overflow: hidden; 
     4444        margin-right: 10px; 
     4445        overflow: visible; 
    44464446        padding: 20px; 
    44474447        vertical-align: top; 
    4448         width: 240px; 
     4448        width: 300px; 
     4449        border-top-left-radius: 3px; 
     4450        border-top-right-radius: 3px; 
     4451        -webkit-border-top-left-radius: 3px; 
     4452        -webkit-border-top-right-radius: 3px; 
    44494453} 
    44504454 
     4455.js .available-theme.has-screenshots { 
     4456        background: transparent url(../images/stack.png) no-repeat 26px 5px; 
     4457} 
     4458 
    44514459.available-theme a.screenshot { 
    4452         width: 240px; 
    4453         height: 180px; 
     4460        width: 300px; 
     4461        height: 225px; 
     4462        margin: 0 auto; 
    44544463        display: block; 
    44554464        border-width: 1px; 
    44564465        border-style: solid; 
     
    44594468} 
    44604469 
    44614470.available-theme img { 
    4462         width: 240px; 
     4471        width: 300px; 
    44634472} 
    44644473 
    44654474.available-theme h3 { 
    44664475        margin: 15px 0 5px; 
    44674476} 
    44684477 
     4478.available-theme.active { 
     4479        background: #f5f5f5; 
     4480} 
     4481 
     4482.extended-details { 
     4483        overflow: hidden; 
     4484        position: relative; 
     4485        margin-top: -10px; 
     4486        margin-bottom: 20px; 
     4487        padding: 5px 20px; 
     4488        padding-left: 330px; 
     4489        background-color: #f5f5f5; 
     4490        border-radius: 3px; 
     4491        -webkit-border-radius: 3px; 
     4492} 
     4493 
     4494#availablethemes .extended-details h4 { 
     4495        margin: 1em 0; 
     4496} 
     4497 
     4498.extended-details .themedetaildiv { 
     4499        position: relative; 
     4500        float: left; 
     4501        width: 280px; 
     4502        right: 310px; 
     4503        margin-right: -100%; 
     4504        margin-bottom: 20px; 
     4505} 
     4506 
     4507.extended-details .screenshots { 
     4508        position: relative; 
     4509        float: left; 
     4510        margin-top: 15px; 
     4511        width: 100%; 
     4512} 
     4513 
     4514.extended-details .screenshots img { 
     4515        float: left; 
     4516        margin-right: 20px; 
     4517        margin-bottom: 20px; 
     4518        width: 300px; 
     4519        height: 225px; 
     4520        border: 1px solid #ddd; 
     4521} 
     4522 
    44694523#current-theme { 
    44704524        margin: 1em 0 1.5em; 
    44714525} 
     
    73867440} 
    73877441 
    73887442 
    7389 #theme-information .available-theme, 
    7390 .available-theme { 
     7443#theme-information .available-theme { 
    73917444        padding: 20px 15px; 
    73927445} 
    73937446