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: https://develop.svn.wordpress.org/trunk@22442 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2012-11-07 21:31:08 +00:00
parent dea9cf01ce
commit 2bd843f1e7
1 changed files with 14 additions and 0 deletions

View File

@ -387,6 +387,10 @@ jQuery(document).ready( function($) {
} }
function updateText() { function updateText() {
if ( ! $('#timestampdiv').length )
return true;
var attemptedDate, originalDate, currentDate, publishOn, postStatus = $('#post_status'), var attemptedDate, originalDate, currentDate, publishOn, postStatus = $('#post_status'),
optPublish = $('option[value="publish"]', postStatus), aa = $('#aa').val(), optPublish = $('option[value="publish"]', postStatus), aa = $('#aa').val(),
mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(); mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val();
@ -534,6 +538,16 @@ jQuery(document).ready( function($) {
return false; 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() { $('#post-status-select').siblings('a.edit-post-status').click(function() {
if ($('#post-status-select').is(":hidden")) { if ($('#post-status-select').is(":hidden")) {
$('#post-status-select').slideDown('fast'); $('#post-status-select').slideDown('fast');