From 86b5802d754d5cc3d383878ef919c79e6290d63d Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Thu, 19 May 2016 22:58:55 +0000 Subject: [PATCH] Refine the FTP credentials form interaction. Properly toggle SSH2 Authentication Keys fieldset visibility. JavaScript and CSS clean-up. Props Mte90. Fixes #34376. git-svn-id: https://develop.svn.wordpress.org/trunk@37467 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/forms.css | 6 +++- src/wp-admin/includes/file.php | 50 ++++++++++++++++------------------ src/wp-admin/js/updates.js | 11 +++++--- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/wp-admin/css/forms.css b/src/wp-admin/css/forms.css index 5a3aa78508..3616af66ff 100644 --- a/src/wp-admin/css/forms.css +++ b/src/wp-admin/css/forms.css @@ -970,7 +970,7 @@ table.form-table td .updated p { } .request-filesystem-credentials-dialog .notification-dialog { - top: 15%; + top: 10%; max-height: 85%; } @@ -1028,6 +1028,10 @@ table.form-table td .updated p { margin-right: 10px; } +.request-filesystem-credentials-dialog #auth-keys-desc { + margin-bottom: 0; +} + #request-filesystem-credentials-dialog .button:not(:last-child) { margin-right: 10px; } diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 5abb4cfba5..9f47b013f3 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -1166,19 +1166,6 @@ function request_filesystem_credentials( $form_post, $type = '', $error = false, $types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context ); ?> -
" . __( 'Connectio
-
+ + $text ) : ?> + + +
+ +
"> -
- - -
- - $text ) : ?> - - +

'; diff --git a/src/wp-admin/js/updates.js b/src/wp-admin/js/updates.js index 35ae6c7d9b..0173b6ef2f 100644 --- a/src/wp-admin/js/updates.js +++ b/src/wp-admin/js/updates.js @@ -471,6 +471,9 @@ window.wp = window.wp || {}; $( document ).ready( function() { + // Set initial focus on the first empty form field. + $( '#request-filesystem-credentials-form input[value=""]:first' ).focus(); + /* * Check whether a user needs to submit filesystem credentials based on whether * the form was output on the page server-side. @@ -503,10 +506,10 @@ window.wp = window.wp || {}; wp.updates.requestForCredentialsModalCancel(); }); - // Hide SSH fields when not selected - $( '#request-filesystem-credentials-dialog input[name="connection_type"]' ).on( 'change', function() { - $( this ).parents( 'form' ).find( '#private_key, #public_key' ).parents( 'label' ).toggle( ( 'ssh' == $( this ).val() ) ); - }).change(); + // Hide SSH fields when not selected. + $( '#request-filesystem-credentials-form input[name="connection_type"]' ).on( 'change', function() { + $( '#ssh-keys' ).toggleClass( 'hidden', ( 'ssh' !== $( this ).val() ) ); + }); // Click handler for plugin updates in List Table view. $( '.plugin-update-tr' ).on( 'click', '.update-link', function( e ) {