From 0891a9dea0eeafc5ffa9c3330a1da87032d35eed Mon Sep 17 00:00:00 2001 From: nacin Date: Tue, 4 May 2010 10:01:15 +0000 Subject: [PATCH] More menu improvements. Add link that adds a menu item to the home page, make empty menu dropzone slightly larger, limit selected items to the active tab. props koopersmith and ptahdunbar. see #13220. git-svn-id: http://svn.automattic.com/wordpress/trunk@14439 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/css/nav-menu.css | 2 +- wp-admin/css/nav-menu.dev.css | 4 +++ wp-admin/includes/nav-menu.php | 10 +++--- wp-admin/js/nav-menu.dev.js | 62 ++++++++++++++++++++++++++-------- wp-admin/js/nav-menu.js | 2 +- wp-includes/script-loader.php | 2 ++ 6 files changed, 61 insertions(+), 21 deletions(-) diff --git a/wp-admin/css/nav-menu.css b/wp-admin/css/nav-menu.css index 8b281e5a0..23c41724c 100644 --- a/wp-admin/css/nav-menu.css +++ b/wp-admin/css/nav-menu.css @@ -1 +1 @@ -html,body{min-width:950px;}#nav-menus-frame{margin-left:300px;}#wpbody-content #menu-settings-column{display:block;width:281px;margin-left:-300px;clear:both;float:left;padding-top:24px;}.no-js #wpbody-content #menu-settings-column{padding-top:31px;}#menu-settings-column .inside{padding:0 10px;}#menu-settings-column .handlediv{background:url("../images/menu-bits.gif") no-repeat scroll 0 -110px;}#wpbody{position:relative;}#menu-management-liquid{float:left;min-width:100%;}#menu-management{position:relative;margin-right:20px;margin-top:-3px;width:100%;}#menu-management .menu-edit{margin-bottom:20px;}#nav-menu-header,#post-body{border-color:#ccc;border-style:solid;}#nav-menu-header{background:url("../images/gray-grad.png") repeat-x scroll left top #dfdfdf;border-width:1px 1px 0 1px;-moz-border-radius-topleft:6px;-webkit-border-top-left-radius:6px;-khtml-border-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-topright:6px;-webkit-border-top-right-radius:6px;-khtml-border-top-right-radius:6px;border-top-right-radius:6px;}#post-body{background:#fff;padding:0 0 10px 10px;border-width:0 1px 1px 1px;-moz-border-radius-bottomleft:6px;-webkit-border-bottom-left-radius:6px;-khtml-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-webkit-border-bottom-right-radius:6px;-khtml-border-bottom-right-radius:6px;border-bottom-right-radius:6px;}#post-body-content{position:relative;}.post-body-plain{padding:10px 10px 0 0;}#menu-management .menu-add-new abbr{font-weight:bold;}#menu-management .nav-tabs-nav{margin:0 20px;}#menu-management .nav-tabs-arrow{width:10px;padding:0 5px 4px;cursor:pointer;position:absolute;top:0;line-height:22px;font-size:18px;text-shadow:0 1px 0 #fff;}#menu-management .nav-tabs-arrow a{color:#C1C1C1;}#menu-management .nav-tabs-arrow a:hover{color:#D54E21;}#menu-management .nav-tabs-arrow a:active{color:#464646;}#menu-management .nav-tabs-arrow-left{left:0;}#menu-management .nav-tabs-arrow-right{right:0;text-align:right;}#menu-management .nav-tabs-wrapper{width:100%;height:28px;margin-bottom:-1px;overflow:hidden;}#menu-management .nav-tabs{padding-left:30px;padding-right:10px;}.js #menu-management .nav-tabs{float:left;margin-left:0;margin-right:-400px;}#menu-management .nav-tab{margin-bottom:0;background:#f4f4f4;font-weight:bold;border-color:#dfdfdf;}#menu-management .nav-tab-active{background:#ececec;border-color:#ccc;border-bottom-color:#ececec;}#select-nav-menu-container{text-align:right;padding:0 10px 3px 10px;margin-bottom:5px;}#select-nav-menu{width:100px;display:inline;}#menu-management #major-publishing-actions #delete-action{float:right;margin-right:10px;}#menu-name-label{margin-top:-2px;}#wpbody .open-label{display:inline-block;}#wpbody .open-label span{padding-right:10px;}.js .input-with-default-title{color:#aaa;font-style:italic;}#menu-management .inside{padding:0 10px;}.postbox .howto input{width:180px;float:right;}.customlinkdiv .howto input{width:210px;}.add-menu-item-view-all{height:400px;}#side-sortables .potential-menu-item{margin-left:0;position:relative;margin:6px 0;}#side-sortables .potential-menu-item ul{margin-left:0;}#side-sortables .potential-menu-item li{cursor:move;padding:1px 6px;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;-khtml-border-radius:4px;}.potential-menu-item li{background:#eee;border:1px solid #dfdfdf;color:#646464;}.potential-menu-item li:hover{color:#222;border-color:#ccc;background:#f9f9f9;}.selected-menu-item li{background:#FFFFE0;border-color:#E6DB55;}.selected-menu-item li:hover{background:#ffffbe;border-color:#e2d537;}.potential-menu-item .item-controls,.potential-menu-item .menu-item-transport{display:none;}.potential-menu-item .ui-draggable-dragging div,.potential-menu-item .menu-item-handle .item-controls{display:block;}#side-sortables .new-menu-item,#side-sortables .new-menu-item li,#side-sortables .additional-menu-items li{background:transparent;border:0;}#side-sortables .additional-menu-items li{margin-top:13px;}.item-edit img.waiting{display:block;}#menu-container .submit{margin:0 0 10px;padding:0;}.submitdelete,.submitclose{font-size:11px;}#cancel-save{color:#f00;text-decoration:underline;font-size:11px;margin-left:20px;margin-top:5px;}#cancel-save:hover{background-color:#F00;color:#fff;}.list-controls{float:left;margin-top:5px;}.add-to-menu{float:right;}.postbox img.waiting{display:none;vertical-align:middle;}.button-controls{margin:10px 0;}.show-all,.hide-all{cursor:pointer;}.hide-all{display:none;}#create-menu-name{width:159px;}#manage-menu .inside{padding:0;}#available-links dt{display:block;}#add-custom-link .howto{font-size:11px;}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px;}.menu-item-textbox{width:180px;}.howto span{margin-top:4px;display:block;float:left;}.quick-search{width:190px;}.list-wrap{display:none;clear:both;margin-bottom:10px;}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid #DFDFDF;-moz-border-radius:4px;}.postbox p.submit{margin-bottom:0;}.list li{display:none;margin:0;margin-bottom:5px;}.list li .menu-item-title{cursor:pointer;display:block;}.list li .menu-item-title input{margin-right:3px;margin-top:-3px;}#menu-container .inside{padding-bottom:10px;}.menu{padding-top:1em;}.menu ul{width:100%;}.menu li{margin-bottom:0;}.menu-item-bar{clear:both;line-height:1.5em;position:relative;margin-top:13px;}.menu-item-handle{background:url("../images/gray-grad.png") repeat-x scroll left top #DFDFDF;border:1px solid #E6E6E6;position:relative;padding-left:10px;height:auto;width:400px;line-height:35px;text-shadow:0 1px 0 #FFF;font-weight:bold;overflow:hidden;border-radius:6px;-webkit-border-radius:6px;-moz-border-radius:6px;-khtml-border-radius:6px;}.menu-item-edit-active .menu-item-handle{-moz-border-radius:6px 6px 0 0;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-khtml-border-top-right-radius:6px;-khtml-border-top-left-radius:6px;border-top-right-radius:6px;border-top-left-radius:6px;}.js .menu-item-handle{cursor:move;}.menu li.deleting .menu-item-handle{background-color:#faa;}.menu-item-handle .item-title{padding:7px 0;line-height:20px;display:block;margin-right:13em;}li.menu-item.ui-sortable-helper dl{margin-top:0;}li.menu-item.ui-sortable-helper .menu-item-transport dl{margin-top:13px;}.menu .sortable-placeholder{height:35px;width:410px;margin-top:13px;}.menu-item-depth-0{margin-left:0;}.menu-item-depth-1{margin-left:30px;}.menu-item-depth-2{margin-left:60px;}.menu-item-depth-3{margin-left:90px;}.menu-item-depth-4{margin-left:120px;}.menu-item-depth-5{margin-left:150px;}.menu-item-depth-6{margin-left:180px;}.menu-item-depth-7{margin-left:210px;}.menu-item-depth-8{margin-left:240px;}.menu-item-depth-9{margin-left:270px;}.menu-item-depth-10{margin-left:300px;}.menu-item-depth-11{margin-left:330px;}.menu-item-depth-0 .menu-item-transport{margin-left:0;}.menu-item-depth-1 .menu-item-transport{margin-left:-30px;}.menu-item-depth-2 .menu-item-transport{margin-left:-60px;}.menu-item-depth-3 .menu-item-transport{margin-left:-90px;}.menu-item-depth-4 .menu-item-transport{margin-left:-120px;}.menu-item-depth-5 .menu-item-transport{margin-left:-150px;}.menu-item-depth-6 .menu-item-transport{margin-left:-180px;}.menu-item-depth-7 .menu-item-transport{margin-left:-210px;}.menu-item-depth-8 .menu-item-transport{margin-left:-240px;}.menu-item-depth-9 .menu-item-transport{margin-left:-270px;}.menu-item-depth-10 .menu-item-transport{margin-left:-300px;}.menu-item-depth-11 .menu-item-transport{margin-left:-330px;}.item-type{text-transform:uppercase;font-size:11px;color:#999;padding-right:10px;}.item-controls{font-size:11px;position:absolute;right:20px;top:-1px;}.item-controls a{text-decoration:none;}.item-controls a:hover{cursor:pointer;}.item-controls .item-order{padding-right:10px;}.item-controls .item-order a{font-weight:bold;}body.js .item-order{display:none;}.item-controls .menu-item-delete:hover{color:#f00;}.item-edit{background:url("../images/menu-bits.gif") no-repeat scroll 0 -105px;position:absolute;right:-20px;top:0;display:block;width:23px;height:36px;overflow:hidden;text-indent:-999em;border-bottom:1px solid #eee;-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px;}.menu-item-settings{background:#F9F9F9;width:400px;padding:10px 0 10px 10px;border:solid #E6E6E6;border-width:0 1px 1px 1px;-moz-border-radius:0 0 6px 6px;-webkit-border-bottom-right-radius:6px;-webkit-border-bottom-left-radius:6px;-khtml-border-bottom-right-radius:6px;-khtml-border-bottom-left-radius:6px;}.menu-item-settings.menu-item-edit-active{display:block;}.menu-item-settings.menu-item-edit-inactive{display:none;}.add-menu-item-pagelinks{margin:.5em auto;text-align:center;}.link-to-original{display:block;margin:0 0 10px;padding:3px 5px 5px;font-size:11px;color:#777;font-style:italic;border:1px solid #dfdfdf;border-radius:6px;-webkit-border-radius:6px;-moz-border-radius:6px;-khtml-border-radius:6px;}.link-to-original a{padding-left:4px;font-style:normal;}.hidden-field{display:none;}.menu-item-settings .description-thin,.menu-item-settings .description-wide{margin-right:10px;float:left;}.description-thin{width:190px;height:40px;}.description-wide{width:390px;}.menu-item-actions{padding-top:15px;line-height:25px;}.save-menu-item{padding-left:10px;float:right;}#cancel-save{cursor:pointer;}#cancel-save:hover{color:#fff!important;}#update-menu-item{color:#fff!important;}#update-menu-item:hover,#update-menu-item:active,#update-menu-item:focus{color:#eaf2fa!important;border-color:#13455b!important;}.major-publishing-actions{padding:5px 10px;border-bottom:1px solid #eee;}.major-publishing-actions .publishing-action{text-align:right;float:right;line-height:23px;}.major-publishing-actions .delete-action{line-height:25px;vertical-align:middle;text-align:left;float:right;padding-right:15px;}.menu-name-label span{font-size:11px;font-style:normal;}.submitbox .submitclose{color:#21759B;border-bottom:1px solid #21759B;padding:1px 2px;text-decoration:none;}.submitbox .submitclose:hover{background:#21759B;color:#fff;}#nav-menus-frame:after,.menu-item-settings:after,.button-controls:after,#menu-item-url-wrap:after,#menu-item-name-wrap:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#nav-menus-frame,.menu-item-settings,.button-controls,#menu-item-url-wrap,#menu-item-name-wrap{display:block;} \ No newline at end of file +html,body{min-width:950px;}#nav-menus-frame{margin-left:300px;}#wpbody-content #menu-settings-column{display:block;width:281px;margin-left:-300px;clear:both;float:left;padding-top:24px;}.no-js #wpbody-content #menu-settings-column{padding-top:31px;}#menu-settings-column .inside{padding:0 10px;}#menu-settings-column .handlediv{background:url("../images/menu-bits.gif") no-repeat scroll 0 -110px;}#wpbody{position:relative;}#menu-management-liquid{float:left;min-width:100%;}#menu-management{position:relative;margin-right:20px;margin-top:-3px;width:100%;}#menu-management .menu-edit{margin-bottom:20px;}#nav-menu-header,#post-body{border-color:#ccc;border-style:solid;}#nav-menu-header{background:url("../images/gray-grad.png") repeat-x scroll left top #dfdfdf;border-width:1px 1px 0 1px;-moz-border-radius-topleft:6px;-webkit-border-top-left-radius:6px;-khtml-border-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-topright:6px;-webkit-border-top-right-radius:6px;-khtml-border-top-right-radius:6px;border-top-right-radius:6px;}#post-body{background:#fff;padding:0 0 10px 10px;border-width:0 1px 1px 1px;-moz-border-radius-bottomleft:6px;-webkit-border-bottom-left-radius:6px;-khtml-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-moz-border-radius-bottomright:6px;-webkit-border-bottom-right-radius:6px;-khtml-border-bottom-right-radius:6px;border-bottom-right-radius:6px;}#post-body-content{position:relative;}.post-body-plain{padding:10px 10px 0 0;}#menu-management .menu-add-new abbr{font-weight:bold;}#menu-management .nav-tabs-nav{margin:0 20px;}#menu-management .nav-tabs-arrow{width:10px;padding:0 5px 4px;cursor:pointer;position:absolute;top:0;line-height:22px;font-size:18px;text-shadow:0 1px 0 #fff;}#menu-management .nav-tabs-arrow a{color:#C1C1C1;}#menu-management .nav-tabs-arrow a:hover{color:#D54E21;}#menu-management .nav-tabs-arrow a:active{color:#464646;}#menu-management .nav-tabs-arrow-left{left:0;}#menu-management .nav-tabs-arrow-right{right:0;text-align:right;}#menu-management .nav-tabs-wrapper{width:100%;height:28px;margin-bottom:-1px;overflow:hidden;}#menu-management .nav-tabs{padding-left:30px;padding-right:10px;}.js #menu-management .nav-tabs{float:left;margin-left:0;margin-right:-400px;}#menu-management .nav-tab{margin-bottom:0;background:#f4f4f4;font-weight:bold;border-color:#dfdfdf;}#menu-management .nav-tab-active{background:#ececec;border-color:#ccc;border-bottom-color:#ececec;}#select-nav-menu-container{text-align:right;padding:0 10px 3px 10px;margin-bottom:5px;}#select-nav-menu{width:100px;display:inline;}#menu-management #major-publishing-actions #delete-action{float:right;margin-right:10px;}#menu-name-label{margin-top:-2px;}#wpbody .open-label{display:inline-block;}#wpbody .open-label span{padding-right:10px;}.js .input-with-default-title{color:#aaa;font-style:italic;}#menu-management .inside{padding:0 10px;}.postbox .howto input{width:180px;float:right;}.customlinkdiv .howto input{width:210px;}.add-menu-item-view-all{height:400px;}#side-sortables .potential-menu-item{margin-left:0;position:relative;margin:6px 0;}#side-sortables .potential-menu-item ul{margin-left:0;}#side-sortables .potential-menu-item li{cursor:move;padding:1px 6px;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;-khtml-border-radius:4px;}.potential-menu-item li{background:#eee;border:1px solid #dfdfdf;color:#646464;}.potential-menu-item li:hover{color:#222;border-color:#ccc;background:#f9f9f9;}.selected-menu-item li{background:#FFFFE0;border-color:#E6DB55;}.selected-menu-item li:hover{background:#ffffbe;border-color:#e2d537;}.potential-menu-item .item-controls,.potential-menu-item .menu-item-transport{display:none;}.potential-menu-item .ui-draggable-dragging div,.potential-menu-item .menu-item-handle .item-controls{display:block;}#side-sortables .new-menu-item,#side-sortables .new-menu-item li,#side-sortables .additional-menu-items li{background:transparent;border:0;}#side-sortables .additional-menu-items li{margin-top:13px;}.item-edit img.waiting{display:block;}#menu-container .submit{margin:0 0 10px;padding:0;}.submitdelete,.submitclose{font-size:11px;}#cancel-save{color:#f00;text-decoration:underline;font-size:11px;margin-left:20px;margin-top:5px;}#cancel-save:hover{background-color:#F00;color:#fff;}.list-controls{float:left;margin-top:5px;}.add-to-menu{float:right;}.postbox img.waiting{display:none;vertical-align:middle;}.button-controls{margin:10px 0;}.show-all,.hide-all{cursor:pointer;}.hide-all{display:none;}#create-menu-name{width:159px;}#manage-menu .inside{padding:0;}#available-links dt{display:block;}#add-custom-link .howto{font-size:11px;}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px;}.menu-item-textbox{width:180px;}.howto span{margin-top:4px;display:block;float:left;}.quick-search{width:190px;}.list-wrap{display:none;clear:both;margin-bottom:10px;}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid #DFDFDF;-moz-border-radius:4px;}.postbox p.submit{margin-bottom:0;}.list li{display:none;margin:0;margin-bottom:5px;}.list li .menu-item-title{cursor:pointer;display:block;}.list li .menu-item-title input{margin-right:3px;margin-top:-3px;}#menu-container .inside{padding-bottom:10px;}.menu{padding-top:1em;}#menu-to-edit{padding:1em 0;}.menu ul{width:100%;}.menu li{margin-bottom:0;}.menu-item-bar{clear:both;line-height:1.5em;position:relative;margin-top:13px;}.menu-item-handle{background:url("../images/gray-grad.png") repeat-x scroll left top #DFDFDF;border:1px solid #E6E6E6;position:relative;padding-left:10px;height:auto;width:400px;line-height:35px;text-shadow:0 1px 0 #FFF;font-weight:bold;overflow:hidden;border-radius:6px;-webkit-border-radius:6px;-moz-border-radius:6px;-khtml-border-radius:6px;}.menu-item-edit-active .menu-item-handle{-moz-border-radius:6px 6px 0 0;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px;-khtml-border-top-right-radius:6px;-khtml-border-top-left-radius:6px;border-top-right-radius:6px;border-top-left-radius:6px;}.js .menu-item-handle{cursor:move;}.menu li.deleting .menu-item-handle{background-color:#faa;}.menu-item-handle .item-title{padding:7px 0;line-height:20px;display:block;margin-right:13em;}li.menu-item.ui-sortable-helper dl{margin-top:0;}li.menu-item.ui-sortable-helper .menu-item-transport dl{margin-top:13px;}.menu .sortable-placeholder{height:35px;width:410px;margin-top:13px;}.menu-item-depth-0{margin-left:0;}.menu-item-depth-1{margin-left:30px;}.menu-item-depth-2{margin-left:60px;}.menu-item-depth-3{margin-left:90px;}.menu-item-depth-4{margin-left:120px;}.menu-item-depth-5{margin-left:150px;}.menu-item-depth-6{margin-left:180px;}.menu-item-depth-7{margin-left:210px;}.menu-item-depth-8{margin-left:240px;}.menu-item-depth-9{margin-left:270px;}.menu-item-depth-10{margin-left:300px;}.menu-item-depth-11{margin-left:330px;}.menu-item-depth-0 .menu-item-transport{margin-left:0;}.menu-item-depth-1 .menu-item-transport{margin-left:-30px;}.menu-item-depth-2 .menu-item-transport{margin-left:-60px;}.menu-item-depth-3 .menu-item-transport{margin-left:-90px;}.menu-item-depth-4 .menu-item-transport{margin-left:-120px;}.menu-item-depth-5 .menu-item-transport{margin-left:-150px;}.menu-item-depth-6 .menu-item-transport{margin-left:-180px;}.menu-item-depth-7 .menu-item-transport{margin-left:-210px;}.menu-item-depth-8 .menu-item-transport{margin-left:-240px;}.menu-item-depth-9 .menu-item-transport{margin-left:-270px;}.menu-item-depth-10 .menu-item-transport{margin-left:-300px;}.menu-item-depth-11 .menu-item-transport{margin-left:-330px;}.item-type{text-transform:uppercase;font-size:11px;color:#999;padding-right:10px;}.item-controls{font-size:11px;position:absolute;right:20px;top:-1px;}.item-controls a{text-decoration:none;}.item-controls a:hover{cursor:pointer;}.item-controls .item-order{padding-right:10px;}.item-controls .item-order a{font-weight:bold;}body.js .item-order{display:none;}.item-controls .menu-item-delete:hover{color:#f00;}.item-edit{background:url("../images/menu-bits.gif") no-repeat scroll 0 -105px;position:absolute;right:-20px;top:0;display:block;width:23px;height:36px;overflow:hidden;text-indent:-999em;border-bottom:1px solid #eee;-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px;}.menu-item-settings{background:#F9F9F9;width:400px;padding:10px 0 10px 10px;border:solid #E6E6E6;border-width:0 1px 1px 1px;-moz-border-radius:0 0 6px 6px;-webkit-border-bottom-right-radius:6px;-webkit-border-bottom-left-radius:6px;-khtml-border-bottom-right-radius:6px;-khtml-border-bottom-left-radius:6px;}.menu-item-settings.menu-item-edit-active{display:block;}.menu-item-settings.menu-item-edit-inactive{display:none;}.add-menu-item-pagelinks{margin:.5em auto;text-align:center;}.link-to-original{display:block;margin:0 0 10px;padding:3px 5px 5px;font-size:11px;color:#777;font-style:italic;border:1px solid #dfdfdf;border-radius:6px;-webkit-border-radius:6px;-moz-border-radius:6px;-khtml-border-radius:6px;}.link-to-original a{padding-left:4px;font-style:normal;}.hidden-field{display:none;}.menu-item-settings .description-thin,.menu-item-settings .description-wide{margin-right:10px;float:left;}.description-thin{width:190px;height:40px;}.description-wide{width:390px;}.menu-item-actions{padding-top:15px;line-height:25px;}.save-menu-item{padding-left:10px;float:right;}#cancel-save{cursor:pointer;}#cancel-save:hover{color:#fff!important;}#update-menu-item{color:#fff!important;}#update-menu-item:hover,#update-menu-item:active,#update-menu-item:focus{color:#eaf2fa!important;border-color:#13455b!important;}.major-publishing-actions{padding:5px 10px;border-bottom:1px solid #eee;}.major-publishing-actions .publishing-action{text-align:right;float:right;line-height:23px;}.major-publishing-actions .delete-action{line-height:25px;vertical-align:middle;text-align:left;float:right;padding-right:15px;}.menu-name-label span{font-size:11px;font-style:normal;}.submitbox .submitclose{color:#21759B;border-bottom:1px solid #21759B;padding:1px 2px;text-decoration:none;}.submitbox .submitclose:hover{background:#21759B;color:#fff;}#nav-menus-frame:after,.menu-item-settings:after,.button-controls:after,#menu-item-url-wrap:after,#menu-item-name-wrap:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#nav-menus-frame,.menu-item-settings,.button-controls,#menu-item-url-wrap,#menu-item-name-wrap{display:block;} \ No newline at end of file diff --git a/wp-admin/css/nav-menu.dev.css b/wp-admin/css/nav-menu.dev.css index 085c7a7d8..ed32dacf7 100644 --- a/wp-admin/css/nav-menu.dev.css +++ b/wp-admin/css/nav-menu.dev.css @@ -313,6 +313,10 @@ body { padding-top:1em; } +#menu-to-edit { + padding: 1em 0; +} + .menu ul { width: 100%; } .menu ul.sub-menu { } diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index da5e3b3a9..db4962845 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -314,19 +314,16 @@ function wp_nav_menu_setup() { wp_nav_menu_post_type_meta_boxes(); wp_nav_menu_taxonomy_meta_boxes(); - // Register advanced menu items (columns) add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns'); add_filter( 'columns_prefs_header', create_function( '', "return __('Show advanced menu properties');" )); - - // If first time editing, disable advanced items by default. if( false === get_user_option( 'managenav-menuscolumnshidden' ) ) { $user = wp_get_current_user(); - update_user_option($user->ID, "managenav-menuscolumnshidden", - array ( 0 => 'link-target', 1 => 'css-classes', 2 => 'xfn', 3 => 'description', ), + update_user_option($user->ID, 'managenav-menuscolumnshidden', + array( 0 => 'link-target', 1 => 'css-classes', 2 => 'xfn', 3 => 'description', ), true); } } @@ -449,6 +446,9 @@ function wp_nav_menu_item_link_meta_box() {

