Ticket #23450: 23450.12.diff
File 23450.12.diff, 17.0 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_meta_box( 'add-custom-links', __( ' AddLinks' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );390 add_meta_box( 'add-custom-links', __( 'Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', '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 … … 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" /> … … 683 685 ?> 684 686 <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv"> 685 687 <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs"> 686 <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent"><?php _e('Most Recent'); ?></a></li> 687 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all"><?php _e('View All'); ?></a></li> 688 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search"><?php _e('Search'); ?></a></li> 689 </ul> 688 <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>> 689 <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent"> 690 <?php _e( 'Most Recent' ); ?> 691 </a> 692 </li> 693 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>> 694 <a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all"> 695 <?php _e( 'View All' ); ?> 696 </a> 697 </li> 698 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>> 699 <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search"> 700 <?php _e( 'Search'); ?> 701 </a> 702 </li> 703 </ul><!-- .posttype-tabs --> 690 704 691 705 <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php 692 706 echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); … … 893 907 ?> 894 908 <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv"> 895 909 <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs"> 896 <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"><?php _e('Most Used'); ?></a></li> 897 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"><?php _e('View All'); ?></a></li> 898 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"><?php _e('Search'); ?></a></li> 899 </ul> 910 <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>> 911 <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"> 912 <?php _e( 'Most Used' ); ?> 913 </a> 914 </li> 915 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>> 916 <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"> 917 <?php _e( 'View All' ); ?> 918 </a> 919 </li> 920 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>> 921 <a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"> 922 <?php _e( 'Search' ); ?> 923 </a> 924 </li> 925 </ul><!-- .taxonomy-tabs --> 900 926 901 927 <div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php 902 928 echo ( 'most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); -
wp-admin/includes/template.php
968 968 } 969 969 970 970 /** 971 * Meta Box Accordion Template Function 972 * 973 * Largely made up of abstracted code from {@link do_meta_boxes()}, this 974 * function serves to build meta boxes as list items for use in an accordion. 975 * 976 * @since 3.6.0 977 * 978 * @uses global $wp_meta_boxes to retrieve registered meta boxes. 979 * 980 * @param string|object $screen Screen identifier. 981 * @param string $context meta box context. 982 * @param mixed $object gets passed to the section callback function as first parameter. 983 * @return int number of meta boxes as accordion sections. 984 */ 985 function do_accordion_sections( $screen, $context, $object ) { 986 global $wp_meta_boxes; 987 988 if ( empty( $screen ) ) 989 $screen = get_current_screen(); 990 elseif ( is_string( $screen ) ) 991 $screen = convert_to_screen( $screen ); 992 993 $page = $screen->id; 994 995 $hidden = get_hidden_meta_boxes( $screen ); 996 997 $i = 0; 998 do { 999 if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) 1000 break; 1001 1002 foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) { 1003 if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) { 1004 foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { 1005 if ( false == $box || ! $box['title'] ) 1006 continue; 1007 $i++; 1008 $style = ''; 1009 $hidden_class = in_array( $box['id'], $hidden ) ? ' hide-if-js' : ''; 1010 ?> 1011 <li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo $box['id']; ?>" id="<?php echo $box['id']; ?>"> 1012 <h3 class="accordion-section-title hndle" tabindex="0" title="<?php echo esc_attr( $box['title'] ); ?>"><?php echo esc_html( $box['title'] ); ?></h3> 1013 <div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>"> 1014 <div class="inside"> 1015 <?php call_user_func( $box['callback'], $object, $box ); ?> 1016 </div><!-- .inside --> 1017 </div><!-- .accordion-section-content --> 1018 </li><!-- .control-section --> 1019 <?php 1020 } 1021 } 1022 } 1023 } while(0); 1024 1025 return $i; 1026 } 1027 1028 /** 971 1029 * Add a new section to a settings page. 972 1030 * 973 1031 * 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 this.initAccordion(); 54 57 }, 55 58 56 59 jQueryExtensions : function() { … … 262 265 }); 263 266 }, 264 267 268 initAccordion : function() { 269 var accordionOptions = $( '.accordion-container li.accordion-section' ); 270 accordionOptions.removeClass('open'); 271 accordionOptions.filter(':visible').first().addClass( 'open' ); 272 }, 273 265 274 initAccessibility : function() { 266 275 $( '.item-edit' ).off( 'focus' ).on( 'focus', function(){ 267 276 $(this).on( 'keydown', function(e){ … … 391 400 } 392 401 // hide fields 393 402 api.menuList.hideAdvancedMenuItemFields(); 403 404 $('.hide-postbox-tog').click(function () { 405 api.initAccordion(); 406 407 var hidden = $( '.accordion-container li.accordion-section' ).filter(':hidden').map(function() { return this.id; }).get().join(','); 408 $.post(ajaxurl, { 409 action: 'closed-postboxes', 410 hidden: hidden, 411 closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(), 412 page: 'nav-menus' 413 }); 414 }); 394 415 }, 395 416 396 417 initSortables : function() { … … 786 807 target = $(e.target); 787 808 788 809 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 810 795 wrapper = target.parents('.inside').first();811 panelId = target.data( 'type' ); 796 812 813 wrapper = target.parents('.accordion-section-content').first(); 814 797 815 // upon changing tabs, we want to uncheck all checkboxes 798 816 $('input', wrapper).removeAttr('checked'); 799 817 … … 806 824 // select the search bar 807 825 $('.quick-search', wrapper).focus(); 808 826 809 return false;827 e.preventDefault(); 810 828 } else if ( target.hasClass('select-all') ) { 811 829 selectAreaMatch = /#(.*)$/.exec(e.target.href); 812 830 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_accordion_sections( 'nav-menus', 'side', null ); ?> 518 </ul> 519 </div> 514 520 </form> 515 521 516 522 </div><!-- /#menu-settings-column -->