Widgets UI improvements: arrows, some more help

git-svn-id: https://develop.svn.wordpress.org/trunk@11166 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2009-05-04 01:19:10 +00:00
parent 4cbf51bc20
commit 90e500ae36
9 changed files with 56 additions and 28 deletions

View File

@ -1615,14 +1615,14 @@ div.widgets-sortables,
border-color: #ddd;
}
#widgets-left h3.sidebar-name {
#widgets-left .sidebar-name {
background-color: #aaa;
background-image: url(../images/ed-bg-vs.gif);
text-shadow: #FFFFFF 0 -1px 0;
border-color: #dfdfdf;
}
#widgets-right h3.sidebar-name {
#widgets-right .sidebar-name {
background-image: url(../images/fav.png);
text-shadow: #3f3f3f 0 -1px 0;
background-color: #636363;
@ -1633,3 +1633,11 @@ div.widgets-sortables,
.sidebar-name:hover {
color: #d54e21;
}
#widgets-left .sidebar-name-arrow {
background: transparent url(../images/menu-bits.gif) no-repeat scroll left -109px;
}
#widgets-right .sidebar-name-arrow {
background: transparent url(../images/fav-arrow.gif) no-repeat scroll 0 -1px;
}

View File

@ -1590,14 +1590,14 @@ div.widgets-sortables,
border-color: #ddd;
}
#widgets-left h3.sidebar-name {
#widgets-left .sidebar-name {
background-color: #aaa;
background-image: url(../images/ed-bg.gif);
text-shadow: #FFFFFF 0 -1px 0;
border-color: #dfdfdf;
}
#widgets-right h3.sidebar-name {
#widgets-right .sidebar-name {
background-image: url(../images/fav.png);
text-shadow: #3f3f3f 0 -1px 0;
background-color: #636363;
@ -1608,3 +1608,11 @@ div.widgets-sortables,
.sidebar-name:hover {
color: #d54e21;
}
#widgets-left .sidebar-name-arrow {
background: transparent url(../images/menu-bits.gif) no-repeat scroll left -109px;
}
#widgets-right .sidebar-name-arrow {
background: transparent url(../images/fav-arrow.gif) no-repeat scroll 0 -1px;
}

View File