+ + + diff --git a/wp-admin/js/nav-menu.dev.js b/wp-admin/js/nav-menu.dev.js index 1a49fbcfa..eae1a3878 100644 --- a/wp-admin/js/nav-menu.dev.js +++ b/wp-admin/js/nav-menu.dev.js @@ -182,6 +182,8 @@ var WPNavMenuHandler = function ($) { this.attachTabsPanelListeners(); + this.attachHomeLinkListener(); + if( menuList.length ) // If no menu, we're in the + tab. this.initSortables(); @@ -190,6 +192,8 @@ var WPNavMenuHandler = function ($) { this.initTabManager(); this.initAddMenuItemDraggables(); + + this.checkForEmptyMenu(); }, initToggles : function() { @@ -349,7 +353,7 @@ var WPNavMenuHandler = function ($) { // Set us to be the ajax target targetList = target.children('.menu-item-transport'); // Get all checked elements and assemble selected items. - items = menuItems.filter('.selected-menu-item').children().not( ui.helper ).clone(); + items = li.parents('.tabs-panel').find('.selected-menu-item').children().not( ui.helper ).clone(); ui.helper.children('.additional-menu-items').append( items ); // This class tells the sortables to treat it as a new item. ui.helper.addClass('new-menu-item'); @@ -372,7 +376,7 @@ var WPNavMenuHandler = function ($) { stop: function(e, ui) { // Reset the targetList and unselect the menu items targetList = menuList; - menuItems.filter('.selected-menu-item').deselectItem(); + $(e.target).parents('.tabs-panel').find('.selected-menu-item').deselectItem(); } }); }, @@ -478,9 +482,10 @@ var WPNavMenuHandler = function ($) { }); }, - addCustomLink : function() { - var url = $('#custom-menu-item-url').val(), - label = $('#custom-menu-item-name').val(), + addCustomLink : function(url, label, addToTop) { + var url = url || $('#custom-menu-item-url').val(), + label = label || $('#custom-menu-item-name').val(), + addToTop = addToTop || false, menu = $('#menu').val(), nonce = $('#menu-settings-column-nonce').val(), params = {}, @@ -506,13 +511,29 @@ var WPNavMenuHandler = function ($) { } }; - processMethod = that.eventAddMenuItem; - + processMethod = addToTop ? that.addMenuItemToTop : that.addMenuItemToBottom; + $.post( ajaxurl, params, function(menuMarkup) { processMethod.call(that, menuMarkup, params); // Remove the ajax spinner $('.customlinkdiv img.waiting').hide(); + + // Reset the form + wpNavMenu.resetCustomLinkForm(); + }); + }, + + resetCustomLinkForm : function() { + // set custom link form back to defaults + $('#custom-menu-item-name').val('').blur(); + $('#custom-menu-item-url').val('http://'); + }, + + attachHomeLinkListener : function() { + $('.add-home-link', '.customlinkdiv').click(function(e) { + wpNavMenu.addCustomLink( navMenuL10n.homeurl, navMenuL10n.home, true); + return false; }); }, @@ -726,11 +747,10 @@ var WPNavMenuHandler = function ($) { eventOnClickMenuDelete : function(clickedEl) { // Delete warning AYS - if ( confirm( navMenuL10n.warnDeleteMenu ) ) { + if ( confirm( navMenuL10n.warnDeleteMenu ) ) return true; - } else { + else return false; - } }, eventOnClickMenuItemDelete : function(clickedEl) { @@ -768,16 +788,17 @@ var WPNavMenuHandler = function ($) { * * @param string id The id of the metabox */ - addItemsToMenu : function(id) { + addItemsToMenu : function(id, addToTop) { var items = $( '.tabs-panel-active .categorychecklist li input:checked', '#' + id), menu = $('#menu').val(), nonce = $('#menu-settings-column-nonce').val(), params = {}, that = this, + addToTop = addToTop || false, processMethod = function(){}, re = new RegExp('menu-item\\[(\[^\\]\]*)'); - processMethod = that.eventAddMenuItem; + processMethod = addToTop ? that.addMenuItemToTop : that.addMenuItemToBottom; // If no items are checked, bail. if ( !items.length ) @@ -806,7 +827,7 @@ var WPNavMenuHandler = function ($) { }); // Uncheck the item - $(this).attr('checked', false); + $(this).parent().prev().deselectItem(); }); // Remove the ajax spinner @@ -819,9 +840,13 @@ var WPNavMenuHandler = function ($) { * @param string menuMarkup The text server response of menu item markup. * @param object req The request arguments. */ - eventAddMenuItem : function( menuMarkup, req ) { + addMenuItemToBottom : function( menuMarkup, req ) { $(menuMarkup).hideAdvancedMenuItemFields().appendTo( targetList ); }, + + addMenuItemToTop : function( menuMarkup, req ) { + $(menuMarkup).hideAdvancedMenuItemFields().prependTo( targetList ); + }, /** * Process the quick search response into a search result @@ -886,11 +911,20 @@ var WPNavMenuHandler = function ($) { removeMenuItem : function(el) { el = $(el) var children = el.childMenuItems(); + var that = this; el.addClass('deleting').fadeOut( 350 , function() { el.remove(); children.shiftDepthClass(-1).updateParentMenuItemDBId(); recalculateMenuItemPositions(); + that.checkForEmptyMenu(); + }); + }, + + checkForEmptyMenu : function() { + if( menuList.children().length ) return; + menuList.height(80).one('sortstop', function(){ + $(this).height('auto'); }); } } diff --git a/wp-admin/js/nav-menu.js b/wp-admin/js/nav-menu.js index f2711ee9f..292bba49a 100644 --- a/wp-admin/js/nav-menu.js +++ b/wp-admin/js/nav-menu.js @@ -1 +1 @@ -var WPNavMenuHandler=function(d){var h={},f=30,c=11,k=function(m,q,n,p){if(m&&m[0]){var o=d.parseJSON(m[0]);if(o.post_title){if(o.ID&&o.post_type){h[o.post_title]={ID:o.ID,object_type:o.post_type}}return o.post_title}}},l=function(m,q,n,p){if(m&&m[0]){var o=d.parseJSON(m[0]);if(o.post_title){return o.post_title}}},b=function(s,r){if(!s){return false}r=r||document;var n=["menu-item-db-id","menu-item-object-id","menu-item-object","menu-item-parent-id","menu-item-position","menu-item-type","menu-item-append","menu-item-title","menu-item-url","menu-item-description","menu-item-attr-title","menu-item-target","menu-item-classes","menu-item-xfn"],m={},o=r.getElementsByTagName("input"),q=o.length,p,t=document.getElementById("nav-menu-meta-object-id").value;while(q--){p=n.length;while(p--){if(o[q]&&o[q].name&&"menu-item["+s+"]["+n[p]+"]"==o[q].name){m[n[p]]=o[q].value}}}return m},a=function(){g.find(".menu-item-data-position").val(function(m){return m+1})},e=function(m){return m*f},i=function(m){return Math.floor(m/f)},g,j;d.fn.extend({menuItemDepth:function(){return i(this.eq(0).css("margin-left").slice(0,-2))},updateDepthClass:function(n,m){return this.each(function(){var o=d(this);m=m||o.menuItemDepth();d(this).removeClass("menu-item-depth-"+m).addClass("menu-item-depth-"+n)})},shiftDepthClass:function(m){return this.each(function(){var n=d(this),o=n.menuItemDepth();d(this).removeClass("menu-item-depth-"+o).addClass("menu-item-depth-"+(o+m))})},childMenuItems:function(){var m=d();this.each(function(){var n=d(this),p=n.menuItemDepth(),o=n.next();while(o.length&&o.menuItemDepth()>p){m=m.add(o);o=o.next()}});return m},updateParentMenuItemDBId:function(){return this.each(function(){var o=d(this),m=o.find(".menu-item-data-parent-id"),p=o.menuItemDepth(),n=o.prev();if(p==0){m.val(0)}else{while(n.menuItemDepth()!=p-1){n=n.prev()}m.val(n.find(".menu-item-data-object-id").val())}})},hideAdvancedMenuItemFields:function(){return this.each(function(){var m=d(this);d(".hide-column-tog").not(":checked").each(function(){m.find(".field-"+d(this).val()).addClass("hidden-field")})})},selectItem:function(){return this.each(function(){d(this).addClass("selected-menu-item").next().children("input").attr("checked","checked")})},deselectItem:function(){return this.each(function(){d(this).removeClass("selected-menu-item").next().children("input").removeAttr("checked")})},toggleItem:function(){return this.each(function(){var m=d(this);if(m.hasClass("selected-menu-item")){m.deselectItem()}else{m.selectItem()}})}});return{init:function(){g=d("#menu-to-edit");j=g;this.attachMenuEditListeners();this.attachMenuMetaListeners(document.getElementById("nav-menu-meta"));this.attachTabsPanelListeners();if(g.length){this.initSortables()}this.initToggles();this.initTabManager();this.initAddMenuItemDraggables()},initToggles:function(){postboxes.add_postbox_toggles("nav-menus");columns.useCheckboxesForHidden();columns.checked=function(m){d(".field-"+m).removeClass("hidden-field")};columns.unchecked=function(m){d(".field-"+m).addClass("hidden-field")};g.hideAdvancedMenuItemFields()},initSortables:function(){var s=0,r,q,m,p=g.offset().left,t,o;g.sortable({handle:".menu-item-handle",placeholder:"sortable-placeholder",start:function(C,B){var A,v,z,y,w,x;o=B.item.children(".menu-item-transport");t=(B.helper.hasClass("new-menu-item"));r=(t)?0:B.item.menuItemDepth();n(B,r);if(!t){y=(B.item.next()[0]==B.placeholder[0])?B.item.next():B.item;w=y.childMenuItems();o.append(w)}u(B);v=o.outerHeight();v+=(v>0)?(B.placeholder.css("margin-top").slice(0,-2)*1):0;v+=B.helper.outerHeight();v-=2;B.placeholder.height(v);x=r;if(!t){w.each(function(){var D=d(this).menuItemDepth();x=(D>x)?D:x})}z=B.helper.find(".menu-item-handle").outerWidth();z+=e(x-r);z-=2;B.placeholder.width(z)},stop:function(y,x){var w,v=s-r;w=o.children().insertAfter(x.item);if(t){x.item.remove();if(v!=0){w.shiftDepthClass(v)}w.updateParentMenuItemDBId()}else{if(v!=0){x.item.updateDepthClass(s);w.shiftDepthClass(v)}x.item.updateParentMenuItemDBId()}a()},change:function(w,v){if(!v.placeholder.parent().hasClass("menu")){v.placeholder.appendTo(g)}u(v)},sort:function(w,v){var x=i(v.helper.offset().left-p);if(xm){x=m}}if(x!=s){n(v,x)}},receive:function(w,v){o=v.sender.children(".menu-item-transport")}});function u(x){var w=x.placeholder.prev(),v=x.placeholder.next(),y;if(w[0]==x.item[0]){w=w.prev()}if(v[0]==x.item[0]){v=v.next()}q=(v.length)?v.menuItemDepth():0;if(w.length){m=((y=w.menuItemDepth()+1)>c)?c:y}else{m=0}}function n(v,w){v.placeholder.updateDepthClass(w,s);s=w}},initAddMenuItemDraggables:function(){var m=d(".potential-menu-item");m.click(function(n){d(this).toggleItem()}).children().draggable({helper:"clone",connectToSortable:"ul#menu-to-edit",distance:5,zIndex:100,start:function(s,q){var r=d(s.target),p=r.parent(),n=p.parent(),o;p.selectItem();j=r.children(".menu-item-transport");o=m.filter(".selected-menu-item").children().not(q.helper).clone();q.helper.children(".additional-menu-items").append(o);q.helper.addClass("new-menu-item");q.helper.children("div").hide();o.first().css("margin-top",0);o.children("div").addClass("menu-item-handle");q.helper.children("div").addClass("hidden-handle");n.parents(".inside").find(".add-to-menu input").click();q.helper.width(q.helper.width());q.helper.height(q.helper.height())},stop:function(o,n){j=g;m.filter(".selected-menu-item").deselectItem()}})},attachMenuEditListeners:function(){var m=this;d("#update-nav-menu").bind("click",function(n){if(n.target&&n.target.className){if(-1!=n.target.className.indexOf("item-edit")){return m.eventOnClickEditLink(n.target)}else{if(-1!=n.target.className.indexOf("menu-delete")){return m.eventOnClickMenuDelete(n.target)}else{if(-1!=n.target.className.indexOf("item-delete")){return m.eventOnClickMenuItemDelete(n.target)}else{if(-1!=n.target.className.indexOf("item-close")){return m.eventOnClickCloseLink(n.target)}}}}}})},setupInputWithDefaultTitle:function(){var m="input-with-default-title";d("."+m).each(function(){var p=d(this),o=p.attr("title"),n=p.val();p.data(m,o);if(""==n){p.val(o)}else{if(o==n){return}else{p.removeClass(m)}}}).focus(function(){var n=d(this);if(n.val()==n.data(m)){n.val("").removeClass(m)}}).blur(function(){var n=d(this);if(""==n.val()){n.val(n.data(m)).addClass(m)}})},attachMenuMetaListeners:function(m){if(!m){return}var n=this;this.setupInputWithDefaultTitle();d("input.quick-search").each(function(o,p){n.setupQuickSearchEventListeners(p)});d(m).click(function(p){var o=d(p.target).parent().parent().parent();if(d(p.target).is("input")&&d(p.target).hasClass("button-secondary")&&!d(p.target).hasClass("quick-search-submit")){if(d(o).hasClass("customlinkdiv")){n.addCustomLink()}else{if(d(o).hasClass("posttypediv")||d(o).hasClass("taxonomydiv")){n.addItemsToMenu(d(o).attr("id"))}}return false}else{if(d(p.target).is("input")&&d(p.target).hasClass("quick-search-submit")){n.quickSearch(d(o).attr("id"));return false}}})},quickSearch:function(u){var o=d("#"+u+" .quick-search").attr("name"),r=d("#"+u+" .quick-search").val(),t=d("#menu").val(),n=d("#menu-settings-column-nonce").val(),s={},p=this,m=function(){};m=p.processQuickSearchQueryResponse;s={action:"menu-quick-search","response-format":"markup",menu:t,"menu-settings-column-nonce":n,q:r,type:o};d.post(ajaxurl,s,function(q){m.call(p,q,s)})},addCustomLink:function(){var o=d("#custom-menu-item-url").val(),n=d("#custom-menu-item-name").val(),s=d("#menu").val(),p=d("#menu-settings-column-nonce").val(),r={},q=this,m=function(){};if(""==o||"http://"==o){return false}d(".customlinkdiv img.waiting").show();r={action:"add-menu-item",menu:s,"menu-settings-column-nonce":p,"menu-item":{"-1":{"menu-item-type":"custom","menu-item-url":o,"menu-item-title":n}}};m=q.eventAddMenuItem;d.post(ajaxurl,r,function(t){m.call(q,t,r);d(".customlinkdiv img.waiting").hide()})},attachTabsPanelListeners:function(){d("#menu-settings-column").bind("click",function(r){if(r.target&&r.target.className&&-1!=r.target.className.indexOf("nav-tab-link")){var o,u=/#(.*)$/.exec(r.target.href),t,m=d(r.target).parents(".inside").first()[0],q=m?m.getElementsByTagName("input"):[],p=q.length;while(p--){q[p].checked=false}d(".tabs-panel",m).each(function(){if(this.className){this.className=this.className.replace("tabs-panel-active","tabs-panel-inactive")}});d(".tabs",m).each(function(){this.className=this.className.replace("tabs","")});r.target.parentNode.className+=" tabs";if(u&&u[1]){o=document.getElementById(u[1]);if(o){o.className=o.className.replace("tabs-panel-inactive","tabs-panel-active")}}return false}else{if(r.target&&r.target.className&&-1!=r.target.className.indexOf("select-all")){var n=/#(.*)$/.exec(r.target.href),s;if(n&&n[1]){s=d("#"+n[1]+" .tabs-panel-active .potential-menu-item");if(s.length===s.filter(".selected-menu-item").length){s.deselectItem()}else{s.selectItem()}return false}}}})},initTabManager:function(){var r=d(".nav-tabs-wrapper"),s=r.children(".nav-tabs"),q=s.children(".nav-tab-active"),u=s.children(".nav-tab"),o=0,v,p,t,n;resizing=false;function m(){p=r.offset().left;v=p+r.width();q.makeTabVisible()}d.fn.extend({makeTabVisible:function(){var x=this.eq(0),y,w;if(!x.length){return}y=x.offset().left;w=y+x.outerWidth();if(w>v){s.animate({"margin-left":"+="+(v-w)+"px",},"fast")}else{if(y=p)?true:false}});u.each(function(){o+=d(this).outerWidth(true)});if(o<=r.width()-s.css("padding-left").slice(0,-2)-s.css("padding-right").slice(0,-2)){return}s.css({"margin-right":(-1*o)+"px",padding:0,});t=d('

');n=d('');r.wrap('