Post UI: Provide visual feedback to the user if they try to set an invalid date for a post. Fixes #17180 props jkudish.

git-svn-id: http://core.svn.wordpress.org/trunk@22442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Westwood 2012-11-07 21:31:08 +00:00
parent a79310d45c
commit 5c72b7344b

View File

@ -387,6 +387,10 @@ jQuery(document).ready( function($) {
}
function updateText() {
if ( ! $('#timestampdiv').length )
return true;
var attemptedDate, originalDate, currentDate, publishOn, postStatus = $('#post_status'),
optPublish = $('option[value="publish"]', postStatus), aa = $('#aa').val(),
mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val();
@ -534,6 +538,16 @@ jQuery(document).ready( function($) {
return false;
});
$('#post').on( 'submit', function(e){
if ( ! updateText() ) {
e.preventDefault();
$('#timestampdiv').show();
$('#publishing-action .spinner').hide();
$('#publish').prop('disabled', false).removeClass('button-primary-disabled');
return false;
}
});
$('#post-status-select').siblings('a.edit-post-status').click(function() {
if ($('#post-status-select').is(":hidden")) {
$('#post-status-select').slideDown('fast');