From 83bb916b81555cd23e8aef359078825ba52d3111 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Fri, 15 Mar 2013 13:16:38 +0000 Subject: [PATCH] Turn the Nav Menu meta boxes into an accordion. Less sprawling and overwhelming. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Registration stays the same — they're meta boxes * Call `do_accordion_sections()` instead of `do_meta_boxes()` and they render as an accordion props DrewAPicture, lessbloat, jkudish. fixes #23450. see #23449 git-svn-id: http://core.svn.wordpress.org/trunk@23707 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/css/wp-admin.css | 66 ++++++++++++++++++++++++++++-- wp-admin/includes/nav-menu.php | 75 ++++++++++++++++++++++------------ wp-admin/includes/template.php | 64 +++++++++++++++++++++++++++++ wp-admin/js/nav-menu.js | 34 +++++++++++---- wp-admin/nav-menus.php | 3 +- 5 files changed, 205 insertions(+), 37 deletions(-) diff --git a/wp-admin/css/wp-admin.css b/wp-admin/css/wp-admin.css index 08d9906c4b..c82bcfd4cf 100644 --- a/wp-admin/css/wp-admin.css +++ b/wp-admin/css/wp-admin.css @@ -6037,6 +6037,10 @@ body.full-overlay-active { overflow: auto; } +.wp-full-overlay-sidebar-content .accordion-section:first-child { + border-top: 1px solid #fff; +} + /* Close Link */ .wp-full-overlay .close-full-overlay { text-decoration: none; @@ -7202,6 +7206,29 @@ a.rsswidget { display: block; } +#nav-menu-meta ul.outer-border { + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.accordion-section ul.category-tabs, +.accordion-section ul.add-menu-item-tabs, +.accordion-section ul.wp-tab-bar { + margin: 0; +} + +.accordion-section .categorychecklist { + margin: 13px 0; +} + +#nav-menu-meta .accordion-section-content { + padding: 18px 13px; +} + +#nav-menu-meta .button-controls { + margin-bottom: 0; +} + #nav-menus-frame { margin-left: 300px; margin-top: 28px; @@ -7331,7 +7358,7 @@ a.rsswidget { } .nav-menus-php #post-body { - padding: 0 10px; + padding: 0 10px 10px; border-width: 1px 0; border-style: solid; } @@ -7401,13 +7428,36 @@ a.rsswidget { } /* Add Menu Item Boxes */ -.postbox .howto input { +.postbox .howto input, +.accordion-container .howto input { width: 180px; float: right; } +.accordion-container .outer-border { + margin-top: 0; +} + +.accordion-container .accordion-section:first-child { + -webkit-border-top-right-radius: 3px; + -webkit-border-top-left-radius: 3px; + border-top-right-radius: 3px; + border-top-left-radius: 3px; +} + +.accordion-container .accordion-section:last-child { + -webkit-border-bottom-right-radius: 3px; + -webkit-border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; + border-bottom-left-radius: 3px; +} + .customlinkdiv .howto input { - width: 200px; + width: 180px; +} + +.customlinkdiv p { + margin-top: 0 } #nav-menu-theme-locations .howto select { @@ -8818,6 +8868,10 @@ a.widget-control-edit { margin: 0; } +.accordion-section:first-child { + border-top: 1px solid #dfdfdf; +} + .accordion-section:last-child { box-shadow: 0 1px 0 0px #fff; } @@ -8825,6 +8879,8 @@ a.widget-control-edit { .accordion-section.open .accordion-section-content { display: block; background: #fdfdfd; + border-left: 1px solid #dfdfdf; + border-right: 1px solid #dfdfdf; } .accordion-section.open:hover { @@ -8841,6 +8897,8 @@ a.widget-control-edit { margin: 0; padding: 15px 20px; position: relative; + border-left: 1px solid #dfdfdf; + border-right: 1px solid #dfdfdf; cursor: pointer; @@ -8914,6 +8972,8 @@ a.widget-control-edit { background-image: -moz-linear-gradient(bottom, #6d6d6d, #808080); background-image: -o-linear-gradient(bottom, #6d6d6d, #808080); background-image: linear-gradient(to top, #6d6d6d, #808080); + border-left: 1px solid #808080; + border-right: 1px solid #808080; } .control-section.accordion-section:hover, diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index c28ea891cf..6e602e0b37 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -387,11 +387,11 @@ function _wp_ajax_menu_quick_search( $request = array() ) { function wp_nav_menu_setup() { // Register meta boxes wp_nav_menu_post_type_meta_boxes(); - add_meta_box( 'add-custom-links', __( 'Add Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' ); + add_meta_box( 'add-custom-links', __( 'Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' ); wp_nav_menu_taxonomy_meta_boxes(); // Register advanced menu items (columns) - add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns'); + add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' ); // If first time editing, disable advanced items by default. if( false === get_user_option( 'managenav-menuscolumnshidden' ) ) { @@ -447,7 +447,9 @@ function wp_nav_menu_post_type_meta_boxes() { $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type ); if ( $post_type ) { $id = $post_type->name; - add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type ); + // give pages a higher priority + $priority = ( 'page' == $post_type->name ? 'core' : 'default' ); + add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type ); } } } @@ -565,21 +567,20 @@ function wp_nav_menu_item_link_meta_box() { ?>
+ + - - - - +

@@ -683,10 +684,22 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) { ?>

    -
  • >
  • -
  • >
  • -
  • >
  • -
+
  • > + + + +
  • +
  • > + + + +
  • +
  • > + + + +
  • +