misc: require post date to be set (#9016)

This commit is contained in:
Frédéric Péters 2015-11-18 14:40:03 +01:00
parent 39a6382bba
commit fac2fda8b9
1 changed files with 23 additions and 1 deletions

View File

@ -14,6 +14,11 @@ $(function() {
$(zone).removeClass('has-page-displayed');
$(zone).removeClass('has-contact-displayed');
$('#create-new-contact').off('click').on('click', window.displayPopup);
if ($('#id_post_date').length && !$('#id_post_date').val()) {
$('div.qualif button.done').attr('disabled', 'disabled');
} else {
$('div.qualif button.done').removeAttr('disabled');
}
if (typeof(callback) === 'function') callback();
},
error: function(error) { console.log(':(', error); }
@ -77,6 +82,11 @@ $(function() {
var zone = $('.cell.qualif');
$(zone).find('> div').replaceWith(data);
$(zone).find('select').select2();
if ($('#id_post_date').length && !$('#id_post_date').val()) {
$('div.qualif button.done').attr('disabled', 'disabled');
} else {
$('div.qualif button.done').removeAttr('disabled');
}
}
});
}
@ -95,7 +105,14 @@ $(function() {
source_pk: source_pk},
method: 'POST',
dataType: 'html',
success: function(data) { $('.cell.qualif > div').replaceWith(data); },
success: function(data) {
$('.cell.qualif > div').replaceWith(data);
if ($('#id_post_date').length && !$('#id_post_date').val()) {
$('div.qualif button.done').attr('disabled', 'disabled');
} else {
$('div.qualif button.done').removeAttr('disabled');
}
},
error: function(error) { console.log(':(', error); }
});
return false;
@ -167,6 +184,11 @@ $(function() {
$('div.source .active').data('registered-mail-number', registered_mail_number);
$('div.source .active').data('mail-number', mail_number);
$('#source-mainarea form').effect('highlight');
if ($('#id_post_date').length && !$('#id_post_date').val()) {
$('div.qualif button.done').attr('disabled', 'disabled');
} else {
$('div.qualif button.done').removeAttr('disabled');
}
},
error: function(error) { console.log(':(', error); }
});