@ -39,17 +39,16 @@ div.widget-liquid-right {
float: left;
}
.widget-liquid-right .sidebar-name {
width: 256px;
div.sidebar-name h3 {
margin: 0;
padding: 5px 12px;
}
h3.sidebar-name {
div.sidebar-name {
background-repeat: repeat-x;
background-position: 0 0;
margin: 0;
cursor: pointer;
font-size: 13px;
padding: 5px 12px;
border-width: 1px;
border-style: solid;
-moz-border-radius-topleft: 8px;
@ -62,7 +61,7 @@ h3.sidebar-name {
border-top-left-radius: 8px;
}
.js .closed h3.sidebar-name {
.js .closed .sidebar-name {
-moz-border-radius-bottomleft: 8px;
-moz-border-radius-bottomright: 8px;
-webkit-border-bottom-right-radius: 8px;
@ -94,11 +93,10 @@ h3.sidebar-name {
.widget-liquid-right .widgets-sortables {
padding: 15px 0 0;
width: 280px;
}
#available-widgets .widget-holder {
padding: 15px 5px 0;
padding: 7px 5px 0;
}
#wp_inactive_widgets {
@ -250,10 +248,7 @@ a.widget-control-edit {
display: none;
}
#available-widgets .widget-control-edit .add {
display: block;
}
#available-widgets .widget-control-edit .add,
#widgets-right .widget-control-edit .edit,
#wp_inactive_widgets .widget-control-edit .edit {
display: block;
@ -274,10 +269,14 @@ a.widget-control-edit {
border-radius: 6px;
}
#widgets-left p.description {
.inactive p.description {
margin: 5px 15px 8px;
}
#available-widgets p.description {
margin: 0 12px 12px;
}
.widget-position {
margin-top: 8px;
}
@ -285,3 +284,9 @@ a.widget-control-edit {
.inactive {
padding-top: 2px;
}
.sidebar-name-arrow {
float: right;
height: 29px;
width: 26px;
}

View File

@ -3577,8 +3577,8 @@ function plugins_search_help() {
function widgets_help() {
return '
<p>' . __('Widgets can be added or arranged by dragging. If you hover your mouse over the title bar of a widget you&rsquo;ll notice the 4 arrow cursor appears to let you know it is movable. Click on it, hold down the mouse button and start dragging the widget to a new location. As you drag the module, notice the dotted gray box that also moves. This box indicates where the widget will be placed when you release the mouse button.') . '</p>
<p>' . __('To show or hide the settings for a widget, click on the arrow that appears on the right of the widget title.') . '</p>
<p>' . __('Widgets can be added and arranged by dragging. If you hover your mouse over the title bar of a widget you&rsquo;ll notice the 4 arrow cursor appears to let you know it is movable. Click on it, hold down the mouse button and start dragging the widget to a sidebar. As you drag, notice the dotted gray box that also moves. This box indicates where the widget will be placed when you release the mouse button.') . '</p>
<p>' . __('Widgets can be removed from their settings. To show or hide the settings for a widget, click on the arrow that appears on the right of the widget title.') . '</p>
<p>' . __('The Inactive Widgets area stores all widgets that are configured but not curently used on the web site. After changing themes if the new theme has less sidebars than the old theme, all widgets that were in these sidebars will be transfered to Inactive Widgets.') . '</p>
';
}

View File

@ -24,6 +24,7 @@ function wp_list_widgets() {
natcasesort($sort); ?>
<div class="widget-holder">
<p class="description"><?php _e('Drag widgets from here to a sidebar on the right to activate them.'); ?></p>
<div id="widget-list">
<?php
foreach ( $sort as $val ) {

View File

@ -6,7 +6,7 @@ wpWidgets = {
init : function() {
var rem, hr = $('#available-widgets .widget-holder').height(), firstsb = $('#widgets-right .widgets-holder-wrap .widgets-sortables:first'), hl = firstsb.height();
$('#widgets-right h3.sidebar-name').click(function(){
$('#widgets-right div.sidebar-name').click(function(){
var c = $(this).siblings('.widgets-sortables');
if ( c.is(':visible') ) {
c.hide().sortable('disable');
@ -17,7 +17,7 @@ wpWidgets = {
}
});
$('#widgets-left h3.sidebar-name').click(function(){
$('#widgets-left div.sidebar-name').click(function(){
if ( $(this).siblings('.widget-holder').is(':visible') ) {
$(this).parent().addClass('closed');
} else {

View File

@ -1 +1 @@
var wpWidgets;(function(a){wpWidgets={init:function(){var e,d=a("#available-widgets .widget-holder").height(),c=a("#widgets-right .widgets-holder-wrap .widgets-sortables:first"),b=c.height();a("#widgets-right h3.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 h3.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__/g,k)}));f.item.attr("id",j.replace(/__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").serializeArray(),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);
var wpWidgets;(function(a){wpWidgets={init:function(){var e,d=a("#available-widgets .widget-holder").height(),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__/g,k)}));f.item.attr("id",j.replace(/__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").serializeArray(),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);

View File

@ -346,14 +346,18 @@ require_once( 'admin-header.php' ); ?>
<div class="widget-liquid-left">
<div id="widgets-left">
<div id="available-widgets" class="widgets-holder-wrap">
<h3 class="sidebar-name"><?php _e('Available Widgets'); ?></h3>
<div class="sidebar-name">
<div class="sidebar-name-arrow"><br /></div>
<h3><?php _e('Available Widgets'); ?></h3></div>
<?php wp_list_widgets(); ?>
<br class="clear" />
</div>
<div class="widgets-holder-wrap">
<h3 class="sidebar-name"><?php _e('Inactive Widgets'); ?>
<span><img src="images/wpspin.gif" class="ajax-feedback" title="" alt="" /></span></h3>
<div class="sidebar-name">
<div class="sidebar-name-arrow"><br /></div>
<h3><?php _e('Inactive Widgets'); ?>
<span><img src="images/wpspin.gif" class="ajax-feedback" title="" alt="" /></span></h3></div>
<div class="widget-holder inactive">
<p class="description"><?php _e('Drag widgets here to remove them from the sidebar but keep their settings.'); ?></p>
<?php wp_list_widget_controls('wp_inactive_widgets'); ?>
@ -372,8 +376,10 @@ foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
continue;
$closed = $i ? ' closed' : ''; ?>
<div class="widgets-holder-wrap<?php echo $closed; ?>">
<h3 class="sidebar-name"><?php echo wp_specialchars( $registered_sidebar['name'] ); ?>
<span><img src="images/wpspin.gif" class="ajax-feedback" title="" alt="" /></span></h3>
<div class="sidebar-name">
<div class="sidebar-name-arrow"><br /></div>
<h3><?php echo wp_specialchars( $registered_sidebar['name'] ); ?>
<span><img src="images/wpspin.gif" class="ajax-feedback" title="" alt="" /></span></h3></div>
<?php wp_list_widget_controls( $sidebar ); // Show the control forms for each of the widgets in this sidebar ?>
</div>
<?php

View File

@ -330,7 +330,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox' ), '20090114' );
$scripts->add_data( 'media-upload', 'group', 1 );
$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable' ), '20090503' );
$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable' ), '20090503b' );
$scripts->add_data( 'admin-widgets', 'group', 1 );
$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), '20090422' );