Make WordPress Core

Changeset 26277


Ignore:
Timestamp:
11/20/2013 01:34:41 AM (13 years ago)
Author:
azaozz
Message:

Widgets:

  • Fix support for expanding (wide) widgets in the Inactive Widgets area.
  • Remove resizing of the sidebars height.
  • Stop removing unneeded "for" attributes from labels inside the widgets. Was a fix for IE6 odd behaviour.

See #26117.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/wp-admin.css

    r26275 r26277  
    1030510305        padding: 15px 15px;
    1030610306}
     10307
    1030710308div#widgets-right .sidebar-name .sidebar-name-arrow:before {
    1030810309        right: 0;
    1030910310        top: 4px;
    1031010311}
     10312
    1031110313div#widgets-right .widget-top {
    1031210314        padding: 0;
    1031310315        background: #f7f7f7;
    1031410316}
     10317
    1031510318div#widgets-right .widget-title-action {
    1031610319        float: right;
    … …  
    1031910322        right: 10px;
    1032010323}
     10324
    1032110325div#widgets-right a.widget-action:after {
    1032210326        content: '\f111';
    1032310327        color: #888;
    1032410328}
     10329
    1032510330div#widgets-right .widget-inside {
    1032610331        border-top: 1px solid #dedede;
    … …  
    1032810333
    1032910334div#widgets-right .widgets-sortables {
    10330         min-height: 42px !important; /* Inline styles */
    1033110335        padding: 0 8px;
    1033210336        margin-bottom: 8px;
    1033310337        position: relative;
    1033410338}
     10339
    1033510340div#widgets-right .widgets-sortables:before {
    1033610341        display: block;
    … …  
    1034710352        font-weight: 600;
    1034810353        color: #aaa;
     10354}
     10355
     10356.sidebar-name .spinner {
     10357        margin: -5px 5px;
     10358        float: none;
    1034910359}
    1035010360
  • trunk/src/wp-admin/js/widgets.js

    r26275 r26277  
    1111                        selectSidebar = chooser.find('.widgets-chooser-sidebars'),
    1212                        sidebars = $('div.widgets-sortables'),
    13                         isRTL = !! ( 'undefined' !== typeof isRtl && isRtl ),
    14                         margin = ( isRTL ? 'marginRight' : 'marginLeft' );
     13                        isRTL = !! ( 'undefined' !== typeof isRtl && isRtl );
    1514
    1615                $('#widgets-right').children('.widgets-holder-wrap').children('.sidebar-name').click( function() {
    … …  
    2827                });
    2928
    30                 sidebars.each(function(){
    31                         if ( $(this).parent().hasClass('inactive') )
    32                                 return true;
    33 
    34                         var h = 50, H = $(this).children('.widget').length;
    35                         h = h + parseInt(H * 48, 10);
    36                         $(this).css( 'minHeight', h + 'px' );
    37                 });
    38 
    3929                $(document.body).bind('click.widgets-toggle', function(e){
    40                         var target = $(e.target), css = {}, widget, inside, w;
     30                        var target = $(e.target), css = { 'z-index': 100 }, widget, inside, w;
    4131
    4232                        if ( target.parents('.widget-top').length && ! target.parents('#available-widgets').length ) {
    4333                                widget = target.closest('div.widget');
    4434                                inside = widget.children('.widget-inside');
    45                                 w = parseInt( widget.find('input.widget-width').val(), 10 );
     35                                targetWidth = parseInt( widget.find('input.widget-width').val(), 10 ),
     36                                widgetWidth = widget.width();
    4637
    4738                                if ( inside.is(':hidden') ) {
    48                                         if ( w > 250 && inside.closest('div.widgets-sortables').length ) {
    49                                                 if ( inside.closest('div.widget-liquid-right').length )
    50                                                         css[margin] = 235 - w + 'px';
    51                                                 widget.css(css);
     39                                        if ( targetWidth > 250 && ( targetWidth + 30 > widgetWidth ) && widget.closest('div.widgets-sortables').length ) {
     40                                                if ( widget.closest('div.widget-liquid-right').length ) {
     41                                                        margin = isRTL ? 'margin-right' : 'margin-left';
     42                                                } else {
     43                                                        margin = isRTL ? 'margin-left' : 'margin-right';
     44                                                }
     45
     46                                                css[ margin ] = widgetWidth - ( targetWidth + 30 ) + 'px';
     47                                                widget.css( css );
    5248                                        }
    53                                         wpWidgets.fixLabels(widget);
    5449                                        inside.slideDown('fast');
    5550                                } else {
    5651                                        inside.slideUp('fast', function() {
    57                                                 widget.css({'width':'', margin:''});
     52                                                widget.attr( 'style', '' );
    5853                                        });
    5954                                }
    … …  
    105100                        start: function(e,ui) {
    106101                                ui.item.children('.widget-inside').hide();
    107                                 ui.item.css({margin:'', 'width':''});
    108102                        },
    109103                        stop: function(e,ui) {
    … …  
    122116                                        sb = $(this).attr('id');
    123117
    124                                 ui.item.css({margin:'', 'width':''});
     118                                ui.item.attr( 'style', '' );
    125119                                the_id = '';
    126120
    … …  
    259253                        $('.spinner').hide();
    260254                });
    261 
    262                 this.resize();
    263255        },
    264256
    … …  
    299291                                } else {
    300292                                        widget.remove();
    301                                         wpWidgets.resize();
    302293                                }
    303294                        } else {
    … …  
    306297                                        $('div.widget-content', widget).html(r);
    307298                                        wpWidgets.appendTitle(widget);
    308                                         wpWidgets.fixLabels(widget);
    309299                                }
    310300                        }
    … …  
    325315        },
    326316
    327         resize : function() {
    328                 $('div.widgets-sortables').each(function(){
    329                         if ( $(this).parent().hasClass('inactive') )
    330                                 return true;
    331 
    332                         var h = 50, H = $(this).children('.widget').length;
    333                         h = h + parseInt(H * 48, 10);
    334                         $(this).css( 'minHeight', h + 'px' );
    335                 });
    336         },
    337 
    338         fixLabels : function(widget) {
    339                 widget.children('.widget-inside').find('label').each(function(){
    340                         var f = $(this).attr('for');
    341                         if ( f && f === $('input', this).attr('id') )
    342                                 $(this).removeAttr('for');
    343                 });
    344         },
    345 
    346317        close : function(widget) {
    347                 widget.children('.widget-inside').slideUp('fast', function(){
    348                         widget.css({'width':'', margin:''});
     318                widget.children('.widget-inside').slideUp('fast', function() {
     319                        widget.attr( 'style', '' );
    349320                });
    350321        },
Note: See TracChangeset for help on using the changeset viewer.