Forms with the class .wp-upload-form will now have their submit button disabled until a file is selected. props kovshenin, helenyhou, lessbloat, SergeyBiryukov, tommcfarlin. fixes #20855.
git-svn-id: https://develop.svn.wordpress.org/trunk@22459 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f909a703b0
commit
85efa182f7
@ -254,7 +254,7 @@ if ( get_background_image() ) {
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row"><?php _e('Select Image'); ?></th>
|
<th scope="row"><?php _e('Select Image'); ?></th>
|
||||||
<td><form enctype="multipart/form-data" id="upload-form" method="post" action="">
|
<td><form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="">
|
||||||
<p>
|
<p>
|
||||||
<label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
|
<label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
|
||||||
<input type="file" id="upload" name="import" />
|
<input type="file" id="upload" name="import" />
|
||||||
|
@ -525,7 +525,7 @@ class Custom_Image_Header {
|
|||||||
printf( __( 'Suggested height is <strong>%1$d pixels</strong>.' ) . ' ', get_theme_support( 'custom-header', 'height' ) );
|
printf( __( 'Suggested height is <strong>%1$d pixels</strong>.' ) . ' ', get_theme_support( 'custom-header', 'height' ) );
|
||||||
}
|
}
|
||||||
?></p>
|
?></p>
|
||||||
<form enctype="multipart/form-data" id="upload-form" method="post" action="<?php echo esc_attr( add_query_arg( 'step', 2 ) ) ?>">
|
<form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_attr( add_query_arg( 'step', 2 ) ) ?>">
|
||||||
<p>
|
<p>
|
||||||
<label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
|
<label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
|
||||||
<input type="file" id="upload" name="import" />
|
<input type="file" id="upload" name="import" />
|
||||||
|
@ -142,13 +142,13 @@ function install_search_form( $type_selector = true ) {
|
|||||||
*/
|
*/
|
||||||
function install_plugins_upload( $page = 1 ) {
|
function install_plugins_upload( $page = 1 ) {
|
||||||
?>
|
?>
|
||||||
<h4><?php _e('Install a plugin in .zip format') ?></h4>
|
<h4><?php _e('Install a plugin in .zip format'); ?></h4>
|
||||||
<p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.') ?></p>
|
<p class="install-help"><?php _e('If you have a plugin in a .zip format, you may install it by uploading it here.'); ?></p>
|
||||||
<form method="post" enctype="multipart/form-data" action="<?php echo self_admin_url('update.php?action=upload-plugin') ?>">
|
<form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-plugin'); ?>">
|
||||||
<?php wp_nonce_field( 'plugin-upload') ?>
|
<?php wp_nonce_field( 'plugin-upload'); ?>
|
||||||
<label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
|
<label class="screen-reader-text" for="pluginzip"><?php _e('Plugin zip file'); ?></label>
|
||||||
<input type="file" id="pluginzip" name="pluginzip" />
|
<input type="file" id="pluginzip" name="pluginzip" />
|
||||||
<input type="submit" class="button" value="<?php esc_attr_e('Install Now') ?>" />
|
<?php submit_button( __( 'Install Now' ), 'button', 'install-plugin-submit', false ); ?>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -787,7 +787,7 @@ function wp_import_upload_form( $action ) {
|
|||||||
<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
|
<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
|
||||||
else :
|
else :
|
||||||
?>
|
?>
|
||||||
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo esc_attr(wp_nonce_url($action, 'import-upload')); ?>">
|
<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_attr(wp_nonce_url($action, 'import-upload')); ?>">
|
||||||
<p>
|
<p>
|
||||||
<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
|
<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
|
||||||
<input type="file" id="upload" name="import" size="25" />
|
<input type="file" id="upload" name="import" size="25" />
|
||||||
|
@ -134,10 +134,10 @@ add_action('install_themes_dashboard', 'install_themes_dashboard');
|
|||||||
|
|
||||||
function install_themes_upload($page = 1) {
|
function install_themes_upload($page = 1) {
|
||||||
?>
|
?>
|
||||||
<h4><?php _e('Install a theme in .zip format') ?></h4>
|
<h4><?php _e('Install a theme in .zip format'); ?></h4>
|
||||||
<p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.') ?></p>
|
<p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.'); ?></p>
|
||||||
<form method="post" enctype="multipart/form-data" action="<?php echo self_admin_url('update.php?action=upload-theme') ?>">
|
<form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-theme'); ?>">
|
||||||
<?php wp_nonce_field( 'theme-upload') ?>
|
<?php wp_nonce_field( 'theme-upload'); ?>
|
||||||
<input type="file" name="themezip" />
|
<input type="file" name="themezip" />
|
||||||
<?php submit_button( __( 'Install Now' ), 'button', 'install-theme-submit', false ); ?>
|
<?php submit_button( __( 'Install Now' ), 'button', 'install-theme-submit', false ); ?>
|
||||||
</form>
|
</form>
|
||||||
|
@ -249,7 +249,7 @@ $(document).ready( function() {
|
|||||||
sensitivity: 7,
|
sensitivity: 7,
|
||||||
interval: 90
|
interval: 90
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.on('focus.adminmenu', '.wp-submenu a', function(e){
|
menu.on('focus.adminmenu', '.wp-submenu a', function(e){
|
||||||
$(e.target).closest('li.menu-top').addClass('opensub');
|
$(e.target).closest('li.menu-top').addClass('opensub');
|
||||||
}).on('blur.adminmenu', '.wp-submenu a', function(e){
|
}).on('blur.adminmenu', '.wp-submenu a', function(e){
|
||||||
@ -388,6 +388,20 @@ $(document).ready( function() {
|
|||||||
if ( e.target.scrollIntoView )
|
if ( e.target.scrollIntoView )
|
||||||
e.target.scrollIntoView(false);
|
e.target.scrollIntoView(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Disable upload buttons until files are selected
|
||||||
|
(function(){
|
||||||
|
var button, input, form = $('form.wp-upload-form');
|
||||||
|
if ( ! form.length )
|
||||||
|
return;
|
||||||
|
button = form.find('input[type="submit"]');
|
||||||
|
input = form.find('input[type="file"]');
|
||||||
|
function toggleUploadButton() {
|
||||||
|
button.prop('disabled', '' === input.val());
|
||||||
|
}
|
||||||
|
toggleUploadButton();
|
||||||
|
input.on('change', toggleUploadButton);
|
||||||
|
})();
|
||||||
});
|
});
|
||||||
|
|
||||||
// internal use
|
// internal use
|
||||||
|
Loading…
Reference in New Issue
Block a user