[wp-trac] [WordPress Trac] #20855: Don't show Upload button until file has been selected.
WordPress Trac
wp-trac at lists.automattic.com
Sat Jul 21 03:02:30 UTC 2012
#20855: Don't show Upload button until file has been selected.
----------------------------+------------------------
Reporter: jane | Owner: kovshenin
Type: task (blessed) | Status: accepted
Priority: normal | Milestone: 3.5
Component: UI | Version: 3.4
Severity: minor | Resolution:
Keywords: needs-patch |
----------------------------+------------------------
Comment (by tommcfarlin):
The current patches (*.3.patch being the full working copy) that I've
contributed provide a solution for hiding the 'Upload' button until the
'Choose Image' input element values have changed for both the Custom
Header and Custom Background pages.
One concern that I have is that there is code duplication between custom-
header.dev.js and custom-background.dev.js as well as their minified
counterparts:
Namely (the unminified code), this exists in both files:
{{{
// Watch for the value of the "Choose Image" field to change...
$('#upload').change(function() {
// If the upload field is empty, we'll hide te upload button,
// Otherwise, let's show it.
if( '' === $('#upload').val() ) {
$('#submit').hide();
} else {
$('#submit').show();
} // end if/else
});
}}}
Ideally, I'd like to collapse this into a single JavaScript file (perhaps
custom-upload.dev.js?) so that the code isn't duplicated; however, I'm
unfamiliar with what's considered a best practice in this case.
Secondly, I've manually updated the minified versions of the related
stylesheets and JavaScript, too. Is this typical practice or do you look
for *.dev.js and *.dev.css to be contributed in patches and then run
minification on your end?
Looking to you **@kovshenin** and **@jane** for advice on this - thanks!
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20855#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list