Ticket #23450: 23450.9.diff
File 23450.9.diff, 14.2 KB (added by , 10 years ago) |
---|
-
wp-admin/css/wp-admin.css
6037 6037 overflow: auto; 6038 6038 } 6039 6039 6040 .wp-full-overlay-sidebar-content .accordion-section:first-child { 6041 border-top: 1px solid #fff; 6042 } 6043 6040 6044 /* Close Link */ 6041 6045 .wp-full-overlay .close-full-overlay { 6042 6046 text-decoration: none; … … 7202 7206 display: block; 7203 7207 } 7204 7208 7209 #nav-menu-meta ul.outer-border { 7210 -webkit-border-radius: 3px; 7211 border-radius: 3px; 7212 } 7213 7214 .accordion-section ul.category-tabs, 7215 .accordion-section ul.add-menu-item-tabs, 7216 .accordion-section ul.wp-tab-bar { 7217 margin: 0; 7218 } 7219 7220 .accordion-section .categorychecklist { 7221 margin: 13px 0; 7222 } 7223 7224 #nav-menu-meta .accordion-section-content { 7225 padding: 18px 13px; 7226 } 7227 7228 #nav-menu-meta .button-controls { 7229 margin-bottom: 0; 7230 } 7231 7205 7232 #nav-menus-frame { 7206 7233 margin-left: 300px; 7207 7234 margin-top: 28px; … … 7331 7358 } 7332 7359 7333 7360 .nav-menus-php #post-body { 7334 padding: 0 10px ;7361 padding: 0 10px 10px; 7335 7362 border-width: 1px 0; 7336 7363 border-style: solid; 7337 7364 } … … 7401 7428 } 7402 7429 7403 7430 /* Add Menu Item Boxes */ 7404 .postbox .howto input { 7431 .postbox .howto input, 7432 .accordion-container .howto input { 7405 7433 width: 180px; 7406 7434 float: right; 7407 7435 } 7408 7436 7437 .accordion-container .outer-border { 7438 margin-top: 0; 7439 } 7440 7441 .accordion-container .accordion-section:first-child { 7442 -webkit-border-top-right-radius: 3px; 7443 -webkit-border-top-left-radius: 3px; 7444 border-top-right-radius: 3px; 7445 border-top-left-radius: 3px; 7446 } 7447 7448 .accordion-container .accordion-section:last-child { 7449 -webkit-border-bottom-right-radius: 3px; 7450 -webkit-border-bottom-left-radius: 3px; 7451 border-bottom-right-radius: 3px; 7452 border-bottom-left-radius: 3px; 7453 } 7454 7409 7455 .customlinkdiv .howto input { 7410 width: 200px;7456 width: 180px; 7411 7457 } 7412 7458 7459 .customlinkdiv p { 7460 margin-top: 0 7461 } 7462 7413 7463 #nav-menu-theme-locations .howto select { 7414 7464 width: 100%; 7415 7465 } … … 8818 8868 margin: 0; 8819 8869 } 8820 8870 8871 .accordion-section:first-child { 8872 border-top: 1px solid #dfdfdf; 8873 } 8874 8821 8875 .accordion-section:last-child { 8822 8876 box-shadow: 0 1px 0 0px #fff; 8823 8877 } … … 8825 8879 .accordion-section.open .accordion-section-content { 8826 8880 display: block; 8827 8881 background: #fdfdfd; 8882 border-left: 1px solid #dfdfdf; 8883 border-right: 1px solid #dfdfdf; 8828 8884 } 8829 8885 8830 8886 .accordion-section.open:hover { … … 8841 8897 margin: 0; 8842 8898 padding: 15px 20px; 8843 8899 position: relative; 8900 border-left: 1px solid #dfdfdf; 8901 border-right: 1px solid #dfdfdf; 8844 8902 8845 8903 cursor: pointer; 8846 8904 … … 8914 8972 background-image: -moz-linear-gradient(bottom, #6d6d6d, #808080); 8915 8973 background-image: -o-linear-gradient(bottom, #6d6d6d, #808080); 8916 8974 background-image: linear-gradient(to top, #6d6d6d, #808080); 8975 border-left: 1px solid #808080; 8976 border-right: 1px solid #808080; 8917 8977 } 8918 8978 8919 8979 .control-section.accordion-section:hover, -
wp-admin/includes/nav-menu.php
387 387 function wp_nav_menu_setup() { 388 388 // Register meta boxes 389 389 wp_nav_menu_post_type_meta_boxes(); 390 add_me ta_box( 'add-custom-links', __( 'Add Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );390 add_menu_accordion_section( 'add-custom-links', __( 'Links' ), 'wp_nav_menu_item_link_meta_box', 'side', 'default' ); 391 391 wp_nav_menu_taxonomy_meta_boxes(); 392 392 393 393 // Register advanced menu items (columns) 394 add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' );394 add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' ); 395 395 396 396 // If first time editing, disable advanced items by default. 397 397 if( false === get_user_option( 'managenav-menuscolumnshidden' ) ) { … … 440 440 function wp_nav_menu_post_type_meta_boxes() { 441 441 $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' ); 442 442 443 // Reverse array to show pages as first item 444 $post_types = array_merge( array_reverse( array_slice( $post_types, 0, 2 ) ), $post_types ); 445 443 446 if ( ! $post_types ) 444 447 return; 445 448 … … 447 450 $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type ); 448 451 if ( $post_type ) { 449 452 $id = $post_type->name; 450 add_me ta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type );453 add_menu_accordion_section( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'side', 'default', $post_type ); 451 454 } 452 455 } 453 456 } … … 467 470 $tax = apply_filters( 'nav_menu_meta_box_object', $tax ); 468 471 if ( $tax ) { 469 472 $id = $tax->name; 470 add_me ta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );473 add_menu_accordion_section( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'side', 'default', $tax ); 471 474 } 472 475 } 473 476 } … … 565 568 566 569 ?> 567 570 <div class="customlinkdiv" id="customlinkdiv"> 571 <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" /> 572 <p id="menu-item-url-wrap"> 573 <label class="howto" for="custom-menu-item-url"> 574 <span><?php _e('URL'); ?></span> 575 <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" /> 576 </label> 577 </p> 568 578 569 <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" /> 570 <p id="menu-item-url-wrap"> 571 <label class="howto" for="custom-menu-item-url"> 572 <span><?php _e('URL'); ?></span> 573 <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" /> 574 </label> 575 </p> 579 <p id="menu-item-name-wrap"> 580 <label class="howto" for="custom-menu-item-name"> 581 <span><?php _e( 'Link Text' ); ?></span> 582 <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Menu Item'); ?>" /> 583 </label> 584 </p> 576 585 577 <p id="menu-item-name-wrap">578 <label class="howto" for="custom-menu-item-name">579 <span><?php _e( 'Link Text' ); ?></span>580 <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Menu Item'); ?>" />581 </label>582 </p>583 584 586 <p class="button-controls"> 585 587 <span class="add-to-menu"> 586 588 <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" /> -
wp-admin/includes/template.php
887 887 $screen = get_current_screen(); 888 888 elseif ( is_string( $screen ) ) 889 889 $screen = convert_to_screen( $screen ); 890 890 891 891 $page = $screen->id; 892 892 893 893 $hidden = get_hidden_meta_boxes( $screen ); … … 968 968 } 969 969 970 970 /** 971 * Add Menu Accordion Section 972 * 973 * Used as a wrapper for add_meta_box() to both add new menu accordion 974 * sections and reinforce the idea that we're no longer working with 975 * "meta boxes" in the Menus UI but rather accordion sections. 976 * 977 * @since 3.6.0 978 * 979 * @uses add_meta_box() to add a new accordion section via do_menu_accordion_sections(). 980 * 981 * @param string $id String for use in the 'id' attribute of tags. 982 * @param string $title Title of the menu accordion section. 983 * @param string $callback Function that fills the section with the desired content. The function should echo its output. 984 * @param string $context Optional. The context within the accordion where the section should show ('normal', 'advanced'). 985 * @param string $priority Optional. The priority within the context where the section should show ('high', 'low'). 986 * @param array $callback_args Optional. Data that should be set as the "args" property of the section array (which is the second parameter passed to your callback). 987 */ 988 function add_menu_accordion_section( $id, $title, $callback, $context = 'advanced', $priority = 'default', $callback_args = null ) { 989 add_meta_box( $id, $title, $callback, 'nav-menus', $context, $priority, $callback_args ); 990 } 991 992 /** 993 * Menu Accordion Template Function 994 * 995 * Largely abstracted away from code in do_meta_boxes(), this function 996 * serves to build the list items contained in the Menus UI accordion. 997 * The naming also serves to reinforce the idea that we're no longer 998 * working with "meta boxes" in the Menus UI, but rather an accordion. 999 * 1000 * @since 3.6.0 1001 * 1002 * @uses global $wp_meta_boxes to retrieve registered sections. 1003 * 1004 * @param string|object $screen Screen identifier. 1005 * @param string $context accordion section context. 1006 * @param mixed $object gets passed to the section callback function as first parameter. 1007 * @return int number of accordion sections. 1008 */ 1009 function do_menu_accordion_sections( $screen, $context, $object ) { 1010 global $wp_meta_boxes; 1011 1012 if ( empty( $screen ) ) 1013 $screen = get_current_screen(); 1014 elseif ( is_string( $screen ) ) 1015 $screen = convert_to_screen( $screen ); 1016 1017 $page = $screen->id; 1018 1019 $hidden = get_hidden_meta_boxes( $screen ); 1020 1021 $i = 0; 1022 do { 1023 if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) 1024 break; 1025 1026 foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) { 1027 if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) { 1028 foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { 1029 if ( false == $box || ! $box['title'] ) 1030 continue; 1031 $i++; 1032 $style = ''; 1033 $hidden_class = in_array( $box['id'], $hidden ) ? ' hide-if-js' : ''; 1034 ?> 1035 <li class="control-section accordion-section <?php echo $hidden; ?>" id="accordion-section-title_tagline"> 1036 <h3 class="accordion-section-title hndle" tabindex="0" title="<?php echo esc_attr( $box['title'] ); ?>"><?php echo esc_html( $box['title'] ); ?></h3> 1037 <div id="<?php echo $box['id']; ?>" class="accordion-section-content <php postbox_classes( $box['id'], $page ); ?>"> 1038 <div class="inside"> 1039 <?php call_user_func( $box['callback'], $object, $box ); ?> 1040 </div><!-- .inside --> 1041 </div><!-- .accordion-section-content --> 1042 </li><!-- .control-section --> 1043 <?php 1044 } 1045 } 1046 } 1047 } while(0); 1048 1049 return $i; 1050 } 1051 1052 /** 1053 * Remove Menu Accordion Section 1054 * 1055 * Used as a wrapper for remove_meta_box() to both remove menu accordion 1056 * sections and reinforce the idea that we're no longer working with 1057 * "meta boxes" in the Menus UI but rather accordion sections. 1058 * 1059 * @since 3.6.0 1060 * 1061 * @uses remove_meta_box() to remove an accordion section. 1062 * 1063 * @param string $id String for use in the 'id' attribute of tags. 1064 * @param string $context The context within the accordion where the section shows ('normal', 'advanced'). 1065 */ 1066 function remove_menu_accordion_section( $id, $context ) { 1067 remove_meta_box( $id, 'nav-menus', $context ); 1068 } 1069 1070 /** 971 1071 * Add a new section to a settings page. 972 1072 * 973 1073 * Part of the Settings API. Use this to define new settings sections for an admin page. -
wp-admin/js/nav-menu.js
42 42 43 43 this.attachUnsavedChangesListener(); 44 44 45 if( api.menuList.length ) // If no menu, we're in the + tab.45 if( api.menuList.length ) 46 46 this.initSortables(); 47 47 48 48 if( oneThemeLocationNoMenus ) … … 51 51 this.initAccessibility(); 52 52 53 53 this.initToggles(); 54 55 // Open first accordion option 56 $( '.accordion-container li' ).first().addClass( 'open' ); 54 57 }, 55 58 56 59 jQueryExtensions : function() { … … 380 383 initToggles : function() { 381 384 // init postboxes 382 385 postboxes.add_postbox_toggles('nav-menus'); 383 386 384 387 // adjust columns functions for menus UI 385 388 columns.useCheckboxesForHidden(); 386 389 columns.checked = function(field) { … … 786 789 target = $(e.target); 787 790 788 791 if ( target.hasClass('nav-tab-link') ) { 789 panelId = /#(.*)$/.exec(e.target.href);790 if ( panelId && panelId[1] )791 panelId = panelId[1]792 else793 return false;794 792 795 wrapper = target.parents('.inside').first();793 panelId = target.data( 'type' ); 796 794 795 wrapper = target.parents('.accordion-section-content').first(); 796 797 797 // upon changing tabs, we want to uncheck all checkboxes 798 798 $('input', wrapper).removeAttr('checked'); 799 799 … … 806 806 // select the search bar 807 807 $('.quick-search', wrapper).focus(); 808 808 809 return false;809 e.preventDefault(); 810 810 } else if ( target.hasClass('select-all') ) { 811 811 selectAreaMatch = /#(.*)$/.exec(e.target.href); 812 812 if ( selectAreaMatch && selectAreaMatch[1] ) { -
wp-admin/nav-menus.php
23 23 wp_die( __( 'Cheatin’ uh?' ) ); 24 24 25 25 wp_enqueue_script( 'nav-menu' ); 26 wp_enqueue_script( 'accordion' ); 26 27 27 28 if ( wp_is_mobile() ) 28 29 wp_enqueue_script( 'jquery-touch-punch' ); … … 422 423 add_filter('admin_body_class', 'wp_nav_menu_max_depth'); 423 424 424 425 wp_nav_menu_setup(); 426 425 427 wp_initial_nav_menu_meta_boxes(); 426 428 427 429 if ( ! current_theme_supports( 'menus' ) && ! wp_get_nav_menus() ) … … 510 512 <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> 511 513 <input type="hidden" name="action" value="add-menu-item" /> 512 514 <?php wp_nonce_field( 'add-menu_item', 'menu-settings-column-nonce' ); ?> 513 <?php do_meta_boxes( 'nav-menus', 'side', null ); ?> 515 <div id="side-sortables" class="accordion-container"> 516 <ul class="outer-border"> 517 <?php do_menu_accordion_sections( 'nav-menus', 'side', null ); ?> 518 </ul> 519 </div> 514 520 </form> 515 521 516 522 </div><!-- /#menu-settings-column -->