WordPress.org

Make WordPress Core

Changeset 11246


Ignore:
Timestamp:
05/10/09 00:49:48 (5 years ago)
Author:
azaozz
Message:

Append the widget's title to the header, adjust sidebar height after changing widgets, see #9511

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/colors-classic.css

    r11234 r11246  
    16341634    background: transparent url(../images/fav-arrow.gif) no-repeat scroll 0 -1px; 
    16351635} 
     1636 
     1637h4 .in-widget-title { 
     1638    color: #636363; 
     1639} 
  • trunk/wp-admin/css/colors-fresh.css

    r11234 r11246  
    16231623    background: transparent url(../images/fav-arrow.gif) no-repeat scroll 0 -1px; 
    16241624} 
     1625 
     1626h4 .in-widget-title { 
     1627    color: #636363; 
     1628} 
  • trunk/wp-admin/css/ie.css

    r10943 r11246  
    373373} 
    374374 
     375* html .widget-title h4 { 
     376    width: 210px; 
     377} 
     378 
     379#available-widgets .widget-holder { 
     380    padding-bottom: 65px; 
     381} 
     382 
     383#widgets-left .inactive { 
     384    padding-bottom: 10px; 
     385} 
     386 
     387.widget-liquid-right .widget, 
     388#wp_inactive_widgets .widget { 
     389    position: relative; 
     390} 
     391 
  • trunk/wp-admin/css/widgets.css

    r11234 r11246  
    3232    width: 250px; 
    3333    margin: 0 auto 20px; 
    34     position: relative; 
     34    overflow: hidden; 
    3535} 
    3636 
     
    4444    padding: 5px 12px; 
    4545    font-size: 13px; 
     46    height: 19px; 
    4647} 
    4748 
     
    158159    font-size: 12px; 
    159160    font-weight: bold; 
    160     line-height: 1; 
     161    height: 26px; 
     162    overflow: hidden; 
    161163} 
    162164 
    163165.widget-top .widget-title { 
    164     padding: 7px 9px; 
     166    padding: 5px 9px; 
    165167} 
    166168 
     
    206208.widget-title h4 { 
    207209    margin: 0; 
    208     line-height: 1; 
     210    line-height: 1.3; 
     211    overflow: hidden; 
     212    white-space: nowrap; 
    209213} 
    210214 
     
    292296    width: 26px; 
    293297} 
     298 
     299h4 .in-widget-title { 
     300    font-size: 11px; 
     301    white-space: nowrap; 
     302} 
  • trunk/wp-admin/includes/widgets.php

    r11204 r11246  
    173173        <a class="widget-control-edit hide-if-js" href="<?php echo clean_url( add_query_arg( $query_arg ) ); ?>"><span class="edit"><?php _e('Edit'); ?></span><span class="add"><?php _e('Add'); ?></span></a> 
    174174    </div> 
    175     <div class="widget-title"><h4><?php echo $widget_title ?></h4></div> 
     175    <div class="widget-title"><h4><?php echo $widget_title ?><span class="in-widget-title"></span></h4></div> 
    176176    </div> 
    177177 
  • trunk/wp-admin/js/widgets.dev.js

    r11238 r11246  
    55wpWidgets = { 
    66    init : function() { 
    7         var rem, hr = $('#available-widgets .widget-holder').height() - 7, firstsb = $('#widgets-right .widgets-holder-wrap .widgets-sortables:first'), hl = firstsb.height(); 
     7        var rem; 
    88 
    99        $('#widgets-right div.sidebar-name').click(function(){ 
    1010            var c = $(this).siblings('.widgets-sortables'); 
    1111            if ( c.is(':visible') ) { 
    12                 c.hide().sortable('disable'); 
    1312                $(this).parent().addClass('closed'); 
    1413            } else { 
    15                 c.show().sortable('enable').sortable('refresh'); 
    1614                $(this).parent().removeClass('closed'); 
     15                c.sortable('refresh'); 
    1716            } 
    1817        }); 
     
    2625        }); 
    2726         
    28         if ( hr > hl ) 
    29             firstsb.css('minHeight', hr + 'px'); 
     27        $('#widgets-right .widget, #wp_inactive_widgets .widget').each(function(){ 
     28            wpWidgets.appendTitle(this); 
     29        }); 
    3030         
    3131        this.addEvents(); 
     
    3838            helper: 'clone', 
    3939            zIndex: 5, 
     40            containment: 'document', 
    4041            start: function(e,ui) { 
    4142                wpWidgets.fixWebkit(1); 
     
    5859            distance: 2, 
    5960            opacity: 0.65, 
     61            containment: 'document', 
    6062            start: function(e,ui) { 
    6163                wpWidgets.fixWebkit(1); 
     
    6668                var add = ui.item.find('input.add_new').val(), n = ui.item.find('input.multi_number').val(), id = ui.item.attr('id'), sb = $(this).attr('id'); 
    6769                ui.item.css({'marginLeft':'','width':''}); 
    68  
    6970                if ( add ) { 
    7071                    if ( 'multi' == add ) { 
     
    8384                } 
    8485                wpWidgets.saveOrder(sb); 
     86                wpWidgets.resize(); 
    8587                wpWidgets.fixWebkit(); 
    8688            }, 
     
    8991                    $(this).sortable('cancel'); 
    9092            } 
    91  
    92         }).not(':visible').sortable('disable'); 
     93        }); 
     94        wpWidgets.resize(); 
    9395    }, 
    9496 
     
    126128 
    127129        $.post( ajaxurl, data, function(r){ 
    128             var id; 
     130            var id, widget; 
    129131            $('.ajax-feedback').css('visibility', 'hidden'); 
    130132            if ( !t ) 
    131133                return; 
    132134 
     135            widget = $(t).parents('.widget'); 
     136 
    133137            if ( del ) { 
    134                 $(t).parents('.widget').slideUp('normal', function(){ $(this).remove(); }); 
    135                 if ( !a.widget_number ) { 
    136                     id = a['widget-id']; 
     138                widget.slideUp('normal', function(){ 
     139                    $(this).remove(); 
     140                    wpWidgets.resize(); 
     141                }); 
     142                if ( !$('.widget_number', widget).val() ) { 
     143                    id = $('.widget-id', widget).val(); 
    137144                    $('#available-widgets .widget-id').each(function(){ 
    138145                        if ( $(this).val() == id ) 
     
    141148                } 
    142149            } else { 
    143                 $(t).parents('.widget-inside').slideUp('normal', function(){ $(this).parents('.widget').css({'width':'','marginLeft':''}); }); 
    144             } 
     150                $(t).parents('.widget-inside').slideUp('normal', function(){ 
     151                    widget.css({'width':'','marginLeft':''}); 
     152                    wpWidgets.appendTitle(widget); 
     153                }); 
     154            } 
     155        }); 
     156    }, 
     157 
     158    appendTitle : function(widget) { 
     159        $('input[type="text"]', widget).each(function(){ 
     160            if ( this.id.indexOf('title') != -1 && $(this).val() ) { 
     161                $('.widget-title .in-widget-title', widget).html(': ' + $(this).val()); 
     162                return false; 
     163            } 
     164        }); 
     165    }, 
     166 
     167    resize : function() { 
     168        $('.widgets-sortables').not('#wp_inactive_widgets').each(function(){ 
     169            var h = 50, H = $('.widget', this).length; 
     170            h = h + parseInt(H * 48, 10); 
     171            $(this).css( 'minHeight', h + 'px' ); 
    145172        }); 
    146173    }, 
     
    162189                    css['width'] = w + 30 + 'px'; 
    163190                    if ( inside.parents('.widget-liquid-right').length ) 
    164                         css['marginLeft'] = 234 - w + 'px'; 
     191                        css['marginLeft'] = 235 - w + 'px'; 
    165192                    inside.parents('.widget').css(css); 
    166193                } 
  • trunk/wp-admin/js/widgets.js

    r11238 r11246  
    1 var wpWidgets;(function(a){wpWidgets={init:function(){var e,d=a("#available-widgets .widget-holder").height()-7,c=a("#widgets-right .widgets-holder-wrap .widgets-sortables:first"),b=c.height();a("#widgets-right div.sidebar-name").click(function(){var f=a(this).siblings(".widgets-sortables");if(f.is(":visible")){f.hide().sortable("disable");a(this).parent().addClass("closed")}else{f.show().sortable("enable").sortable("refresh");a(this).parent().removeClass("closed")}});a("#widgets-left div.sidebar-name").click(function(){if(a(this).siblings(".widget-holder").is(":visible")){a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed")}});if(d>b){c.css("minHeight",d+"px")}this.addEvents();a(".widget-error").parents(".widget").find("a.widget-action").click();a("#widget-list .widget").draggable({connectToSortable:".widgets-sortables",handle:".widget-title",distance:2,helper:"clone",zIndex:5,start:function(g,f){wpWidgets.fixWebkit(1);f.helper.find(".widget-description").hide()},stop:function(g,f){if(e){a(e).hide()}e="";wpWidgets.fixWebkit()}});a(".widgets-sortables").sortable({placeholder:"widget-placeholder",connectWith:".widgets-sortables",items:".widget",handle:".widget-title",cursor:"move",distance:2,opacity:0.65,start:function(g,f){wpWidgets.fixWebkit(1);f.item.find(".widget-inside").hide();f.item.css({marginLeft:"",width:""})},stop:function(h,f){var g=f.item.find("input.add_new").val(),k=f.item.find("input.multi_number").val(),j=f.item.attr("id"),i=a(this).attr("id");f.item.css({marginLeft:"",width:""});if(g){if("multi"==g){f.item.html(f.item.html().replace(/<[^<>]+>/g,function(l){return l.replace(/__i__|%i%/g,k)}));f.item.attr("id",j.replace(/__i__|%i%/g,k));k++;a("div#"+j).find("input.multi_number").val(k)}else{if("single"==g){f.item.attr("id","new-"+j);e="div#"+j}}wpWidgets.addEvents(f.item);wpWidgets.save(f.item.find("form").serialize(),i,0,0);f.item.find("input.add_new").val("");f.item.find("a.widget-action").click()}wpWidgets.saveOrder(i);wpWidgets.fixWebkit()},receive:function(g,f){if(!a(this).is(":visible")){a(this).sortable("cancel")}}}).not(":visible").sortable("disable")},saveOrder:function(c){a("#"+c).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"widgets-order",savewidgets:a("#_wpnonce_widgets").val(),sidebars:[]};a(".widgets-sortables").each(function(){b["sidebars["+a(this).attr("id")+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b,function(){a(".ajax-feedback").css("visibility","hidden")})},save:function(e,f,c,d){a("#"+f).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"save-widget",savewidgets:a("#_wpnonce_widgets").val(),sidebar:f};if(c){b.delete_widget=1}e+="&"+a.param(b);a.post(ajaxurl,e,function(g){var h;a(".ajax-feedback").css("visibility","hidden");if(!d){return}if(c){a(d).parents(".widget").slideUp("normal",function(){a(this).remove()});if(!b.widget_number){h=b["widget-id"];a("#available-widgets .widget-id").each(function(){if(a(this).val()==h){a(this).parents(".widget").show()}})}}else{a(d).parents(".widget-inside").slideUp("normal",function(){a(this).parents(".widget").css({width:"",marginLeft:""})})}})},fixWebkit:function(b){b=b?"none":"";a("body").css({WebkitUserSelect:b,KhtmlUserSelect:b})},addEvents:function(b){b=b||document;a("a.widget-action",b).click(function(){var d=parseInt(a(this).parents(".widget").find(".widget-width").val(),10),e={},c=a(this).parents(".widget-top").siblings(".widget-inside");if(c.is(":hidden")){if(d>250&&c.parents(".widgets-sortables").length){e.width=d+30+"px";if(c.parents(".widget-liquid-right").length){e.marginLeft=234-d+"px"}c.parents(".widget").css(e)}c.slideDown("normal")}else{c.slideUp("normal",function(){c.parents(".widget").css({width:"",marginLeft:""})})}return false});a(".widget-control-save",b).click(function(){wpWidgets.save(a(this).parents("form").serialize(),a(this).parents(".widgets-sortables").attr("id"),0,this);return false});a(".widget-control-remove",b).click(function(){wpWidgets.save(a(this).parents("form").serialize(),a(this).parents(".widgets-sortables").attr("id"),1,this);return false})}};a(document).ready(function(){wpWidgets.init()})})(jQuery); 
     1var wpWidgets;(function(a){wpWidgets={init:function(){var b;a("#widgets-right div.sidebar-name").click(function(){var d=a(this).siblings(".widgets-sortables");if(d.is(":visible")){a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed");d.sortable("refresh")}});a("#widgets-left div.sidebar-name").click(function(){if(a(this).siblings(".widget-holder").is(":visible")){a(this).parent().addClass("closed")}else{a(this).parent().removeClass("closed")}});a("#widgets-right .widget, #wp_inactive_widgets .widget").each(function(){wpWidgets.appendTitle(this)});this.addEvents();a(".widget-error").parents(".widget").find("a.widget-action").click();a("#widget-list .widget").draggable({connectToSortable:".widgets-sortables",handle:".widget-title",distance:2,helper:"clone",zIndex:5,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.helper.find(".widget-description").hide()},stop:function(d,c){if(b){a(b).hide()}b="";wpWidgets.fixWebkit()}});a(".widgets-sortables").sortable({placeholder:"widget-placeholder",connectWith:".widgets-sortables",items:".widget",handle:".widget-title",cursor:"move",distance:2,opacity:0.65,containment:"document",start:function(d,c){wpWidgets.fixWebkit(1);c.item.find(".widget-inside").hide();c.item.css({marginLeft:"",width:""})},stop:function(f,c){var d=c.item.find("input.add_new").val(),i=c.item.find("input.multi_number").val(),h=c.item.attr("id"),g=a(this).attr("id");c.item.css({marginLeft:"",width:""});if(d){if("multi"==d){c.item.html(c.item.html().replace(/<[^<>]+>/g,function(e){return e.replace(/__i__|%i%/g,i)}));c.item.attr("id",h.replace(/__i__|%i%/g,i));i++;a("div#"+h).find("input.multi_number").val(i)}else{if("single"==d){c.item.attr("id","new-"+h);b="div#"+h}}wpWidgets.addEvents(c.item);wpWidgets.save(c.item.find("form").serialize(),g,0,0);c.item.find("input.add_new").val("");c.item.find("a.widget-action").click()}wpWidgets.saveOrder(g);wpWidgets.resize();wpWidgets.fixWebkit()},receive:function(d,c){if(!a(this).is(":visible")){a(this).sortable("cancel")}}});wpWidgets.resize()},saveOrder:function(c){a("#"+c).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"widgets-order",savewidgets:a("#_wpnonce_widgets").val(),sidebars:[]};a(".widgets-sortables").each(function(){b["sidebars["+a(this).attr("id")+"]"]=a(this).sortable("toArray").join(",")});a.post(ajaxurl,b,function(){a(".ajax-feedback").css("visibility","hidden")})},save:function(e,f,c,d){a("#"+f).parents(".widgets-holder-wrap").find(".ajax-feedback").css("visibility","visible");var b={action:"save-widget",savewidgets:a("#_wpnonce_widgets").val(),sidebar:f};if(c){b.delete_widget=1}e+="&"+a.param(b);a.post(ajaxurl,e,function(g){var i,h;a(".ajax-feedback").css("visibility","hidden");if(!d){return}h=a(d).parents(".widget");if(c){h.slideUp("normal",function(){a(this).remove();wpWidgets.resize()});if(!a(".widget_number",h).val()){i=a(".widget-id",h).val();a("#available-widgets .widget-id").each(function(){if(a(this).val()==i){a(this).parents(".widget").show()}})}}else{a(d).parents(".widget-inside").slideUp("normal",function(){h.css({width:"",marginLeft:""});wpWidgets.appendTitle(h)})}})},appendTitle:function(b){a('input[type="text"]',b).each(function(){if(this.id.indexOf("title")!=-1&&a(this).val()){a(".widget-title .in-widget-title",b).html(": "+a(this).val());return false}})},resize:function(){a(".widgets-sortables").not("#wp_inactive_widgets").each(function(){var c=50,b=a(".widget",this).length;c=c+parseInt(b*48,10);a(this).css("minHeight",c+"px")})},fixWebkit:function(b){b=b?"none":"";a("body").css({WebkitUserSelect:b,KhtmlUserSelect:b})},addEvents:function(b){b=b||document;a("a.widget-action",b).click(function(){var d=parseInt(a(this).parents(".widget").find(".widget-width").val(),10),e={},c=a(this).parents(".widget-top").siblings(".widget-inside");if(c.is(":hidden")){if(d>250&&c.parents(".widgets-sortables").length){e.width=d+30+"px";if(c.parents(".widget-liquid-right").length){e.marginLeft=235-d+"px"}c.parents(".widget").css(e)}c.slideDown("normal")}else{c.slideUp("normal",function(){c.parents(".widget").css({width:"",marginLeft:""})})}return false});a(".widget-control-save",b).click(function(){wpWidgets.save(a(this).parents("form").serialize(),a(this).parents(".widgets-sortables").attr("id"),0,this);return false});a(".widget-control-remove",b).click(function(){wpWidgets.save(a(this).parents("form").serialize(),a(this).parents(".widgets-sortables").attr("id"),1,this);return false})}};a(document).ready(function(){wpWidgets.init()})})(jQuery); 
  • trunk/wp-includes/script-loader.php

    r11238 r11246  
    331331        $scripts->add_data( 'media-upload', 'group', 1 ); 
    332332 
    333         $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable' ), '20090507' ); 
     333        $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable' ), '20090509' ); 
    334334        $scripts->add_data( 'admin-widgets', 'group', 1 ); 
    335335 
     
    422422    $styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' ); 
    423423 
    424     $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090415' ); 
     424    $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090509' ); 
    425425    $styles->add_data( 'ie', 'conditional', 'lte IE 7' ); 
    426426 
    427     $styles->add( 'colors', true, array(), '20090506' ); // Register "meta" stylesheet for admin colors 
     427    $styles->add( 'colors', true, array(), '20090509' ); // Register "meta" stylesheet for admin colors 
    428428    $styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css', array(), '20081210'); // for login.php.  Is there a better way? 
    429429    $styles->add_data( 'colors-fresh', 'rtl', true ); 
     
    433433    $styles->add( 'global', '/wp-admin/css/global.css', array(), '20090504' ); 
    434434    $styles->add( 'media', '/wp-admin/css/media.css', array(), '20090325' ); 
    435     $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20090503' ); 
     435    $styles->add( 'widgets', '/wp-admin/css/widgets.css', array(), '20090509' ); 
    436436    $styles->add( 'dashboard', '/wp-admin/css/dashboard.css', array(), '20090305' ); 
    437437    $styles->add( 'install', '/wp-admin/css/install.css', array(), '20081210' ); 
Note: See TracChangeset for help on using the changeset viewer.