WordPress.org

Make WordPress Core

Ticket #9777: 9777.6.diff

File 9777.6.diff, 2.9 KB (added by bradt, 6 years ago)

Replaced onclick attribute with proper JS.

  • wp-admin/css/common.css

    diff --git src/wp-admin/css/common.css src/wp-admin/css/common.css
    index 694811b..d39d8ef 100644
    hr { 
    793793.submitbox .submitdelete,
    794794#media-items a.delete,
    795795#media-items a.delete-permanently,
    796 #nav-menu-footer .menu-delete {
     796#nav-menu-footer .menu-delete,
     797#delete-link a.delete  {
    797798        color: #a00;
    798799}
    799800
    abbr.required, 
    809810.submitbox .submitdelete:hover,
    810811#media-items a.delete:hover,
    811812#media-items a.delete-permanently:hover,
    812 #nav-menu-footer .menu-delete:hover {
     813#nav-menu-footer .menu-delete:hover,
     814#delete-link a.delete:hover {
    813815        color: #f00;
    814816        text-decoration: none;
    815817        border: none;
    abbr.required, 
    833835        float: left;
    834836}
    835837
     838#delete-link {
     839        line-height: 28px;
     840        vertical-align: middle;
     841        text-align: left;
     842        margin-left: 15px;
     843}
     844
     845#delete-link a {
     846        text-decoration: none;
     847}
     848
    836849#publishing-action {
    837850        text-align: right;
    838851        float: right;
  • wp-admin/edit-tag-form.php

    diff --git src/wp-admin/edit-tag-form.php src/wp-admin/edit-tag-form.php
    index 082086f..2201560 100644
    if ( 'category' == $taxonomy ) { 
    196196 */
    197197do_action( "{$taxonomy}_edit_form", $tag, $taxonomy );
    198198
    199 submit_button( __('Update') );
     199submit_button( __('Update'), 'primary', NULL, false, NULL );
    200200?>
     201
     202<?php if ( (int) get_option( 'default_category' ) !== $tag_ID ) : ?>
     203<span id="delete-link">
     204        <a class="delete" href="<?php echo admin_url( wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) ) ?>"'><?php _e( 'Delete' ); ?></a>
     205</span>
     206<?php endif; ?>
    201207</form>
    202208</div>
    203209<script type="text/javascript">
  • wp-admin/edit-tags.php

    diff --git src/wp-admin/edit-tags.php src/wp-admin/edit-tags.php
    index 501b585..df3ad4a 100644
    case 'delete': 
    8888        wp_delete_term( $tag_ID, $taxonomy );
    8989
    9090        $location = add_query_arg( 'message', 2, $location );
     91        $location = remove_query_arg( array( 'tag_ID', 'action' ), $location );
    9192
    9293        break;
    9394
    case 'edit': 
    122123        $tag = get_term( $tag_ID, $taxonomy, OBJECT, 'edit' );
    123124        if ( ! $tag )
    124125                wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
     126
     127        wp_enqueue_script( 'admin-tags' );
     128
    125129        require_once( ABSPATH . 'wp-admin/admin-header.php' );
    126130        include( ABSPATH . 'wp-admin/edit-tag-form.php' );
    127131        include( ABSPATH . 'wp-admin/admin-footer.php' );
  • wp-admin/js/tags.js

    diff --git src/wp-admin/js/tags.js src/wp-admin/js/tags.js
    index 333a2eb..b10c0cc 100644
    jQuery(document).ready(function($) { 
    2828                return false;
    2929        });
    3030
     31        $( '#edittag' ).on( 'click', '.delete', function() {
     32                if ( 'undefined' === typeof showNotice ) {
     33                        return true;
     34                }
     35                return showNotice.warn();
     36        });
     37
    3138        $('#submit').click(function(){
    3239                var form = $(this).parents('form');
    3340