Ticket #23770: 23770.7.diff
File 23770.7.diff, 12.0 KB (added by , 12 years ago) |
---|
-
wp-admin/css/wp-admin-rtl.css
form.upgrade .hint { 697 697 .fixed .column-comments a { 698 698 float: right; 699 699 } 700 .fixed .column-menus { 701 text-align: right; 702 } 700 703 .sorting-indicator { 701 704 margin-left: 0; 702 705 margin-right: 7px; … … body.login { 2083 2086 float: right; 2084 2087 } 2085 2088 2089 .menu-location-menus select { 2090 float: right; 2091 } 2092 2093 .locations-row-links { 2094 float: right; 2095 margin: 4px 6px 0 0; 2096 } 2097 2098 .locations-add-menu-link { 2099 direction: rtl; 2100 } 2101 2102 .locations-edit-menu-link { 2103 border-left: 1px solid #CCCCCC; 2104 border-right: 0; 2105 padding-left: 6px; 2106 padding-right: 0; 2107 float: right; 2108 } 2109 2086 2110 /* Menu Container */ 2087 2111 #menu-management-liquid { 2088 2112 float: right; -
wp-admin/css/wp-admin.css
table.fixed { 2423 2423 width: 8%; 2424 2424 } 2425 2425 2426 .fixed .column-posts, 2426 2427 .fixed .column-date, 2427 2428 .fixed .column-parent, 2428 2429 .fixed .column-links, … … table.fixed { 2439 2440 width: 15%; 2440 2441 } 2441 2442 2443 .fixed .column-slug { 2444 width: 25%; 2445 } 2446 2447 .fixed .column-locations { 2448 width: 35%; 2449 } 2450 2442 2451 .fixed .column-comments { 2443 2452 width: 4em; 2444 2453 padding: 8px 0; … … table.fixed { 2453 2462 float: left; 2454 2463 } 2455 2464 2456 .fixed .column-slug {2457 width: 25%;2458 }2459 2460 .fixed .column-posts {2461 width: 10%;2462 }2463 2464 2465 .fixed .column-icon { 2465 2466 width: 80px; 2466 2467 } … … tr.wp-locked .row-actions .trash { 2547 2548 margin-top: 3px; 2548 2549 } 2549 2550 2551 #menu-locations-wrap .widefat { 2552 width: 60%; 2553 } 2554 2550 2555 .widefat th.sortable, 2551 2556 .widefat th.sorted { 2552 2557 padding: 0; … … body.interim-login { 7384 7389 7385 7390 #nav-menus-frame { 7386 7391 margin-left: 300px; 7387 margin-top: 2 8px;7392 margin-top: 23px; 7388 7393 } 7389 7394 7390 7395 #wpbody-content #menu-settings-column { … … body.interim-login { 7401 7406 margin: 10px 0 0; 7402 7407 } 7403 7408 7404 .metabox-holder-disabled .postbox { 7409 .metabox-holder-disabled .postbox, 7410 .metabox-holder-disabled .accordion-section-content { 7405 7411 opacity: 0.5; 7406 7412 filter: alpha(opacity=50); 7407 7413 } … … body.interim-login { 7432 7438 } 7433 7439 7434 7440 .manage-menus { 7435 margin-top: 13px;7441 margin-top: 23px; 7436 7442 padding: 10px; 7437 7443 overflow: hidden; 7438 7444 -webkit-border-radius: 3px; … … body.interim-login { 7566 7572 margin-top: -2px; 7567 7573 } 7568 7574 7575 .widefat td.menu-location-menus { 7576 padding-bottom: 5px; 7577 } 7578 7579 .menu-location-menus select { 7580 float: left; 7581 } 7582 7583 #locations-nav-menu-wrapper { 7584 padding: 5px 0; 7585 } 7586 7587 .locations-nav-menu-select select { 7588 float: left; 7589 width: 160px; 7590 margin-right: 5px; 7591 } 7592 7593 .locations-row-links { 7594 float: left; 7595 margin: 6px 0 0 6px; 7596 } 7597 7598 .locations-edit-menu-link, 7599 .locations-add-menu-link { 7600 margin: 0 3px; 7601 } 7602 7603 .locations-edit-menu-link { 7604 padding-right: 3px; 7605 border-right: 1px solid #ccc; 7606 } 7607 7569 7608 #wpbody .open-label { 7570 7609 display: block; 7571 7610 float:left; -
wp-admin/js/nav-menu.js
var wpNavMenu; 48 48 if ( menus.oneThemeLocationNoMenus ) 49 49 $( '#posttype-page' ).addSelectedToMenu( api.addMenuItemToBottom ); 50 50 51 this.initManageLocations(); 52 51 53 this.initAccessibility(); 52 54 53 55 this.initToggles(); … … var wpNavMenu; 735 737 } 736 738 }, 737 739 740 initManageLocations : function () { 741 $('.menu-location-menus select').on('change', function () { 742 var editLink = $('.locations-edit-menu-link'); 743 if ($(this).find('option:selected').data('orig')) 744 editLink.show(); 745 else 746 editLink.hide(); 747 }); 748 }, 749 738 750 attachMenuEditListeners : function() { 739 751 var that = this; 740 752 $('#update-nav-menu').bind('click', function(e) { … … var wpNavMenu; 927 939 }, 928 940 929 941 attachUnsavedChangesListener : function() { 930 $('#menu-management input, #menu-management select, #menu-management, #menu-management textarea ').change(function(){942 $('#menu-management input, #menu-management select, #menu-management, #menu-management textarea, .menu-location-menus select').change(function(){ 931 943 api.registerChange(); 932 944 }); 933 945 934 if ( 0 != $('#menu-to-edit').length ) {946 if ( 0 != $('#menu-to-edit').length || 0 != $('.menu-location-menus select').length ) { 935 947 window.onbeforeunload = function(){ 936 948 if ( api.menusChanged ) 937 949 return navMenuL10n.saveAlert; -
wp-admin/nav-menus.php
$nav_menu_selected_title = ''; 37 37 // The menu id of the current menu being edited 38 38 $nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0; 39 39 40 // Get existing menu locations assignments 41 $locations = get_registered_nav_menus(); 42 $menu_locations = get_nav_menu_locations(); 43 $num_locations = count( array_keys( $locations ) ); 44 40 45 // Allowed actions: add, update, delete 41 46 $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit'; 42 47 … … switch ( $action ) { 262 267 case 'update': 263 268 check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' ); 264 269 265 // Get existing menu locations assignments266 $locations = get_registered_nav_menus();267 $menu_locations = get_nav_menu_locations();268 269 270 // Remove menu locations that have been unchecked 270 271 foreach ( $locations as $location => $description ) { 271 272 if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ) … … switch ( $action ) { 341 342 } 342 343 } 343 344 break; 345 case 'locations': 346 add_filter( 'screen_options_show_screen', '__return_false' ); 347 348 if ( isset( $_POST['menu-locations'] ) ) { 349 check_admin_referer( 'save-menu-locations' ); 350 351 $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); 352 $menu_locations = array_merge( $menu_locations, $new_menu_locations ); 353 // Set menu locations 354 set_theme_mod( 'nav_menu_locations', $menu_locations ); 355 356 $messages[] = '<div id="message" class="updated"><p>' . __( 'Menu locations updated.' ) . '</p></div>'; 357 } 358 break; 344 359 } 345 360 346 361 // Get all nav menus … … $menu_count = count( $nav_menus ); 350 365 // Are we on the add new screen? 351 366 $add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false; 352 367 368 $locations_screen = ( isset( $_GET['action'] ) && 'locations' == $_GET['action'] ) ? true : false; 369 353 370 // If we have one theme location, and zero menus, we take them right into editing their first menu 354 371 $page_count = wp_count_posts( 'page' ); 355 372 $one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false; … … require_once( './admin-header.php' ); 474 491 ?> 475 492 <div class="wrap"> 476 493 <?php screen_icon(); ?> 477 <h2><?php _e( 'Menus' ); ?> <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0, ), admin_url( 'nav-menus.php' ) ) ); ?>" class="add-new-h2"><?php _ex( 'Add New', 'menu' ); ?></a></h2> 494 <h2 class="nav-tab-wrapper"> 495 <a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a> 496 <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a> 497 </h2> 478 498 <?php 479 499 foreach( $messages as $message ) : 480 500 echo $message . "\n"; 481 501 endforeach; 482 502 ?> 503 <?php 504 if ( $locations_screen ) : 505 echo '<p>' . sprintf( _n( 'Your theme supports %s menu. Select which menu you would like to use below.', 'Your theme supports %s menus. Select a menu to use for each theme location below.', $num_locations ), number_format_i18n( $num_locations ) ) . '</p>'; 506 ?> 507 <div id="menu-locations-wrap"> 508 <form method="post" action="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>"> 509 <table class="widefat fixed" cellspacing="0" id="menu-locations-table"> 510 <thead> 511 <tr> 512 <th scope="col" class="manage-column column-locations"><?php _e( 'Theme Location' ); ?></th> 513 <th scope="col" class="manage-column column-menus"><?php _e( 'Assigned Menu' ); ?></th> 514 </tr> 515 </thead> 516 <!--<tfoot> 517 <tr> 518 <th scope="col" class="manage-column column-locations"><?php _e( 'Theme Location' ); ?></th> 519 <th scope="col" class="manage-column column-menus"><?php _e( 'Assigned Menu' ); ?></th> 520 </tr> 521 </tfoot>--> 522 <tbody class="menu-locations"> 523 <?php foreach ( $locations as $_location => $_name ) { ?> 524 <tr id="menu-locations-row"> 525 <td class="menu-location-title"><strong><?php echo $_name; ?></strong></td> 526 <td class="menu-location-menus"> 527 <select name="menu-locations[<?php echo $_location; ?>]" id="locations-<?php echo $_location; ?>"> 528 <option value="0"><?php printf( '— %s —', esc_html__( 'Select a Menu' ) ); ?></option> 529 <?php foreach ( $nav_menus as $menu ) : ?> 530 <?php $selected = isset( $menu_locations[$_location] ) && $menu_locations[$_location] == $menu->term_id; ?> 531 <option <?php if ( $selected ) echo 'data-orig="true"'; ?> <?php selected( $selected ); ?> value="<?php echo $menu->term_id; ?>"> 532 <?php $truncated_name = wp_html_excerpt( $menu->name, 40 ); 533 echo $truncated_name == $menu->name ? $menu->name : trim( $truncated_name ) . '…'; ?> 534 </option> 535 <?php endforeach; ?> 536 </select> 537 <div class="locations-row-links"> 538 <?php if ( isset( $menu_locations[ $_location ] ) && 0 != $menu_locations[ $_location ] ) : ?> 539 <span class="locations-edit-menu-link"> 540 <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => $menu_locations[$_location] ), admin_url( 'nav-menus.php' ) ) ); ?>"> 541 <?php _ex( 'Edit', 'menu' ); ?> 542 </a> 543 </span> 544 <?php endif; ?> 545 <span class="locations-add-menu-link"> 546 <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ); ?>"> 547 <?php _ex( 'Use new menu', 'menu' ); ?> 548 </a> 549 </span> 550 </div><!-- #locations-row-links --> 551 </td><!-- .menu-location-menus --> 552 </tr><!-- #menu-locations-row --> 553 <?php } // foreach ?> 554 </tbody> 555 </table> 556 <p class="button-controls"><?php submit_button( __( 'Save Changes' ), 'primary left', 'nav-menu-locations', false ); ?></p> 557 <?php wp_nonce_field( 'save-menu-locations' ); ?> 558 <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> 559 </form> 560 </div><!-- #menu-locations-wrap --> 561 <?php do_action( 'after_menu_locations_table' ); ?> 562 <?php else : ?> 483 563 <div class="manage-menus"> 484 <?php if ( $menu_count < 2 ) : ?>564 <?php if ( $menu_count < 2 ) : ?> 485 565 <span class="add-edit-menu-action"> 486 566 <?php printf( __( 'Edit your menu below, or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?> 487 567 </span><!-- /add-edit-menu-action --> 488 <?php else : ?>489 <form method="get" action="">568 <?php else : ?> 569 <form method="get" action="<?php echo admin_url( 'nav-menus.php' ); ?>"> 490 570 <input type="hidden" name="action" value="edit" /> 491 571 <label for="menu" class="selected-menu"><?php _e( 'Select a menu to edit:' ); ?></label> 492 572 <select name="menu" id="menu"> … … require_once( './admin-header.php' ); 633 713 </div><!-- /#menu-management --> 634 714 </div><!-- /#menu-management-liquid --> 635 715 </div><!-- /#nav-menus-frame --> 716 <?php endif; ?> 636 717 </div><!-- /.wrap--> 637 718 <?php include( './admin-footer.php' ); ?>